-
Problem:I am building an Android app using rust as the core. It needs to compile the aarch64-linux-android core for kotlin to call. I configured various environment variables and used the https://github.com/ianthetechie/uniffi-starter sample code to build. It was easy to compile the sample code for multiple cores including x86, x86_64, armv7, arm64v8a, and successfully call it through kotlin. This at least proves that there is no problem with my win11 environment. (I put the win environment system variables and logs below.) When I compiled, I encountered the problem of not being able to compile. At first I thought it was my environment problem. I reinstalled vstool and clang. The same error. I added ninja to handle the compilation, but the problem remained. Finally, I installed rocky linux 9.5 through the virtual machine. And configured the sdk ndk. The problem still exists, clang: error: unsupported argument 'armv7-a' to option '-march='. The specific reason is unknown. I can't determine this armv7 Where did the parameter appear? I tried to clean the environment variables in linux/win and reset them (I put them below), but they didn't work. But if there is a problem with my win environment, uniffi-starter should have the same problem. When I compiled, I understand that it is not an internal problem of iroh, but a dependency problem of rustls. However, iroh has clearly stated that it supports mobile terminals including iOS and Android. According to my understanding, it should be easy to compile. But I still can't solve it. Since these are my core dependencies, I can't replace them. I spent about 2 days without any progress. I am not sure if I used it wrong or if there is a problem with the project itself. Please give me some help. Thank you very much. System information for linux below info can be collected
WIN11 Environment variablesNDK version ALLUSERSPROFILE C:\ProgramData Build log:WIN LOGCompiling genawaiter v0.99.1 Caused by: --- stderr
CMake Error at D:/Program Files/CMake/share/cmake-3.31/Modules/CMakeTestCCompiler.cmake:67 (message):
Call Stack (most recent call first): thread 'main' panicked at C:\Users\SSSS.cargo\registry\src\index.crates.io-1949cf8c6b5b557f\cmake-0.1.54\src\lib.rs:1119:5: Linux Rocky 9.5 LOG[root@localhost rust]# cargo ndk -t armeabi-v7a -t arm64-v8a -o ./jniLibs build Caused by: --- stderr
CMake Error at /usr/share/cmake/Modules/CMakeTestCCompiler.cmake:67 (message):
Call Stack (most recent call first): thread main panicked at /root/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/cmake-0.1.54/src/lib.rs:1119:5 command did not execute successfully, got: exit status: 1 build script failed, must exit now linux SHunset ANDROID_NDK_HOME export ANDROID_NDK_HOME=$HOME/Android/Sdk/ndk/r27c export PATH=$ANDROID_NDK_HOME/toolchains/llvm/prebuilt/linux-x86_64/bin:$PATH export ANDROID_PLATFORM="android-21" export CC=$ANDROID_NDK_HOME/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android21-clang export CFLAGS="-D__ANDROID_API__=21 -target aarch64-linux-android21 --sysroot=$ANDROID_NDK_HOME/toolchains/llvm/prebuilt/linux-x86_64/sysroot" export ANDROID_ABI="arm64-v8a" export CMAKE_GENERATOR="Unix Makefiles" //export AWS_LC_SYS_NO_ASM="1" export CC_aarch64_linux_android=$CC dependencies TreePS E:\WWW\Rust\MYPROJECT\client\rust> cargo tree -i aws-lc-rs
Build Command |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Hm, I'm far from an expert on compiling stuff to android. I know that DeltaChat folks keep doing this just fine. One thing I can tell you is that you shouldn't need I see you've looked at |
Beta Was this translation helpful? Give feedback.
Hm, I'm far from an expert on compiling stuff to android. I know that DeltaChat folks keep doing this just fine.
One thing I can tell you is that you shouldn't need
aws-lc-rs
in your dependency tree. So if you have problems getting aws-lc-rs to compile to android, you can get rid of it.I see you've looked at
cargo tree -i aws-lc-rs
. To dig deeper, you can callcargo tree -i aws-lc-rs -e normal -e features
, to get an overview of which features of which dependencies end up pulling inaws-lc-rs
. Good luck!