cross: Target `aarch64-linux-android` link failure: unwind.
Checklist
- I’ve looked through the issues and pull requests for similar reports
Describe your issue
Building an empty bin crate for target aarch64-linux-android fails to link. The linker fails to find libunwind.
What target(s) are you cross-compiling for?
aarch64-linux-android
Which operating system is the host (e.g computer cross is on) running?
- macOS
- Windows
- Linux / BSD
- other OS (specify in description)
What architecture is the host?
- x86_64 / AMD64
- arm32
- arm64 (including Mac M1)
What container engine is cross using?
- docker
- podman
- other container engine (specify in description)
cross version
cross 0.2.5
Example
# cargo new hello; cd hello
Created binary (application) `hello` package
# cross build --target=aarch64-linux-android
Unable to find image 'ghcr.io/cross-rs/aarch64-linux-android:0.2.5' locally
0.2.5: Pulling from cross-rs/aarch64-linux-android
b549f31133a9: Already exists
5fe2d3aad0c6: Already exists
2981499a9ddc: Already exists
b94a177f70bc: Already exists
6e9b50ffe814: Already exists
90520c3cd9d7: Already exists
5443eeb7b936: Already exists
4c964b2caea5: Already exists
4247faed0467: Already exists
8e533985c077: Already exists
f5b36b351714: Already exists
2c63c099f49f: Already exists
94fe568d3a35: Already exists
98ef90f21973: Already exists
3717c64c061f: Already exists
Digest: sha256:95b392e696c26ce8c575590f95422390b2ecad6ca3d505793c377eb9e904c73f
Status: Downloaded newer image for ghcr.io/cross-rs/aarch64-linux-android:0.2.5
Compiling hello v0.1.0 (/project)
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/rustcPIkdMf/symbols.o" "/target/aarch64-linux-android/debug/deps/hello-5024e77b3f20e222.121jazbxfhvppcdm.rcgu.o" "/target/aarch64-linux-android/debug/deps/hello-5024e77b3f20e222.150b0irb0y71mrkj.rcgu.o" "/target/aarch64-linux-android/debug/deps/hello-5024e77b3f20e222.300zreki1apf9g2z.rcgu.o" "/target/aarch64-linux-android/debug/deps/hello-5024e77b3f20e222.3ht21q5v15cqvpe7.rcgu.o" "/target/aarch64-linux-android/debug/deps/hello-5024e77b3f20e222.an8iwp66o2a55g3.rcgu.o" "/target/aarch64-linux-android/debug/deps/hello-5024e77b3f20e222.burnc5f2tpjyrjt.rcgu.o" "/target/aarch64-linux-android/debug/deps/hello-5024e77b3f20e222.d9p7w3vrg1p8tai.rcgu.o" "-Wl,--as-needed" "-L" "/target/aarch64-linux-android/debug/deps" "-L" "/target/debug/deps" "-L" "/rust/lib/rustlib/aarch64-linux-android/lib" "-Wl,-Bstatic" "/rust/lib/rustlib/aarch64-linux-android/lib/libstd-23f6c47aae02f4fb.rlib" "/rust/lib/rustlib/aarch64-linux-android/lib/libpanic_unwind-dd4c6aba4a78bc98.rlib" "/rust/lib/rustlib/aarch64-linux-android/lib/libobject-bcc6c119a206d477.rlib" "/rust/lib/rustlib/aarch64-linux-android/lib/libmemchr-5281145ba046724b.rlib" "/rust/lib/rustlib/aarch64-linux-android/lib/libaddr2line-e157fff41be82fdf.rlib" "/rust/lib/rustlib/aarch64-linux-android/lib/libgimli-8e5eea0d2ed94e81.rlib" "/rust/lib/rustlib/aarch64-linux-android/lib/librustc_demangle-8f4ad2a15b1e07d9.rlib" "/rust/lib/rustlib/aarch64-linux-android/lib/libstd_detect-a37a2c25716c50f3.rlib" "/rust/lib/rustlib/aarch64-linux-android/lib/libhashbrown-1b2557db6f01d992.rlib" "/rust/lib/rustlib/aarch64-linux-android/lib/libminiz_oxide-e6706b812290bb2e.rlib" "/rust/lib/rustlib/aarch64-linux-android/lib/libadler-10555647242e659c.rlib" "/rust/lib/rustlib/aarch64-linux-android/lib/librustc_std_workspace_alloc-305c9d9b8a10b58c.rlib" "/rust/lib/rustlib/aarch64-linux-android/lib/libunwind-558d53f3b8a8a676.rlib" "/rust/lib/rustlib/aarch64-linux-android/lib/libcfg_if-d824b4454197377a.rlib" "/rust/lib/rustlib/aarch64-linux-android/lib/liblibc-7825b80898f450ef.rlib" "/rust/lib/rustlib/aarch64-linux-android/lib/liballoc-99d3deb75d569257.rlib" "/rust/lib/rustlib/aarch64-linux-android/lib/librustc_std_workspace_core-204652b261065580.rlib" "/rust/lib/rustlib/aarch64-linux-android/lib/libcore-338253ac402410c2.rlib" "/rust/lib/rustlib/aarch64-linux-android/lib/libcompiler_builtins-1081644b311849f7.rlib" "-Wl,-Bdynamic" "-ldl" "-llog" "-lunwind" "-ldl" "-lm" "-lc" "-Wl,--eh-frame-hdr" "-Wl,-znoexecstack" "-L" "/rust/lib/rustlib/aarch64-linux-android/lib" "-o" "/target/aarch64-linux-android/debug/deps/hello-5024e77b3f20e222" "-Wl,--gc-sections" "-pie" "-Wl,-zrelro,-znow" "-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)
error: could not compile `hello` due to previous error
#
Additional information / notes
Same build is fine for e.g aarch64-unknown-linux-gnu.
About this issue
- Original URL
- State: open
- Created 4 years ago
- Reactions: 14
- Comments: 17 (9 by maintainers)
Commits related to this issue
- Disable cross build/tests on Android Cross is currently broken on Android, see https://github.com/cross-rs/cross/issues/1222 The bug is fixed on master, but a new release of cross hasn't come out ye... — committed to rust-random/getrandom by josephlr 4 years ago
- Disable Android tests See cross-rs/cross#1222 — committed to myzhang1029/penguin-rs by myzhang1029 3 years ago
- Add target aarch64-linux-android to ci Use `cross` for building target `aarch64-linux-android`. In the `ci` workflow the matrix branch of `os` `ubuntu-latest` is used because the matrix organization ... — committed to flxo/bandwhich by deleted user 3 years ago
- Add target aarch64-linux-android to ci Use `cross` for building target `aarch64-linux-android`. In the `ci` workflow the matrix branch of `os` `ubuntu-latest` is used because the matrix organization ... — committed to flxo/bandwhich by deleted user 3 years ago
- Enable Android build (#384) * Support build for target_os android The target_os `android` is quite similar to `linux` but must be mentioned in the guards explicitly. Tested for target `aarch64-l... — committed to imsnif/bandwhich by flxo 3 years ago
- chore: change rust to 1.67 see <https://github.com/cross-rs/cross/issues/1222> — committed to th1nk3r-ing/autojump-rs by th1nk3r-ing a year ago
- chore: change rust to 1.67 see <https://github.com/cross-rs/cross/issues/1222> — committed to th1nk3r-ing/autojump-rs by th1nk3r-ing a year ago
- chore: change rust to 1.67 see <https://github.com/cross-rs/cross/issues/1222> — committed to th1nk3r-ing/autojump-rs by th1nk3r-ing a year ago
- chore: change rust to 1.67 see <https://github.com/cross-rs/cross/issues/1222> — committed to th1nk3r-ing/autojump-rs by th1nk3r-ing a year ago
- chore: change rust to 1.67 see <https://github.com/cross-rs/cross/issues/1222> — committed to th1nk3r-ing/autojump-rs by th1nk3r-ing a year ago
- chore: change rust to 1.67 see <https://github.com/cross-rs/cross/issues/1222> — committed to th1nk3r-ing/autojump-rs by th1nk3r-ing a year ago
- ci: update github actions version && fix android-build - skip `x86_64-sun-solaris` - change rust to 1.67 to fix android-build see <https://github.com/cross-rs/cross/issues/1222> — committed to th1nk3r-ing/autojump-rs by th1nk3r-ing a year ago
Would it be possible to get a 0.2.6 release that includes the fix? We don’t compile cross in our CI, so we’re stuck on the latest pre-compiled release.
Is a new version coming soon?
cargo install cross --git https://github.com/cross-rs/crossworks, so I’m looking forward to the new version.I’m looking forward to the next release.
edit: Until the release, I added
- run: rustup default 1.67.0to my GitHub job step.error
Works on ubuntu2404
The security issue presented in 1.68.2 can be prevented for other versions of rust by having the correct key trusted. The bundled key is only used when a key for
github.comis not available. I don’t think this is a problem that warrants a backport for cross 0.2. cargo 1.68.2 can be used for all other targets (e.g those that are notandroid) and forandroidyou can install cross from maincargo install cross --git https://github.com/cross-rs/crossor tell cross to use the updated images forandroid. We’re also slowly progressing towards 0.3.0It would not be super easy to include it in 0.2.6, it would have to be made out-of-tree.
I’m considering releasing 0.3.0 soon, there’s not a lot left and some of the stuff can be added in patch releases. I’ll work on it this weekend
Support for Rust 1.68.2 is important for security reasons.
@nwtgck The issue is due to https://blog.rust-lang.org/2023/01/09/android-ndk-update-r25.html being included in 1.68, the fix is for us to bump the NDK, which was done in #1023 as previously mentioned