Skip to content

Target aarch64-linux-android link failure: unwind. #1222

@flxo

Description

@flxo

Checklist

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-androidArea: android targets

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions