Open
Description
Checklist
- I've looked through the issues and pull requests for similar reports
Describe your issue
Building https://github.com/MarcelCoding/zia for target aarch64-linux-android
fails to link. The linker fails because of "duplicate symbol pthread_atfork
".
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 99b8069 2023-02-12
Example
# git clone https://github.com/MarcelCoding/zia; cd zia;
# cross +nightly build --target aarch64-linux-android
> Update with `rustup update`
Unable to find image 'ghcr.io/cross-rs/aarch64-linux-android:main' locally
main: Pulling from cross-rs/aarch64-linux-android
06d39c85623a: Pull complete
d9c78f021986: Pull complete
0fa3c2ce84ad: Pull complete
3eea81fec61a: Pull complete
7bf1365fd495: Pull complete
dca916d29372: Pull complete
3c5b70f3a37d: Pull complete
c66e998c8ff4: Pull complete
fc42a38b3c93: Pull complete
d2a1a78ebf7d: Pull complete
4f4fb700ef54: Pull complete
b73c2c51a779: Pull complete
39135fd47d8c: Pull complete
2d1b4a229f04: Pull complete
bf04508a63bc: Pull complete
d0c929fc0ccd: Pull complete
5d8dd7fd34a4: Pull complete
1fc8abb5cd0f: Pull complete
f2138848a78b: Pull complete
7071b05dabc5: Pull complete
fd6382120484: Pull complete
Digest: sha256:61b7313a96033176e683e3577c10bbaaf01cf8bcecbcf58a9fa1fadb33236a40
Status: Downloaded newer image for ghcr.io/cross-rs/aarch64-linux-android:main
Compiling serde_derive v1.0.147
Compiling tokio v1.21.2
Compiling futures-util v0.3.25
Compiling rustls v0.20.7
Compiling tikv-jemalloc-sys v0.5.2+5.3.0-patched
Compiling serde v1.0.147
Compiling pin-project-internal v1.0.12
Compiling url v2.3.1
Compiling tracing-attributes v0.1.23
Compiling tungstenite v0.17.3
Compiling minimal-lexical v0.2.1
Compiling overload v0.1.1
Compiling nu-ansi-term v0.46.0
Compiling nom v7.1.1
Compiling tracing v0.1.37
Compiling tokio-tungstenite v0.17.2
Compiling pin-project v1.0.12
Compiling tokio-rustls v0.23.4
Compiling async-http-proxy v1.2.5
Compiling async-trait v0.1.58
Compiling anyhow v1.0.66
Compiling sharded-slab v0.1.4
Compiling tracing-log v0.1.3
Compiling webpki-roots v0.22.5
Compiling thread_local v1.1.4
Compiling smallvec v1.10.0
Compiling pathdiff v0.2.1
Compiling config v0.13.2
Compiling tracing-subscriber v0.3.16
Compiling zia-common v0.0.0-git (/root/zia/zia-common)
Compiling tikv-jemallocator v0.5.0
Compiling zia-client v0.0.0-git (/root/zia/zia-client)
Compiling zia-server v0.0.0-git (/root/zia/zia-server)
error: linking with `aarch64-linux-android-gcc` failed: exit status: 1
|
= note: LC_ALL="C" PATH="/root/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/android-ndk/bin:/root/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin" VSLANG="1033" "aarch64-linux-android-gcc" "/tmp/rustcr3D9Hx/symbols.o" "/target/aarch64-linux-android/release/deps/zia_server-f52298ac6ead9b2b.zia_server.97089f19-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/tikv-jemalloc-sys-f0ee31bc29cef112/out/build/lib" "-L" "/target/aarch64-linux-android/release/build/ring-687200c902e83cf5/out" "-L" "/root/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/aarch64-linux-android/lib" "-Wl,-Bstatic" "/tmp/rustcr3D9Hx/libring-b491d8f9a053feb4.rlib" "/tmp/rustcr3D9Hx/libtikv_jemalloc_sys-d8a6a51c69091c9d.rlib" "/root/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/aarch64-linux-android/lib/libcompiler_builtins-85fd0e385adc9fc1.rlib" "-Wl,-Bdynamic" "-lgcc" "-ldl" "-llog" "-lunwind" "-ldl" "-lm" "-lc" "-Wl,--eh-frame-hdr" "-Wl,-z,noexecstack" "-L" "/root/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/aarch64-linux-android/lib" "-o" "/target/aarch64-linux-android/release/deps/zia_server-f52298ac6ead9b2b" "-Wl,--gc-sections" "-pie" "-Wl,-z,relro,-z,now" "-Wl,-O1" "-Wl,--strip-all" "-nodefaultlibs"
= note: ld: error: duplicate symbol: pthread_atfork
>>> defined at crtbegin.c
>>> /android-ndk/bin/../sysroot/usr/lib/aarch64-linux-android/28/crtbegin_dynamic.o:(pthread_atfork)
>>> defined at zia_server.97089f19-cgu.0
>>> /target/aarch64-linux-android/release/deps/zia_server-f52298ac6ead9b2b.zia_server.97089f19-cgu.0.rcgu.o:(.text.pthread_atfork+0x0)
clang140: error: linker command failed with exit code 1 (use -v to see invocation)
error: could not compile `zia-server` (bin "zia-server") due to previous error
warning: build failed, waiting for other jobs to finish...
error: linking with `aarch64-linux-android-gcc` failed: exit status: 1
|
= note: LC_ALL="C" PATH="/root/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/android-ndk/bin:/root/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin" VSLANG="1033" "aarch64-linux-android-gcc" "/tmp/rustcashmom/symbols.o" "/target/aarch64-linux-android/release/deps/zia_client-8271c8824ac6a2eb.zia_client.4e48e67e-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/tikv-jemalloc-sys-f0ee31bc29cef112/out/build/lib" "-L" "/target/aarch64-linux-android/release/build/ring-687200c902e83cf5/out" "-L" "/root/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/aarch64-linux-android/lib" "-Wl,-Bstatic" "/tmp/rustcashmom/libring-b491d8f9a053feb4.rlib" "/tmp/rustcashmom/libtikv_jemalloc_sys-d8a6a51c69091c9d.rlib" "/root/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/aarch64-linux-android/lib/libcompiler_builtins-85fd0e385adc9fc1.rlib" "-Wl,-Bdynamic" "-lgcc" "-ldl" "-llog" "-lunwind" "-ldl" "-lm" "-lc" "-Wl,--eh-frame-hdr" "-Wl,-z,noexecstack" "-L" "/root/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/aarch64-linux-android/lib" "-o" "/target/aarch64-linux-android/release/deps/zia_client-8271c8824ac6a2eb" "-Wl,--gc-sections" "-pie" "-Wl,-z,relro,-z,now" "-Wl,-O1" "-Wl,--strip-all" "-nodefaultlibs"
= note: ld: error: duplicate symbol: pthread_atfork
>>> defined at crtbegin.c
>>> /android-ndk/bin/../sysroot/usr/lib/aarch64-linux-android/28/crtbegin_dynamic.o:(pthread_atfork)
>>> defined at zia_client.4e48e67e-cgu.0
>>> /target/aarch64-linux-android/release/deps/zia_client-8271c8824ac6a2eb.zia_client.4e48e67e-cgu.0.rcgu.o:(.text.pthread_atfork+0x0)
clang140: error: linker command failed with exit code 1 (use -v to see invocation)
error: could not compile `zia-client` (bin "zia-client") due to previous error
Additional information / notes
Same build is fine for e.g aarch64-unknown-linux-gnu
. And it builds fine for aarch64-linux-android
if you do the debug build, and not the release build.
Do you know any solution for this?
It is very strange, that only the release version is affected....
It does not matter, if I do it in GH actions, or locally, using the same commands. Same error.