cross-rs / cross

“Zero setup” cross compilation and “cross testing” of Rust crates
Apache License 2.0
6.8k stars 379 forks source link

Cross build with `-Zbuild-std` for `x86_64-unknown-netbsd` got linking error. #1564

Open Wyvern opened 1 month ago

Wyvern commented 1 month ago

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 commented 1 month ago

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

Wyvern commented 1 month ago

rustc 1.83.0-nightly (ed04567ba 2024-09-28) cross v0.2.5 linking failed only on -Zbuild-std option used.

Wyvern commented 1 month ago

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 commented 1 month ago

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 commented 1 month ago

try using cross from the main branch

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

Wyvern commented 1 month ago

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.