Can't build crate as wasm target
- Dominant language
- Rust
- Stars
- 186
- Forks
- 63
- PR merge metrics
- No merged PRs in 30d
Description
```
cargo build --target wasm32-unknown-unknown
```
```
error: failed to run custom build command for `proj-sys v0.22.0 (/Users/coreyf/dev/georust/proj/proj-sys)`
Caused by:
process didn't exit successfully: `/Users/coreyf/dev/georust/proj/target/debug/build/proj-sys-141d6ea7039d6b8c/build-script-build` (exit status: 101)
--- stdout
cargo:rerun-if-env-changed=PROJ_NO_PKG_CONFIG
cargo:rerun-if-env-changed=PKG_CONFIG_ALLOW_CROSS_wasm32-unknown-unknown
cargo:rerun-if-env-changed=PKG_CONFIG_ALLOW_CROSS_wasm32_unknown_unknown
cargo:rerun-if-env-changed=TARGET_PKG_CONFIG_ALLOW_CROSS
cargo:rerun-if-env-changed=PKG_CONFIG_ALLOW_CROSS
cargo:rerun-if-env-changed=PKG_CONFIG_wasm32-unknown-unknown
cargo:rerun-if-env-changed=PKG_CONFIG_wasm32_unknown_unknown
cargo:rerun-if-env-changed=TARGET_PKG_CONFIG
cargo:rerun-if-env-changed=PKG_CONFIG
cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_wasm32-unknown-unknown
cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_wasm32_unknown_unknown
cargo:rerun-if-env-changed=TARGET_PKG_CONFIG_SYSROOT_DIR
cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR
CMAKE_TOOLCHAIN_FILE_wasm32-unknown-unknown = None
CMAKE_TOOLCHAIN_FILE_wasm32_unknown_unknown = None
TARGET_CMAKE_TOOLCHAIN_FILE = None
CMAKE_TOOLCHAIN_FILE = None
CMAKE_GENERATOR_wasm32-unknown-unknown = None
CMAKE_GENERATOR_wasm32_unknown_unknown = None
TARGET_CMAKE_GENERATOR = None
CMAKE_GENERATOR = None
CMAKE_PREFIX_PATH_wasm32-unknown-unknown = None
CMAKE_PREFIX_PATH_wasm32_unknown_unknown = None
TARGET_CMAKE_PREFIX_PATH = None
CMAKE_PREFIX_PATH = None
CMAKE_wasm32-unknown-unknown = None
CMAKE_wasm32_unknown_unknown = None
TARGET_CMAKE = None
CMAKE = None
running: "cmake" "/Users/coreyf/dev/georust/proj/proj-sys/PROJSRC/proj/proj-8.1.0" "-DBUILD_SHARED_LIBS=OFF" "-DBUILD_TESTING=OFF" "-DBUILD_CCT=OFF" "-DBUILD_CS2CS=OFF" "-DBUILD_GEOD=OFF" "-DBUILD_GIE=OFF" "-DBUILD_PROJ=OFF" "-DBUILD_PROJINFO=OFF" "-DBUILD_PROJSYNC=OFF" "-DENABLE_CURL=OFF" "-DENABLE_TIFF=OFF" "-DCMAKE_INSTALL_PREFIX=/Users/coreyf/dev/georust/proj/target/wasm32-unknown-unknown/debug/build/proj-sys-53bbbe1c8a420d33/out" "-DCMAKE_C_FLAGS= -ffunction-sections -fdata-sections -fPIC --target=wasm32-unknown-unknown" "-DCMAKE_C_COMPILER=/opt/homebrew/opt/llvm/bin/clang" "-DCMAKE_CXX_FLAGS= -ffunction-sections -fdata-sections -fPIC --target=wasm32-unknown-unknown" "-DCMAKE_CXX_COMPILER=/opt/homebrew/opt/llvm/bin/clang" "-DCMAKE_ASM_FLAGS= -ffunction-sections -fdata-sections -fPIC --target=wasm32-unknown-unknown" "-DCMAKE_ASM_COMPILER=/opt/homebrew/opt/llvm/bin/clang" "-DCMAKE_BUILD_TYPE=Debug"
-- The C compiler identification is Clang 13.0.0
-- The CXX compiler identification is Clang 13.0.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - failed
-- Check for working C compiler: /opt/homebrew/opt/llvm/bin/clang
-- Check for working C compiler: /opt/homebrew/opt/llvm/bin/clang - broken
-- Configuring incomplete, errors occurred!
See also "/Users/coreyf/dev/georust/proj/target/wasm32-unknown-unknown/debug/build/proj-sys-53bbbe1c8a420d33/out/build/CMakeFiles/CMakeOutput.log".
See also "/Users/coreyf/dev/georust/proj/target/wasm32-unknown-unknown/debug/build/proj-sys-53bbbe1c8a420d33/out/build/CMakeFiles/CMakeError.log".
--- stderr
pkg-config unable to find existing libproj installation: pkg-config has not been configured to support cross-compilation.
Install a sysroot for the target platform and configure it via
PKG_CONFIG_SYSROOT_DIR and PKG_CONFIG_PATH, or install a
cross-compiling wrapper for pkg-config and set it via
PKG_CONFIG environment variable.
building libproj from source
disabling tiff support
CMake Error at /opt/homebrew/Cellar/cmake/3.22.2/share/cmake/Modules/CMakeTestCCompiler.cmake:69 (message):
The C compiler
"/opt/homebrew/opt/llvm/bin/clang"
is not able to compile a simple test program.
It fails with the following output:
Change Dir: /Users/coreyf/dev/georust/proj/target/wasm32-unknown-unknown/debug/build/proj-sys-53bbbe1c8a420d33/out/build/CMakeFiles/CMakeTmp
Run Build Command(s):/usr/bin/make -f Makefile cmTC_87c4b/fast && /Library/Developer/CommandLineTools/usr/bin/make -f CMakeFiles/cmTC_87c4b.dir/build.make CMakeFiles/cmTC_87c4b.dir/build
Building C object CMakeFiles/cmTC_87c4b.dir/testCCompiler.c.o
/opt/homebrew/opt/llvm/bin/clang -ffunction-sections -fdata-sections -fPIC --target=wasm32-unknown-unknown -arch arm64 -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX11.3.sdk -MD -MT CMakeFiles/cmTC_87c4b.dir/testCCompiler.c.o -MF CMakeFiles/cmTC_87c4b.dir/testCCompiler.c.o.d -o CMakeFiles/cmTC_87c4b.dir/testCCompiler.c.o -c /Users/coreyf/dev/georust/proj/target/wasm32-unknown-unknown/debug/build/proj-sys-53bbbe1c8a420d33/out/build/CMakeFiles/CMakeTmp/testCCompiler.c
clang-13: warning: argument unused during compilation: '-arch arm64' [-Wunused-command-line-argument]
Linking C executable cmTC_87c4b
/opt/homebrew/Cellar/cmake/3.22.2/bin/cmake -E cmake_link_script CMakeFiles/cmTC_87c4b.dir/link.txt --verbose=1
/opt/homebrew/opt/llvm/bin/clang -ffunction-sections -fdata-sections -fPIC --target=wasm32-unknown-unknown -arch arm64 -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX11.3.sdk -Wl,-search_paths_first -Wl,-headerpad_max_install_names -L/opt/homebrew/opt/llvm/lib CMakeFiles/cmTC_87c4b.dir/testCCompiler.c.o -o cmTC_87c4b
clang-13: warning: argument unused during compilation: '-arch arm64' [-Wunused-command-line-argument]
wasm-ld: error: unknown argument: -search_paths_first
wasm-ld: error: unknown argument: -headerpad_max_install_names
wasm-ld: error: cannot open crt1.o: No such file or directory
wasm-ld: error: unable to find library -lc
wasm-ld: error: cannot open /opt/homebrew/Cellar/llvm/13.0.0_2/lib/clang/13.0.0/lib/libclang_rt.builtins-wasm32.a: No such file or directory
clang-13: error: linker command failed with exit code 1 (use -v to see invocation)
make[1]: *** [cmTC_87c4b] Error 1
make: *** [cmTC_87c4b/fast] Error 2
CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
CMakeLists.txt:14 (project)
thread 'main' panicked at '
command did not execute successfully, got: exit status: 1
build script failed, must exit now', /Users/coreyf/.cargo/registry/src/github.com-1ecc6299db9ec823/cmake-0.1.48/src/lib.rs:975:5
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
```
Contributor guide
No contributing guide indexed for this repository
Research direction
Reproduce the cargo build --target wasm32-unknown-unknown command and start by inspecting proj-sys's build script and CMakeLists.txt at line 14. Trace the pkg-config and CMake compiler checks shown in the failure; done means the crate builds successfully for the wasm32-unknown-unknown target.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cmake, rust, wasm
- Domain
- build-system
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100