Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cross build with -Zbuild-std for x86_64-unknown-freebsd got failed linking error. #1563

Open
Wyvern opened this issue Sep 29, 2024 · 5 comments
Labels
needs-information needs more information to replicate

Comments

@Wyvern
Copy link

Wyvern commented Sep 29, 2024

Detail message like below:

error: linking with `x86_64-unknown-freebsd13-gcc.sh` failed: exit status: 1
...
          /usr/local/lib/gcc/x86_64-unknown-freebsd13/6.4.0/../../../../x86_64-unknown-freebsd13/bin/ld: final link failed: bad value
          collect2: error: ld returned 1 exit status

What's wrong and how to fix it?

@Emilgardis
Copy link
Member

It's not possible to help you with the information you've given. Need more information.

@Emilgardis Emilgardis added the needs-information needs more information to replicate label Sep 29, 2024
@Wyvern
Copy link
Author

Wyvern commented Sep 29, 2024

rustc 1.83.0-nightly (ed04567ba 2024-09-28)
linking failed only on -Zbuild-std, build without it succeeded.

@Wyvern
Copy link
Author

Wyvern commented Sep 29, 2024

This is the full error output:

error: linking with `x86_64-unknown-freebsd13-gcc.sh` failed: exit status: 1
  |
  = note: LC_ALL="C" PATH="/home/runner/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/bin:/home/runner/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/bin:/home/runner/.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:/home/runner/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin" VSLANG="1033" "x86_64-unknown-freebsd13-gcc.sh" "-Wl,--version-script=/tmp/rustcxcoybW/list" "-Wl,--no-undefined-version" "-m64" "/tmp/rustcxcoybW/symbols.o" "/target/x86_64-unknown-freebsd/src/deps/Img-ad24612e0952e6f0.Img.3e18e81114b9f627-cgu.0.rcgu.o" "-Wl,--as-needed" "-Wl,-Bstatic" "/target/x86_64-unknown-freebsd/src/deps/libcompiler_builtins-5fa8f84ee86bdccf.rlib" "-Wl,-Bdynamic" "-lrt" "-lutil" "-lexecinfo" "-lkvm" "-lmemstat" "-lkvm" "-lutil" "-lprocstat" "-lrt" "-ldevstat" "-lexecinfo" "-
  = note: + set -euo pipefail
          + main -Wl,--version-script=/tmp/rustcxcoybW/list -Wl,--no-undefined-version -m64 /tmp/rustcxcoybW/symbols.o /target/x86_64-unknown-freebsd/src/deps/Img-ad24612e0952e6f0.Img.3e18e81114b9f627-cgu.0.rcgu.o -Wl,--as-needed -Wl,-Bstatic /target/x86_64-unknown-freebsd/src/deps/libcompiler_builtins-5fa8f84ee86bdccf.rlib -Wl,-Bdynamic -lrt -lutil -lexecinfo -lkvm -lmemstat -lkvm -lutil -lprocstat -lrt -ldevstat -lexecinfo -lpthread -lgcc_s -lc -lm -lrt -lpthread -lrt -lutil -lexecinfo -lkvm -lmemstat -lkvm -lutil -lprocstat -lrt -ldevstat -B/home/runner/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/bin/gcc-ld -B/home/runner/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/bin/gcc-ld -B/home/runner/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/bin/gcc-ld -Wl,--eh-frame-hdr -Wl,-z,noexecstack -o /target/x86_64-unknown-freebsd/src/deps/Img-ad24612e0952e6f0 -Wl,--no-gc-sections -pie
          + [[ 59 -eq 0 ]]
          + exec x86_64-unknown-freebsd13-gcc -Wl,--version-script=/tmp/rustcxcoybW/list -Wl,--no-undefined-version -m64 /tmp/rustcxcoybW/symbols.o /target/x86_64-unknown-freebsd/src/deps/Img-ad24612e0952e6f0.Img.3e18e81114b9f627-cgu.0.rcgu.o -Wl,--as-needed -Wl,-Bstatic /target/x86_64-unknown-freebsd/src/deps/libcompiler_builtins-5fa8f84ee86bdccf.rlib -Wl,-Bdynamic -lrt -lutil -lexecinfo -lkvm -lmemstat -lkvm -lutil -lprocstat -lrt -ldevstat -lexecinfo -lpthread -lgcc_s -lc -lm -lrt -lpthread -lrt -lutil -lexecinfo -lkvm -lmemstat -lkvm -lutil -lprocstat -lrt -ldevstat -B/home/runner/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/bin/gcc-ld -B/home/runner/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/bin/gcc-ld -B/home/runner/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/bin/gcc-ld -Wl,--eh-frame-hdr -Wl,-z,noexecstack -o /target/x86_64-unknown-freebsd/src/deps/Img-ad24612e0952e
          /usr/local/lib/gcc/x86_64-unknown-freebsd13/6.4.0/../../../../x86_64-unknown-freebsd13/bin/ld: /target/x86_64-unknown-freebsd/src/deps/Img-ad24612e0952e6f0: local symbol `environ' in /usr/local/lib/gcc/x86_64-unknown-freebsd13/6.4.0/../../../../x86_64-unknown-freebsd13/lib/Scrt1.o is referenced by DSO
          /usr/local/lib/gcc/x86_64-unknown-freebsd13/6.4.0/../../../../x86_64-unknown-freebsd13/bin/ld: final link failed: bad value
          collect2: error: ld returned 1 exit status

@Emilgardis
Copy link
Member

Same thing here, can you try #1564 (comment)

@Wyvern
Copy link
Author

Wyvern commented Sep 30, 2024

try #1564 (comment)

Tried install cross using main branch but still show install tagged version 0.2.5 of cross.
Not sure whether cargo install cross --git https://github.com/cross-rs/cross --branch main is the right way to do.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-information needs more information to replicate
Projects
None yet
Development

No branches or pull requests

2 participants