Closed
Description
My build script fails only on Mac (macOS Mojave 10.14.6). It works fine on linux.
Also tried setting CMAKE_C_COMPILER_WORKS
but then I get errors like fatal error: 'stdio.h' file not found
.
Here's the relevant part of my build.rs -
let dst = Config::new("mylib-core")
.profile("MinSizeRel")
.define("USE_CURL", "OFF")
.build_target("mylib")
.build();
println!("cargo:rustc-link-search=native={}/build/lib", dst.display());
println!("cargo:rustc-link-lib=static=mylib");
Here's the output -
error: failed to run custom build command for `mylib-sys v0.1.0 (/Users/dev/mylib-core/rust/mylib-sys)`
Caused by:
process didn't exit successfully: `/Users/dev/mylib-core/rust/target/debug/build/mylib-sys-f177755e646ed510/build-script-build` (exit code: 101)
--- stdout
cargo:rerun-if-env-changed=MACOSX_DEPLOYMENT_TARGET
running: "cmake" "/Users/dev/mylib-core/rust/mylib-sys/mylib-core" "-DCMAKE_OSX_ARCHITECTURES=x86_64" "-DCMAKE_OSX_SYSROOT=macosx" "-DCMAKE_OSX_DEPLOYMENT_TARGET=" "-DUSE_CURL=OFF" "-DDEV_NO_INTRN_PTR=OFF" "-DCMAKE_INSTALL_PREFIX=/Users/dev/mylib-core/rust/target/debug/build/mylib-sys-83508180fe1bf192/out" "-DCMAKE_C_FLAGS= -ffunction-sections -fdata-sections -fPIC -m64" "-DCMAKE_C_COMPILER=/usr/bin/cc" "-DCMAKE_CXX_FLAGS= -ffunction-sections -fdata-sections -fPIC -m64" "-DCMAKE_CXX_COMPILER=/usr/bin/c++" "-DCMAKE_ASM_FLAGS= -ffunction-sections -fdata-sections -fPIC -m64" "-DCMAKE_ASM_COMPILER=/usr/bin/cc" "-DCMAKE_BUILD_TYPE=MinSizeRel"
-- The C compiler identification is AppleClang 10.0.1.10010046
-- The CXX compiler identification is AppleClang 10.0.1.10010046
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- broken
-- Configuring incomplete, errors occurred!
See also "/Users/dev/mylib-core/rust/target/debug/build/mylib-sys-83508180fe1bf192/out/build/CMakeFiles/CMakeOutput.log".
See also "/Users/dev/mylib-core/rust/target/debug/build/mylib-sys-83508180fe1bf192/out/build/CMakeFiles/CMakeError.log".
--- stderr
CMake Error at /usr/local/Cellar/cmake/3.16.1/share/cmake/Modules/CMakeTestCCompiler.cmake:60 (message):
The C compiler
"/usr/bin/cc"
is not able to compile a simple test program.
It fails with the following output:
Change Dir: /Users/dev/mylib-core/rust/target/debug/build/mylib-sys-83508180fe1bf192/out/build/CMakeFiles/CMakeTmp
Run Build Command(s):/usr/bin/make cmTC_b026a/fast && /Library/Developer/CommandLineTools/usr/bin/make -f CMakeFiles/cmTC_b026a.dir/build.make CMakeFiles/cmTC_b026a.dir/build
Building C object CMakeFiles/cmTC_b026a.dir/testCCompiler.c.o
/usr/bin/cc -ffunction-sections -fdata-sections -fPIC -m64 -arch x86_64 -isysroot macosx -o CMakeFiles/cmTC_b026a.dir/testCCompiler.c.o -c /Users/dev/mylib-core/rust/target/debug/build/mylib-sys-83508180fe1bf192/out/build/CMakeFiles/CMakeTmp/testCCompiler.c
clang: warning: no such sysroot directory: 'macosx' [-Wmissing-sysroot]
Linking C executable cmTC_b026a
/usr/local/Cellar/cmake/3.16.1/bin/cmake -E cmake_link_script CMakeFiles/cmTC_b026a.dir/link.txt --verbose=1
/usr/bin/cc -ffunction-sections -fdata-sections -fPIC -m64 -arch x86_64 -isysroot macosx -Wl,-search_paths_first -Wl,-headerpad_max_install_names CMakeFiles/cmTC_b026a.dir/testCCompiler.c.o -o cmTC_b026a
clang: warning: no such sysroot directory: 'macosx' [-Wmissing-sysroot]
ld: library not found for -lSystem
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[1]: *** [cmTC_b026a] Error 1
make: *** [cmTC_b026a/fast] Error 2
CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
CMakeLists.txt:39 (project)
thread 'main' panicked at '
command did not execute successfully, got: exit code: 1
build script failed, must exit now', /Users/dev/.cargo/registry/src/github.com-1ecc6299db9ec823/cmake-0.1.43/src/lib.rs:1104:5
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
warning: build failed, waiting for other jobs to finish...
error: build failed
Metadata
Metadata
Assignees
Labels
No labels