houseabsolute / actions-rust-cross

GitHub Action to compile Rust with cross
Apache License 2.0
113 stars 12 forks source link

`libunwind` error while building for `aarch64-linux-android` using `ubuntu-latest` #11

Closed nikosszzz closed 10 months ago

nikosszzz commented 10 months ago

Hello!

I was searching for a good cross github action and I came across this fantastic action and when I try to build for Android, this error comes:

error: linking with 'aarch64-linux-android-gcc' failed: exit status: 1 | = note: LC_ALL="C" PATH="/rust/lib/rustlib/x86_64-unknown-linux-gnu/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/android-ndk/bin:/rust/bin" VSLANG="1033" "aarch64-linux-android-gcc" "/tmp/rustcYQ7k2L/symbols.o" "/target/aarch64-linux-android/release/deps/antinuke_test-f6c56bbb2cca27c4.antinuke_test.17a426cc96f3524d-cgu.0.rcgu.o" "-Wl,--as-needed" "-L" "/target/aarch64-linux-android/release/deps" "-L" "/target/release/deps" "-L" "/target/aarch64-linux-android/release/build/ring-6d28ca657858bd9f/out" "-L" "/rust/lib/rustlib/aarch64-linux-android/lib" "-Wl,-Bstatic" "/tmp/rustcYQ7k2L/libring-cfb44b8cfe867d79.rlib" "/rust/lib/rustlib/aarch64-linux-android/lib/libcompiler_builtins-cc66c9e5764dfbe4.rlib" "-Wl,-Bdynamic" "-ldl" "-llog" "-lunwind" "-ldl" "-lm" "-lc" "-Wl,--eh-frame-hdr" "-Wl,-z,noexecstack" "-L" "/rust/lib/rustlib/aarch64-linux-android/lib" "-o" "/target/aarch64-linux-android/release/deps/antinuke_test-f6c56bbb2cca27c4" "-Wl,--gc-sections" "-pie" "-Wl,-z,relro,-z,now" "-Wl,-O1" "-Wl,--strip-all" "-nodefaultlibs" = note: /android-ndk/bin/../lib/gcc/aarch64-linux-android/4.9.x/../../../../aarch64-linux-android/bin/ld: cannot find -lunwind clang90: error: linker command failed with exit code 1 (use -v to see invocation)

autarch commented 10 months ago

I'm not sure exactly what's going on here but I don't think it has anything to do with this action. When you build with cross, it builds inside a Docker image that runs QEMU to emulate the target arch. In this case, it looks like that Docker image is missing a library you need, libunwind. Maybe take a look at the cross docs here - https://github.com/cross-rs/cross/wiki/FAQ#linking-external-libraries

nikosszzz commented 10 months ago

Yup, Wasn't related to this action at all. Did some digging and found out this was fixed on cross, but not on 0.2.5, just the main branch: https://github.com/cross-rs/cross/issues/1222#issuecomment-1474110816

So, to build for ARM64 Android I'll have to wait till cross releases a version with this fix included or drop Rust to v1.67?

autarch commented 10 months ago

So, to build for ARM64 Android I'll have to wait till cross releases a version with this fix included or drop Rust to v1.67?

Yeah, I think that's correct.