-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Wrong glibc linked in building crates using proc_macro with linuxbrew #58394
Comments
Compiler plugins are This may be an intrinsic issue with linuxbrew's approach. You could try out making some C code that dlopens a linuxbrew library. |
Thanks. I'll investigate more. |
I understood as below:
I think the root cause of this issue is that linker may be changed by user environment but loader is fixed. |
Yes, you'll either need to adjust the Rust distribution to point to the linuxbrew environment via an rpath or LD_LIBRARY_PATH, or use the system linker when working with the compiler. |
OK. Linuxbrew don't recommend LD_LIBRARY_PATH modification. |
Would you please describe how to adjust the rust distribution? I could not find any rustup documentation on how to link a specific version of libc |
- Avoid issue of compiling project with an older version of compiler and getting error due to new API such as `Option::as_deref`. - Will download and use binaries from rust-lang.org based on specified version in rust-toolchain. This avoid the issue that compiler loads plugin using different versions of glibc/ld than the ones used to produce the plugin. See rust-lang/rust#58394
- Avoid issue of compiling project with an older version of compiler and getting error due to new API such as `Option::as_deref`. - Will download and use binaries from rust-lang.org based on specified version in rust-toolchain. This avoid the issue that compiler loads plugin using different versions of glibc/ld than the ones used to produce the plugin. See rust-lang/rust#58394
Possible fix for this in #9322. |
If the versions of system glibc and linuxbrew glibc are different, building crates using proc_macro (ex. serde_derive, structopt_derive) is failed at Rust 1.32.0.
In Rust 1.31.1, this issue don't occur.
Environment
CentOS Linux release 7.6.1810 (Core)
Rust 1.32.0, 1.31.1
System glibc: 2.17
linuxbrew glibc: 2.23
Step
Source code
Cargo.toml
src/main.rs
Build result
The
ldd
result oflibstructopt_derive....so
is below.In this result, linker should search to linuxbrew's glibc, but actually search to system glibc.
Workaround
If
.cargo/config
set to below, build is passed at Rust 1.32.0.Broken revision
I run
git bisect
from 1.31.1 to 1.32.0. The result is below.git bisect log
is below.Related issue
This issue seems to be the same.
rust-lang/cargo#6582
The text was updated successfully, but these errors were encountered: