cmake-rs
cmake-rs copied to clipboard
cmake fails when using +crt-static on linux
https://github.com/rust-lang/rust/blob/master/RELEASES.md#compiler-1
You can now use -C target-feature=+crt-static on linux-gnu targets. Note: If you're using cargo you must explicitly pass the --target flag.
But when I run
RUSTFLAGS="-C target-feature=+crt-static" cargo build --release --target x86_64-unknown-linux-gnu
my dep that uses cmake fails with:
error: failed to run custom build command for `ffts v0.1.0 (ssh://[email protected]/Boscop/ffts-rs#ef6850c8)`
Caused by:
process didn't exit successfully: `/home/me/projects/myproject/target/release/build/ffts-a7bc83ba5c7e316e/build-script-build` (exit code: 101)
--- stdout
running: "cmake" "/home/me/.cargo/git/checkouts/ffts-rs-90217fe977f2ad3e/ef6850c/ffts" "-DCMAKE_INSTALL_PREFIX=/home/me/projects/myproject/target/x86_64-unknown-linux-gnu/release/build/ffts-63735e55463d2390/out" "-DCMAKE_C_FLAGS= -ffunction-sections -fdata-sections -fPIC -m64 -static" "-DCMAKE_C_COMPILER=/usr/bin/cc" "-DCMAKE_CXX_FLAGS= -ffunction-sections -fdata-sections -fPIC -m64 -static" "-DCMAKE_CXX_COMPILER=/usr/bin/c++" "-DCMAKE_ASM_FLAGS= -ffunction-sections -fdata-sections -fPIC -m64 -static" "-DCMAKE_ASM_COMPILER=/usr/bin/cc" "-DCMAKE_BUILD_TYPE=Release"
-- The C compiler identification is GNU 10.2.0
-- The ASM compiler identification is GNU
-- Found assembler: /usr/bin/cc
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Looking for inttypes.h
-- Looking for inttypes.h - found
-- Looking for malloc.h
-- Looking for malloc.h - found
-- Looking for mm_malloc.h
-- Looking for mm_malloc.h - found
-- Looking for stdint.h
-- Looking for stdint.h - found
-- Looking for stdlib.h
-- Looking for stdlib.h - found
-- Looking for string.h
-- Looking for string.h - found
-- Looking for sys/mman.h
-- Looking for sys/mman.h - found
-- Looking for unistd.h
-- Looking for unistd.h - found
-- Looking for memalign
-- Looking for memalign - found
-- Looking for posix_memalign
-- Looking for posix_memalign - found
-- Looking for valloc
-- Looking for valloc - found
-- Looking for _mm_malloc
-- Looking for _mm_malloc - not found
-- Looking for memalign
-- Looking for memalign - found
-- Looking for posix_memalign
-- Looking for posix_memalign - found
-- Looking for valloc
-- Looking for valloc - found
-- Looking for _mm_malloc
-- Looking for _mm_malloc - not found
-- Looking for xmmintrin.h
-- Looking for xmmintrin.h - found
-- Looking for emmintrin.h
-- Looking for emmintrin.h - found
-- Looking for pmmintrin.h
-- Looking for pmmintrin.h - found
-- Performing Test HAVE_GCC_VISIBILITY
-- Performing Test HAVE_GCC_VISIBILITY - Success
-- Looking for pow in m
-- Looking for pow in m - found
-- Could NOT find OpenMP_C (missing: OpenMP_C_FLAGS OpenMP_C_LIB_NAMES)
-- Could NOT find OpenMP (missing: OpenMP_C_FOUND)
-- Found PkgConfig: /usr/bin/pkg-config (found version "1.7.3")
-- Configuring done
-- Generating done
-- Build files have been written to: /home/me/projects/myproject/target/x86_64-unknown-linux-gnu/release/build/ffts-63735e55463d2390/out/build
running: "cmake" "--build" "." "--target" "install" "--config" "Release" "--"
Scanning dependencies of target ffts_cpu_test
[ 5%] Building C object CMakeFiles/ffts_cpu_test.dir/src/ffts_cpu.c.o
[ 11%] Building C object CMakeFiles/ffts_cpu_test.dir/tests/cpu_test.c.o
[ 16%] Linking C executable ffts_cpu_test
[ 16%] Built target ffts_cpu_test
Scanning dependencies of target ffts_static
[ 22%] Building C object CMakeFiles/ffts_static.dir/src/ffts.c.o
[ 27%] Building C object CMakeFiles/ffts_static.dir/src/ffts_chirp_z.c.o
[ 33%] Building C object CMakeFiles/ffts_static.dir/src/ffts_cpu.c.o
[ 38%] Building C object CMakeFiles/ffts_static.dir/src/ffts_nd.c.o
[ 44%] Building C object CMakeFiles/ffts_static.dir/src/ffts_real.c.o
[ 50%] Building C object CMakeFiles/ffts_static.dir/src/ffts_real_nd.c.o
[ 55%] Building C object CMakeFiles/ffts_static.dir/src/ffts_transpose.c.o
[ 61%] Building C object CMakeFiles/ffts_static.dir/src/ffts_trig.c.o
[ 66%] Building C object CMakeFiles/ffts_static.dir/src/ffts_static.c.o
[ 72%] Building C object CMakeFiles/ffts_static.dir/src/codegen.c.o
[ 77%] Linking C static library libffts.a
[ 77%] Built target ffts_static
Scanning dependencies of target ffts_test
[ 83%] Building C object CMakeFiles/ffts_test.dir/tests/test.c.o
[ 88%] Linking C executable ffts_test
[ 88%] Built target ffts_test
Scanning dependencies of target ffts_trig_test
[ 94%] Building C object CMakeFiles/ffts_trig_test.dir/tests/trig_test.c.o
[100%] Linking C executable ffts_trig_test
--- stderr
CMake Warning:
Manually-specified variables were not used by the project:
CMAKE_CXX_COMPILER
CMAKE_CXX_FLAGS
/home/me/.cargo/git/checkouts/ffts-rs-90217fe977f2ad3e/ef6850c/ffts/src/ffts.c: In function ‘ffts_init_1d_64f’:
/home/me/.cargo/git/checkouts/ffts-rs-90217fe977f2ad3e/ef6850c/ffts/src/ffts.c:784:25: warning: unused parameter ‘N’ [-Wunused-parameter]
784 | ffts_init_1d_64f(size_t N, int sign)
| ~~~~~~~^
/home/me/.cargo/git/checkouts/ffts-rs-90217fe977f2ad3e/ef6850c/ffts/src/ffts.c:784:32: warning: unused parameter ‘sign’ [-Wunused-parameter]
784 | ffts_init_1d_64f(size_t N, int sign)
| ~~~~^~~~
/home/me/.cargo/git/checkouts/ffts-rs-90217fe977f2ad3e/ef6850c/ffts/src/ffts_static.c:240:36: warning: ‘ffts_constants_inv_64f’ defined but not used [-Wunused-const-variable=]
240 | static const FFTS_ALIGN(16) double ffts_constants_inv_64f[16] = {
| ^~~~~~~~~~~~~~~~~~~~~~
/home/me/.cargo/git/checkouts/ffts-rs-90217fe977f2ad3e/ef6850c/ffts/src/ffts_static.c:196:36: warning: ‘ffts_constants_64f’ defined but not used [-Wunused-const-variable=]
196 | static const FFTS_ALIGN(16) double ffts_constants_64f[16] = {
| ^~~~~~~~~~~~~~~~~~
/home/me/.cargo/git/checkouts/ffts-rs-90217fe977f2ad3e/ef6850c/ffts/src/ffts_static.c:142:36: warning: ‘ffts_constants_small_inv_64f’ defined but not used [-Wunused-const-variable=]
142 | static const FFTS_ALIGN(16) double ffts_constants_small_inv_64f[24] = {
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/me/.cargo/git/checkouts/ffts-rs-90217fe977f2ad3e/ef6850c/ffts/src/ffts_static.c:78:36: warning: ‘ffts_constants_small_64f’ defined but not used [-Wunused-const-variable=]
78 | static const FFTS_ALIGN(16) double ffts_constants_small_64f[24] = {
| ^~~~~~~~~~~~~~~~~~~~~~~~
/home/me/.cargo/git/checkouts/ffts-rs-90217fe977f2ad3e/ef6850c/ffts/src/codegen.c: In function ‘ffts_generate_func_code’:
/home/me/.cargo/git/checkouts/ffts-rs-90217fe977f2ad3e/ef6850c/ffts/src/codegen.c:282:19: warning: comparison of integer expressions of different signedness: ‘size_t’ {aka ‘long unsigned int’} and ‘int32_t’ {aka ‘int’} [-Wsign-compare]
282 | if (ws_is != pLUT) {
| ^~
/home/me/.cargo/git/checkouts/ffts-rs-90217fe977f2ad3e/ef6850c/ffts/src/codegen.c:121:15: warning: unused variable ‘len’ [-Wunused-variable]
121 | ptrdiff_t len;
| ^~~
/usr/bin/ld: cannot find -lmpfr
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/ffts_trig_test.dir/build.make:105: ffts_trig_test] Error 1
make[1]: *** [CMakeFiles/Makefile2:155: CMakeFiles/ffts_trig_test.dir/all] Error 2
make: *** [Makefile:149: all] Error 2
thread 'main' panicked at '
command did not execute successfully, got: exit code: 2
build script failed, must exit now', /home/me/.cargo/registry/src/github.com-1ecc6299db9ec823/cmake-0.1.44/src/lib.rs:885: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
Any idea how I can make it work? :)
(Note that a normal cargo build --release works.)