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-netbsd got linking error. #1564

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

Comments

@Wyvern
Copy link

Wyvern commented Sep 29, 2024

As below:

error: linking with `x86_64-unknown-netbsd-gcc` failed: exit status: 1
  = note: rust-lld: error: unknown argument '-dc'
          rust-lld: error: unknown argument '-dp'
          collect2: error: ld returned 1 exit status

And advice or how fix it?

@Emilgardis
Copy link
Member

Need more information like what crate you're building and what version of cross + rust you're using.

@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)
cross v0.2.5
linking failed only on -Zbuild-std option used.

@Wyvern
Copy link
Author

Wyvern commented Sep 29, 2024

full error output:

error: linking with `x86_64-unknown-netbsd-gcc` 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-netbsd-gcc" "-Wl,--version-script=/tmp/rustcBXCPRL/list" "-Wl,--no-undefined-version" "-m64" "/tmp/rustcBXCPRL/symbols.o" "/target/x86_64-unknown-netbsd/src/deps/Img-29662ff3a552f03e.Img.fbd75c3e15ec2a83-cgu.0.rcgu.o" "-Wl,--as-needed" "-Wl,-Bstatic" "/target/x86_64-unknown-netbsd/src/deps/libcompiler_builtins-fc34f90c07646ef5.rlib" "-Wl,-Bdynamic" "-lutil" "-lrt" "-lutil" "-lexecinfo" "-lpthread" "-lrt" "-lgcc_s" "-lc" "-lm" "-lrt" "-lpthread" "-lutil" "-lrt" "-lutil" "-lexecinfo" "-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" "-fuse-ld=lld" "-Wl,--eh-frame-hdr" "-Wl,-z,noexecstack" "-o" "/target/x86_64-unknown-netbsd/src/deps/Img-29662ff3a552f03e" "-Wl,--no-gc-sections" "-pie" "-Wl,-z,relro,-z,now" "-Wl,--strip-all" "-Wl,--enable-new-dtags" "-Wl,-z,origin" "-fno-ident" "-fno-rtti" "-fno-exceptions" "-fno-backtrace" "-fomit-frame-pointer" "-fno-unwind-tables" "-fno-asynchronous-unwind-tables" "-fPIC" "-fPIE"
  = note: rust-lld: error: unknown argument '-dc'
          rust-lld: error: unknown argument '-dp'
          collect2: error: ld returned 1 exit status

@Emilgardis
Copy link
Member

can you try using cross from the main branch or change the image to the :main image.

cargo install cross --git https://github.com/cross-rs/cross
or

#Cross.toml
[target.x86_64-unknown-netbsd]
image = "ghcr.io/cross-rs/x86_64-unknown-netbsd:main"

@Wyvern
Copy link
Author

Wyvern commented Sep 30, 2024

try using cross from the main branch

cargo install cross --git https://github.com/cross-rs/cross --branch main?

@Wyvern
Copy link
Author

Wyvern commented Sep 30, 2024

also tried main image in Cross.toml like below:

[target.x86_64-unknown-netbsd]
image = "ghcr.io/cross-rs/x86_64-unknown-netbsd:main"
[target.x86_64-unknown-freebsd]
image = "ghcr.io/cross-rs/x86_64-unknown-freebsd:main"

nothing change, still got the same linking error.

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