Skip to content

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

Closed

Description

@DavidZbarsky-at

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

Activity

  1. added
    bugObserved behavior contradicts documented or intended behavior
    on Aug 16, 2023
  2. DavidZbarsky-at commented on Aug 16, 2023

    @DavidZbarsky-at
    Author

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

  3. dbanetto commented on Aug 22, 2023

    @dbanetto

    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.

  4. DhashS commented on Sep 29, 2023

    @DhashS
    Contributor

    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 :)

  5. NuLL3rr0r commented on Nov 8, 2023

    @NuLL3rr0r

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

  6. atoav commented on Nov 24, 2023

    @atoav

    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.

  7. added
    zig ccZig as a drop-in C compiler feature
    on Nov 29, 2023
  8. added this to the 0.12.0 milestone on Nov 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugObserved behavior contradicts documented or intended behaviorzig ccZig as a drop-in C compiler feature

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions