3

With cargo-tree, I can see my project depends on libc v0.2.62

$ cargo tree -p libc -i | grep libc
libc v0.2.62

But it actually requires two versions GLIB_2.14 and GLIBC2.18. ldd error messages are as follows:

/lib64/libc.so.6: version `GLIBC_2.18' not found
/lib64/libc.so.6: version `GLIBC_2.14' not found

I am able to get GLIBC_2.14 but not GLIBC_2.18. So I plan to switch to older versions of Rust or some crates I use. I need to find out which one depends on GLIBC_2.18 first. Can anyone help me?

Yixing Liu
  • 2,179
  • 1
  • 20
  • 36

1 Answers1

3

To see which symbols reference GLIBC_2.18, you can use eu-readelf:

$ eu-readelf -s /usr/bin/cargo  | grep -F @GLIBC_2.18
  157: 0000000000000000      0 FUNC    WEAK   DEFAULT    UNDEF __cxa_thread_atexit_impl@GLIBC_2.18 (19)

This symbol is used by the Rust runtime itself to implement destructors (the Drop trait) for TLS variables.

If this is about getting Rust to work on Red Hat Enterprise Linux, you should be using Rust Toolset. It is regularly rebased against the latest upstream version, so its Rust version is fairly current most of the time.

Florian Weimer
  • 32,022
  • 3
  • 48
  • 92
  • Yes, this is about getting Rust to work on RHEL. Unfortunately I am not able to get Rust Toolset. Is there another way around? Can I avoid using `GLIBC_2.18` by downgrading my Rust? – Yixing Liu Sep 01 '19 at 12:50
  • 2
    Isn't Rust Toolset part of the free developer subscription? Or is the problem that you cannot install any RPM packages on the host? – Florian Weimer Sep 01 '19 at 13:10
  • The rust dev toolset is not blessed by my admin. I can't install it. Need to find a way to work around. – Yixing Liu Sep 01 '19 at 13:11
  • 1
    You need to work with your administrator towards a solution. Rust Toolset *is* the proper way to install the Rust compiler on Red Hat Enterprise Linux. – Florian Weimer Sep 01 '19 at 13:15
  • 1
    But I don't need a rust compiler. I can cross-compile on another machine and ship the binary to RHEL. I just have missing libraries. `GLIBC_2.18` is not available on RHEL7 (https://access.redhat.com/solutions/3643072), so I am looking for a way to downgrade my Rust cross-compiler. – Yixing Liu Sep 01 '19 at 13:17
  • The Rust compiler in Rust Toolset will produce compatible binaries. Just use that. Install Red Hat Enterprise Linux in a VM, or talk to your administrator to provide it to you. – Florian Weimer Sep 01 '19 at 13:22
  • 1
    New question as a follow up of these comments: [How can I specify the GLIBC version in cargo build for Rust?](https://stackoverflow.com/questions/57749127/how-can-i-specify-the-glibc-version-in-cargo-build-for-rust). – zrzka Sep 02 '19 at 07:42