bbqsrc / cargo-ndk

Compile Rust projects against the Android NDK without hassle
Apache License 2.0
712 stars 64 forks source link

3.2.0 version seems to be different from 3.1.2, failed to correctly find the compiler #112

Closed Kayuii closed 1 year ago

Kayuii commented 1 year ago
$ cargo ndk --version
cargo-ndk 3.2.0

$ cargo ndk help
[2023-07-11T05:24:50Z INFO  cargo_ndk::cli] Using NDK at path: /root/android/sdk/ndk/r25 (ANDROID_NDK_HOME)
[2023-07-11T05:24:50Z DEBUG cargo_ndk::cli] Exporting CARGO_NDK_CMAKE_TOOLCHAIN_PATH = "/root/android/sdk/ndk/r25/build/cmake/android.toolchain.cmake"
[2023-07-11T05:24:50Z INFO  cargo_ndk::cli] NDK API level: 21
[2023-07-11T05:24:50Z INFO  cargo_ndk::cli] Building targets: armeabi-v7a, arm64-v8a
[2023-07-11T05:24:50Z INFO  cargo_ndk::cli] Building armeabi-v7a (armv7-linux-androideabi)
[2023-07-11T05:24:50Z DEBUG cargo_ndk::cli] Exporting CARGO_NDK_ANDROID_TARGET = "armeabi-v7a"
[2023-07-11T05:24:50Z DEBUG cargo_ndk::cargo] Detected NDK version: Version { major: 25, minor: 2, patch: 9519653 }
[2023-07-11T05:24:50Z DEBUG cargo_ndk::cargo] CC_armv7-linux-androideabi="/root/android/sdk/ndk/r25/toolchains/llvm/prebuilt/linux-x86_64/bin/clang"
[2023-07-11T05:24:50Z DEBUG cargo_ndk::cargo] CFLAGS_armv7-linux-androideabi=--target=armv7a-linux-androideabi21
[2023-07-11T05:24:50Z DEBUG cargo_ndk::cargo] CXX_armv7-linux-androideabi="/root/android/sdk/ndk/r25/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++"
[2023-07-11T05:24:50Z DEBUG cargo_ndk::cargo] CXXFLAGS_armv7-linux-androideabi=--target=armv7a-linux-androideabi21
[2023-07-11T05:24:50Z DEBUG cargo_ndk::cargo] AR_armv7-linux-androideabi="/root/android/sdk/ndk/r25/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-ar"
[2023-07-11T05:24:50Z DEBUG cargo_ndk::cargo] RANLIB_armv7-linux-androideabi="/root/android/sdk/ndk/r25/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-ranlib"
[2023-07-11T05:24:50Z DEBUG cargo_ndk::cargo] cargo: /root/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/bin/cargo
[2023-07-11T05:24:50Z DEBUG cargo_ndk::cargo] CARGO_TARGET_ARMV7_LINUX_ANDROIDEABI_AR="/root/android/sdk/ndk/r25/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-ar"
[2023-07-11T05:24:50Z DEBUG cargo_ndk::cargo] CARGO_TARGET_ARMV7_LINUX_ANDROIDEABI_LINKER="/root/.cargo/bin/cargo-ndk"
[2023-07-11T05:24:50Z DEBUG cargo_ndk::cargo] BINDGEN_EXTRA_CLANG_ARGS_armv7_linux_androideabi=
[2023-07-11T05:24:50Z DEBUG cargo_ndk::cargo] Args: ["help"]
[2023-07-11T05:24:50Z DEBUG cargo_ndk::cargo] Working directory does not match manifest-path
$ cargo ndk --version
cargo-ndk 3.1.2

$ cargo ndk help
[2023-07-11T05:16:21Z INFO  cargo_ndk::cli] Using NDK at path: /root/android/sdk/ndk/r25 (ANDROID_NDK_HOME)
[2023-07-11T05:16:21Z DEBUG cargo_ndk::cli] Exporting CARGO_NDK_CMAKE_TOOLCHAIN_PATH = "/root/android/sdk/ndk/r25/build/cmake/android.toolchain.cmake"
[2023-07-11T05:16:21Z INFO  cargo_ndk::cli] NDK API level: 21
[2023-07-11T05:16:21Z INFO  cargo_ndk::cli] Building targets: armeabi-v7a, arm64-v8a
[2023-07-11T05:16:21Z INFO  cargo_ndk::cli] Building armeabi-v7a (armv7-linux-androideabi)
[2023-07-11T05:16:21Z DEBUG cargo_ndk::cli] Exporting CARGO_NDK_ANDROID_TARGET = "armeabi-v7a"
[2023-07-11T05:16:21Z DEBUG cargo_ndk::cargo] Detected NDK version: Version { major: 25, minor: 2, patch: 9519653 }
[2023-07-11T05:16:21Z DEBUG cargo_ndk::cargo] cargo: /root/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/bin/cargo
[2023-07-11T05:16:21Z DEBUG cargo_ndk::cargo] AR_armv7-linux-androideabi=/root/android/sdk/ndk/r25/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-ar
[2023-07-11T05:16:21Z DEBUG cargo_ndk::cargo] CC_armv7-linux-androideabi=/root/android/sdk/ndk/r25/toolchains/llvm/prebuilt/linux-x86_64/bin/armv7a-linux-androideabi21-clang
[2023-07-11T05:16:21Z DEBUG cargo_ndk::cargo] CXX_armv7-linux-androideabi=/root/android/sdk/ndk/r25/toolchains/llvm/prebuilt/linux-x86_64/bin/armv7a-linux-androideabi21-clang++
[2023-07-11T05:16:21Z DEBUG cargo_ndk::cargo] RANLIB_armv7-linux-androideabi=/root/android/sdk/ndk/r25/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-ranlib
[2023-07-11T05:16:21Z DEBUG cargo_ndk::cargo] CARGO_TARGET_ARMV7_LINUX_ANDROIDEABI_AR=/root/android/sdk/ndk/r25/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-ar
[2023-07-11T05:16:21Z DEBUG cargo_ndk::cargo] CARGO_TARGET_ARMV7_LINUX_ANDROIDEABI_LINKER=/root/android/sdk/ndk/r25/toolchains/llvm/prebuilt/linux-x86_64/bin/armv7a-linux-androideabi21-clang
[2023-07-11T05:16:21Z DEBUG cargo_ndk::cargo] BINDGEN_EXTRA_CLANG_ARGS_armv7_linux_androideabi=
[2023-07-11T05:16:21Z DEBUG cargo_ndk::cargo] Args: ["help"]
[2023-07-11T05:16:21Z DEBUG cargo_ndk::cargo] Working directory does not match manifest-path

The above is the debug information output of different versions, in which the compilers found by CC_armv7-linux-androideabi are different.

bbqsrc commented 1 year ago

I understand your assertion in the title is that it does not correctly find the compiler. Yes, there has been a change in how the linker is called between those two versions to work around a bug with the NDK.

If you have a build issue, please provide the issue that you're facing there, as a change in a value in the environment variables is not inherently a bug.