Fail to compile for Android target armeabi-v7a

#12 · closed · 1 comments

View on GitHub ↗

vincent-herlemont

I have the following error when I try to compile for armeabi-v7a: ```bash [2022-09-23T19:42:47Z INFO cargo_ndk::cli] Building armeabi-v7a (armv7-linux-androideabi) Compiling cfasttext-sys v0.7.0 error: failed to run custom build command for `cfasttext-sys v0.7.0` Caused by: process didn't exit successfully: `/rust/target/debug/build/cfasttext-sys-34b28a9c9dd21f71/build-script-build` (exit status: 101) --- stdout CMAKE_TOOLCHAIN_FILE_armv7-linux-androideabi = None CMAKE_TOOLCHAIN_FILE_armv7_linux_androideabi = None TARGET_CMAKE_TOOLCHAIN_FILE = None CMAKE_TOOLCHAIN_FILE = None CMAKE_GENERATOR_armv7-linux-androideabi = None CMAKE_GENERATOR_armv7_linux_androideabi = None TARGET_CMAKE_GENERATOR = None CMAKE_GENERATOR = None CMAKE_PREFIX_PATH_armv7-linux-androideabi = None CMAKE_PREFIX_PATH_armv7_linux_androideabi = None TARGET_CMAKE_PREFIX_PATH = None CMAKE_PREFIX_PATH = None CMAKE_armv7-linux-androideabi = None CMAKE_armv7_linux_androideabi = None TARGET_CMAKE = None CMAKE = None running: "cmake" "/.cargo/registry/src/github.com-1ecc6299db9ec823/cfasttext-sys-0.7.0/cfasttext" "-DCMAKE_INSTALL_PREFIX=/IdeaProjects/rust/target/armv7-linux-androideabi/debug/build/cfasttext-sys-97389a1d85d6c5c7/out" "-DCMAKE_C_FLAGS= -DANDROID -ffunction-sections -fdata-sections -fPIC" "-DCMAKE_C_COMPILER=/Android/Sdk/ndk/22.1.7171670/toolchains/llvm/prebuilt/linux-x86_64/bin/armv7a-linux-androideabi21-clang" "-DCMAKE_CXX_FLAGS= -DANDROID -ffunction-sections -fdata-sections -fPIC" "-DCMAKE_CXX_COMPILER=/Android/Sdk/ndk/22.1.7171670/toolchains/llvm/prebuilt/linux-x86_64/bin/armv7a-linux-androideabi21-clang++" "-DCMAKE_ASM_FLAGS= -DANDROID -ffunction-sections -fdata-sections -fPIC" "-DCMAKE_ASM_COMPILER=/Android/Sdk/ndk/22.1.7171670/toolchains/llvm/prebuilt/linux-x86_64/bin/armv7a-linux-androideabi21-clang" "-DCMAKE_BUILD_TYPE=Debug" -- The C compiler identification is Clang 11.0.5 -- The CXX compiler identification is Clang 11.0.5 -- Check for working C compiler: /Android/Sdk/ndk/22.1.7171670/toolchains/llvm/prebuilt/linux-x86_64/bin/armv7a-linux-androideabi21-clang -- Check for working C compiler: /Android/Sdk/ndk/22.1.7171670/toolchains/llvm/prebuilt/linux-x86_64/bin/armv7a-linux-androideabi21-clang -- works -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Detecting C compile features -- Detecting C compile features - done -- Check for working CXX compiler: /Android/Sdk/ndk/22.1.7171670/toolchains/llvm/prebuilt/linux-x86_64/bin/armv7a-linux-androideabi21-clang++ -- Check for working CXX compiler: /Android/Sdk/ndk/22.1.7171670/toolchains/llvm/prebuilt/linux-x86_64/bin/armv7a-linux-androideabi21-clang++ -- works -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Detecting CXX compile features -- Detecting CXX compile features - done -- Configuring done -- Generating done -- Build files have been written to: /IdeaProjects/rust/target/armv7-linux-androideabi/debug/build/cfasttext-sys-97389a1d85d6c5c7/out/build running: "cmake" "--build" "." "--target" "cfasttext_static" "--config" "Debug" "--parallel" "8" Scanning dependencies of target objlib Scanning dependencies of target fasttext-static [ 35%] Building CXX object fasttext/CMakeFiles/fasttext-static.dir/src/args.cc.o [ 35%] Building CXX object fasttext/CMakeFiles/fasttext-static.dir/src/main.cc.o [ 5%] Building CXX object fasttext/CMakeFiles/fasttext-static.dir/src/autotune.cc.o [ 35%] Building CXX object fasttext/CMakeFiles/fasttext-static.dir/src/dictionary.cc.o [ 35%] Building CXX object fasttext/CMakeFiles/fasttext-static.dir/src/densematrix.cc.o [ 41%] Building CXX object fasttext/CMakeFiles/fasttext-static.dir/src/fasttext.cc.o [ 41%] Building CXX object fasttext/CMakeFiles/fasttext-static.dir/src/loss.cc.o [ 47%] Building CXX object CMakeFiles/objlib.dir/lib/cfasttext.cc.o [ 47%] Built target objlib --- stderr CMake Warning: Manually-specified variables were not used by the project: CMAKE_ASM_COMPILER CMAKE_ASM_FLAGS make: warning: -j8 forced in submake: resetting jobserver mode. clang++clang++clang++clang++clang++clang++: clang++error: : : : : : errorerrorerrorerror: : the clang compiler does not support '-march=native'the clang compiler does not support '-march=native': : the clang compiler does not support '-march=native' the clang compiler does not support '-march=native' the clang compiler does not support '-march=native' error: the clang compiler does not support '-march=native' : error: the clang compiler does not support '-march=native' make[3]: *** [fasttext/CMakeFiles/fasttext-static.dir/build.make:141: fasttext/CMakeFiles/fasttext-static.dir/src/main.cc.o] Error 1 make[3]: *** Waiting for unfinished jobs.... make[3]: *** [fasttext/CMakeFiles/fasttext-static.dir/build.make:63: fasttext/CMakeFiles/fasttext-static.dir/src/args.cc.o] Error 1 make[3]: *** [fasttext/CMakeFiles/fasttext-static.dir/build.make:76: fasttext/CMakeFiles/fasttext-static.dir/src/autotune.cc.o] Error 1 make[3]: *** [fasttext/CMakeFiles/fasttext-static.dir/build.make:115: fasttext/CMakeFiles/fasttext-static.dir/src/fasttext.cc.o] Error 1 make[3]: *** [fasttext/CMakeFiles/fasttext-static.dir/build.make:128: fasttext/CMakeFiles/fasttext-static.dir/src/loss.cc.o] Error 1 make[3]: *** [fasttext/CMakeFiles/fasttext-static.dir/build.make:89: fasttext/CMakeFiles/fasttext-static.dir/src/densematrix.cc.o] Error 1 make[3]: *** [fasttext/CMakeFiles/fasttext-static.dir/build.make:102: fasttext/CMakeFiles/fasttext-static.dir/src/dictionary.cc.o] Error 1 make[2]: *** [CMakeFiles/Makefile2:242: fasttext/CMakeFiles/fasttext-static.dir/all] Error 2 make[2]: *** Waiting for unfinished jobs.... make[1]: *** [CMakeFiles/Makefile2:113: CMakeFiles/cfasttext_static.dir/rule] Error 2 make: *** [Makefile:164: cfasttext_static] Error 2 thread 'main' panicked at ' command did not execute successfully, got: exit status: 2 build script failed, must exit now', /.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 [2022-09-23T19:42:50Z INFO cargo_ndk::cli] If the build failed due to a missing target, you can run this command: [2022-09-23T19:42:50Z INFO cargo_ndk::cli] [2022-09-23T19:42:50Z INFO cargo_ndk::cli] rustup target install armv7-linux-androideabi ```

Comments

messense

`cmake-rs` does not have good cross compiling support, see https://github.com/rust-lang/cmake-rs/issues/80. You'll need to use a [cmake toolchain file](https://cmake.org/cmake/help/latest/manual/cmake-toolchains.7.html) at the moment.