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

rust-lld: error: undefined symbol: __[start|stop]_linkm2_KNOWN_STUBS #94

Open
torokati44 opened this issue Jun 11, 2024 · 5 comments
Open

Comments

@torokati44
Copy link

torokati44 commented Jun 11, 2024

This has been an issue before (#88), but now it has reached rustc beta: https://github.com/ruffle-rs/ruffle/actions/runs/9462151873/job/26064482962?pr=16448

  = note: rust-lld: error: undefined symbol: __start_linkm2_KNOWN_STUBS
          >>> referenced by 14g71b7tf2rrf8tb6zps16jjh
          >>>               ruffle_core-d15044b578f91d45.14g71b7tf2rrf8tb6zps16jjh.rcgu.o:(ruffle_core::stub::KNOWN_STUBS::h570647c79bce49d9) in archive /home/runner/work/ruffle/ruffle/target/ci/deps/libruffle_core-d15044b578f91d45.rlib
          >>> did you mean: __start_linkme_KNOWN_STUBS
          >>> defined in: <internal>
          >>> the encapsulation symbol needs to be retained under --gc-sections properly; consider -z nostart-stop-gc (see https://lld.llvm.org/ELF/start-stop-gc)
          
          rust-lld: error: undefined symbol: __stop_linkm2_KNOWN_STUBS
          >>> referenced by 14g71b7tf2rrf8tb6zps16jjh
          >>>               ruffle_core-d15044b578f91d45.14g71b7tf2rrf8tb6zps16jjh.rcgu.o:(ruffle_core::stub::KNOWN_STUBS::h570647c79bce49d9) in archive /home/runner/work/ruffle/ruffle/target/ci/deps/libruffle_core-d15044b578f91d45.rlib
          >>> did you mean: __stop_linkme_KNOWN_STUBS
          >>> defined in: <internal>
          collect2: error: ld returned 1 exit status
@torokati44
Copy link
Author

@torokati44
Copy link
Author

torokati44 commented Jun 11, 2024

RUSTFLAGS="-C link-args=-znostart-stop-gc" does indeed work around this.
Pasting the link from the error message to make it clickable: https://lld.llvm.org/ELF/start-stop-gc

niklasdewally added a commit to niklasdewally/conjure-oxide that referenced this issue Jun 19, 2024
In recent versions of the nightly / beta compilers, the use of linkme
causes linker errors. (dtolnay/linkme#94) This
is due to the new linker set as default in these versions.

Add linker flags to nightly builds to revert to the old linker
behaviour.

See:
  - dtolnay/linkme#88
  - https://blog.rust-lang.org/2024/05/17/enabling-rust-lld-on-linux.html
niklasdewally added a commit to niklasdewally/conjure-oxide that referenced this issue Jun 19, 2024
In recent versions of the nightly / beta compilers, the use of linkme
causes linker errors. (dtolnay/linkme#94) This
is due to the new linker set as default in these versions.

Add linker flags to nightly builds to revert to the old linker
behaviour.

See:

- dtolnay/linkme#88
- https://blog.rust-lang.org/2024/05/17/enabling-rust-lld-on-linux.html
niklasdewally added a commit to niklasdewally/conjure-oxide that referenced this issue Jun 19, 2024
In recent versions of the nightly / beta compilers, the use of linkme
causes linker errors. (dtolnay/linkme#94) This
is due to the new linker set as default in these versions.

Add linker flags to nightly builds to revert to the old linker
behaviour.

See:

- dtolnay/linkme#88
- https://blog.rust-lang.org/2024/05/17/enabling-rust-lld-on-linux.html

Signed-off-by: Niklas Dewally <[email protected]>
niklasdewally added a commit to niklasdewally/conjure-oxide that referenced this issue Jun 19, 2024
In recent versions of the nightly / beta compilers, the use of linkme
causes linker errors. (dtolnay/linkme#94) This
is due to the new linker set as default in these versions.

Add linker flags to nightly builds to revert to the old linker
behaviour.

See:

- dtolnay/linkme#88
- https://blog.rust-lang.org/2024/05/17/enabling-rust-lld-on-linux.html

Signed-off-by: Niklas Dewally <[email protected]>
niklasdewally added a commit to niklasdewally/conjure-oxide that referenced this issue Jun 19, 2024
In recent versions of the nightly / beta compilers, the use of linkme
causes linker errors. (dtolnay/linkme#94) This
is due to the new linker set as default in these versions.

Add linker flags to nightly builds to revert to the old linker
behaviour.

See:

- dtolnay/linkme#88
- https://blog.rust-lang.org/2024/05/17/enabling-rust-lld-on-linux.html

Signed-off-by: Niklas Dewally <[email protected]>
niklasdewally added a commit to niklasdewally/conjure-oxide that referenced this issue Jun 25, 2024
In recent versions of the nightly / beta compilers, the use of linkme
causes linker errors. (dtolnay/linkme#94) This
is due to the new linker set as default in these versions.

Add linker flags to nightly builds to revert to the old linker
behaviour.

See:

- dtolnay/linkme#88
- https://blog.rust-lang.org/2024/05/17/enabling-rust-lld-on-linux.html

Signed-off-by: Niklas Dewally <[email protected]>
niklasdewally added a commit to niklasdewally/conjure-oxide that referenced this issue Jun 25, 2024
In recent versions of the nightly / beta compilers, the use of linkme
causes linker errors. (dtolnay/linkme#94) This
is due to the new linker set as default in these versions.

Add linker flags to nightly builds to revert to the old linker
behaviour.

See:

- dtolnay/linkme#88
- https://blog.rust-lang.org/2024/05/17/enabling-rust-lld-on-linux.html

Signed-off-by: Niklas Dewally <[email protected]>
niklasdewally added a commit to niklasdewally/conjure-oxide that referenced this issue Jun 25, 2024
In recent versions of the nightly / beta compilers, the use of linkme
causes linker errors. (dtolnay/linkme#94) This
is due to the new linker set as default in these versions.

Add linker flags to nightly builds to revert to the old linker
behaviour.

See:

- dtolnay/linkme#88
- https://blog.rust-lang.org/2024/05/17/enabling-rust-lld-on-linux.html

Signed-off-by: Niklas Dewally <[email protected]>
niklasdewally added a commit to niklasdewally/conjure-oxide that referenced this issue Jun 25, 2024
In recent versions of the nightly / beta compilers, the use of linkme
causes linker errors. (dtolnay/linkme#94) This
is due to the new linker set as default in these versions.

Add linker flags to nightly builds to revert to the old linker
behaviour.

See:

- dtolnay/linkme#88
- https://blog.rust-lang.org/2024/05/17/enabling-rust-lld-on-linux.html

Signed-off-by: Niklas Dewally <[email protected]>
niklasdewally added a commit to niklasdewally/conjure-oxide that referenced this issue Jun 25, 2024
In recent versions of the nightly / beta compilers, the use of linkme
causes linker errors. (dtolnay/linkme#94) This
is due to the new linker set as default in these versions.

Add linker flags to nightly builds to revert to the old linker
behaviour.

See:

- dtolnay/linkme#88
- https://blog.rust-lang.org/2024/05/17/enabling-rust-lld-on-linux.html

Signed-off-by: Niklas Dewally <[email protected]>
niklasdewally added a commit to niklasdewally/conjure-oxide that referenced this issue Jun 25, 2024
In recent versions of the nightly / beta compilers, the use of linkme
causes linker errors. (dtolnay/linkme#94) This
is due to the new linker set as default in these versions.

Add linker flags to nightly builds to revert to the old linker
behaviour.

See:

- dtolnay/linkme#88
- https://blog.rust-lang.org/2024/05/17/enabling-rust-lld-on-linux.html

Signed-off-by: Niklas Dewally <[email protected]>
niklasdewally added a commit to niklasdewally/conjure-oxide that referenced this issue Jun 25, 2024
In recent versions of the nightly / beta compilers, the use of linkme
causes linker errors. (dtolnay/linkme#94) This
is due to the new linker set as default in these versions.

Add linker flags to nightly builds to revert to the old linker
behaviour.

See:

- dtolnay/linkme#88
- https://blog.rust-lang.org/2024/05/17/enabling-rust-lld-on-linux.html

Signed-off-by: Niklas Dewally <[email protected]>
niklasdewally added a commit to niklasdewally/conjure-oxide that referenced this issue Jun 25, 2024
In recent versions of the nightly / beta compilers, the use of linkme
causes linker errors. (dtolnay/linkme#94) This
is due to the new linker set as default in these versions.

Add linker flags to nightly builds to revert to the old linker
behaviour.

See:

- dtolnay/linkme#88
- https://blog.rust-lang.org/2024/05/17/enabling-rust-lld-on-linux.html

Signed-off-by: Niklas Dewally <[email protected]>
@yoctozepto
Copy link

It seems to really be a dup of now-long-standing #49 (see that digit switch? what a coincidence!)

BTW, what was the platform in this case? (distro, libc, cc toolkit; with versions) I am wondering how to pinpoint the real culprit.

@yoctozepto
Copy link

It seems to really be a dup of now-long-standing #49 (see that digit switch? what a coincidence!)

BTW, what was the platform in this case? (distro, libc, cc toolkit; with versions) I am wondering how to pinpoint the real culprit.

I have realised the main post had a ref to GHA running Ubuntu 22.04 which has clang in version 14 https://packages.ubuntu.com/jammy/clang and obviously runs glibc

ckane added a commit to ckane/kerntest that referenced this issue Nov 7, 2024
Fixes symbol errors when linking code using linkme crate.

Reference:
- dtolnay/linkme#94
@willmtemple
Copy link

Same issue here. link-args=-znostart-stop-gc as the error suggests works for me, as does link-dead-code.

Host triple: x86_64-unknown-linux-gnu
Arch Linux w/Rustup
rustc 1.85.0-nightly (a224f3807 2024-12-09)
glibc 2.40
clang/lld 18.1.8

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

No branches or pull requests

3 participants