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

unsupported linker arg: --no-undefined-version #16855

Closed
DavidZbarsky-at opened this issue Aug 16, 2023 · 5 comments · Fixed by #18486
Closed

unsupported linker arg: --no-undefined-version #16855

DavidZbarsky-at opened this issue Aug 16, 2023 · 5 comments · Fixed by #18486
Labels
bug Observed behavior contradicts documented or intended behavior zig cc Zig as a drop-in C compiler feature
Milestone

Comments

@DavidZbarsky-at
Copy link

Zig Version

0.11.0-dev.3886+0c1bfe271

Steps to Reproduce and Observed Behavior

I am using zig as a hermetic toolchain when building C and Rust code (https://github.com/uber/hermetic_cc_toolchain)

It looks as of rust-lang/rust#108017, upstream llvm defaults to passing -undefined-version when it detect lld, which Rustc overrides with --no-undefined-version, which Zig doesn't know about yet. (See https://reviews.llvm.org/D135402 for more details)

Could these two flag be implemented (or at least turn --no-undefined-version into a no-op for now)?

It's a bit complicated to get a reduced repro case so hopefully this is clear enough, but let me know if you really need one.

Expected Behavior

Link my object

@DavidZbarsky-at DavidZbarsky-at added the bug Observed behavior contradicts documented or intended behavior label Aug 16, 2023
@DavidZbarsky-at
Copy link
Author

If ignoring --no-undefined-version for now is an acceptable fix, I'm happy to send a PR, should be trivial.

@dbanetto
Copy link

Hey @DavidZbarsky-at,

I've also run into this using https://github.com/uber/hermetic_cc_toolchain with zig 0.11.0 & https://github.com/bazelbuild/rules_rust with rustc 1.71.

I found that rolling back to rust version 1.69.0 works around this issue for me due to rust-lang/rust#108017 is included 1.70.0 on-wards.

@DhashS
Copy link
Contributor

DhashS commented Sep 29, 2023

I've also run into this issue, but the solution proposed by @dbanetto isn't going to work for me, as some dependent libraries require rust_version >= 1.70.0.

Couple additional notes:

  • This does not occur when using cargo zigbuild, just with the hermetic bazel toolchain thing

As a result, I've opened up a PR #17326 adding this, but would really welcome a second set of eyes (it feels wrong/incomplete to me) to make sure that i'm parsing / passing the flag around correctly from the zig cc invocation to actual LLVM. I'm happy to flesh this out more and I hope this can land in zig-next to unbreak that toolchain :)

@NuLL3rr0r
Copy link

@DhashS thank you for mentioning cargo zigbuild. That also works for me.

@atoav
Copy link

atoav commented Nov 24, 2023

I am not sure if this is the right place, but I had a Rust/Python project that was broken by this. I build python wheels using maturin:

maturin build --release --interpreter python3.9 --target x86_64-unknown-linux-gnu --zig

Using a rustc 1.74 this failed with the mentioned error.
I could get it to build again by reverting back to 1.69 as mentioned above:

rustup default 1.69

Is this issue still looked into? I'd love to be able to use a newer rustc version.

@Vexu Vexu added the zig cc Zig as a drop-in C compiler feature label Nov 29, 2023
@Vexu Vexu added this to the 0.12.0 milestone Nov 29, 2023
@Vexu Vexu linked a pull request Nov 29, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Observed behavior contradicts documented or intended behavior zig cc Zig as a drop-in C compiler feature
Projects
None yet
6 participants