Closed hipersayanX closed 7 months ago
Is your android toolchain working for other rust projects?
You do not need to run cargo build
before cargo cbuild
.
It seems that it is trying to link together objects from different architectures and that in itself is quite strange.
Is your android toolchain working for other rust projects?
I don't know, this is the first Rust project I try to compile, never worked with Rust before.
You do not need to run cargo build before cargo cbuild.
Tried running only cargo cbuild, same result. The results for other architectures:
aarch64-linux-android: error adding symbols: file in wrong format
armv7-linux-androideabi: error adding symbols: file in wrong format
i686-linux-android: /usr/bin/ld: cannot find -llog: No such file or directory
x86_64-linux-android: /usr/bin/ld: cannot find -llog: No such file or directory
It seems that it is trying to link together objects from different architectures and that in itself is quite strange.
NOTE: I didn't noted until now that it's using the system linker instead of the NDK linker. I have set LD in the global environment variables to the NDK linker, but cargo is not taking it, is there way of fix it?
add
[target.aarch64-linux-android]
linker = "aarch64-linux-android30-clang"
in ~/.cargo/config.toml
@lu-zero
Thanks, it worked! but in my specific case I have set CARGO_HOME instead of using a ~/.cargo, this way I can set the linker dynamically.
export CARGO_HOME="${PWD}/cargo"
mkdir -p "${CARGO_HOME}"
cat << EOF > "${CARGO_HOME}/config.toml"
[target.${CARGO_BUILD_TARGET}]
linker = "${ANDROID_CC}"
EOF
I was able to build for all architectures successfully. A last question, is there a way of generating un-versioned shared libraries? because Android does not support links.
The links probably are an after-effect of the big refactor I did in cargo-c, the library itself should be unversioned.
No, problem, just changed the file names and deleted the links. Also, rav1e packages for Android are now available at AUR :smile:
If you have spare time and send a patch to cargo-c (since you can test it directly) would be great :) Otherwise remind me and hopefully I'll have time in the weekend.
I can test it, but my knowledge of Rust is zero.
Describe the bug
Error when cross-compiling for Android.
To Reproduce
Command used for building:
Expected behavior
Compile rav1e for Android.
Required Information
Version:
Operating system:
Console Output
There are other error messages for the other architectures, but let start trying to fix this.