I am trying to install Rust in a shared machine where the philosophy is to avoid bugging the sysadmin with install requests and install what we need ourselves via linuxbrew.
As a result, I would like to install rust without any link to the system libs
I have tried to install via curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh which works fine but fails later when I try to install anything that depends on proc_macro, it fails on
Compiling proc-macro-error-attr v0.4.5
error: /lib64/libc.so.6: version `GLIBC_2.18' not found
I get bitten by the same error if I try to install rust via brew install rust (but earlier: when the bootstrap tries to install serde_deriv
Compiling serde_derive v1.0.81
error: /lib64/libc.so.6: version `GLIBC_2.18' not found
From what I gather, since cc, ld and pkg-config are those I installed via linuxbrew and those correctly return the path of the linuxbrew versions of the dependencies, so why is it looking at system's libc?
I am willing to investigate more, but I am quite new to this kind of setup and I have already spent around 10h on this so it'd be great if someone could provide some guidance
I tried to reproduce your problem in a Docker container.
Can you provide more details about the setup?
What linux distro are you using, what packages are installed globally?
This is a CentOS 7.6, I am not sure which packages are relevant for this situation but the system packages for what I guess is useful are
glibc 1.7
gcc 4.8.5
pkgconfig 0.27.1
What might be relevant: since the idea is that every user has their own linuxbrew install, it is installed in ~/.linuxbrew and not in /home/linuxbrew/.linuxbrew. According to linuxbrew doc, it can be the cause of issues, but I suppose that mean linuxbrew-internal issues?
rustc loads libstructopt_derive-cdf0ae629ff7e333.so by libc::dlopen . The official rustc from rustup is linked to /lib64/libc.so.6 , so libc::dlopen use /etc/ld.so.(config|cache) as library search path. Therefore libc::dlopen is failed because ~/.linuxbrew/lib/libc.so.6 can't be found.
But I don't understand why rustup would link to /lib64's libc or how to change it
Another update: I tried to play with RUSTFLAGS and setting
export RUSTFLAGS="-L/usr/lib64"
does make serde build work, confirming that the issue is that by default something in the build chain is trying to use both system's and linuxbrew's libc since forcing it to use system's for everything works but I still want the opposite: run everything in linuxbrew.