Skip to content

wrong libc linked during build #6582

Open
@asdetrefle

Description

@asdetrefle

Problem

It's been just two months I have not touched Rust but today after upgrading to the most recent version I was no longer able to use cargo install.

Steps

  1. update to rust 1.32: rustup update + rustup default stable
  2. cargo install ripgrep

at the end of compilation the error message shows up:

  ...
  Compiling globset v0.4.2
  Compiling grep-regex v0.1.1
  Compiling grep-cli v0.1.1
  Compiling ignore v0.4.6
  Compiling grep-printer v0.1.1
error: /usr/lib64/libc.so.6: version `GLIBC_2.18' not found (required by /tmp/cargo-installkV0c2k/release/deps/libserde_derive-615594b83ebc865a.so)
  --> ~/.cargo/registry/src/github.com-1ecc6299db9ec823/grep-printer-0.1.1/src/lib.rs:81:1
   |
81 | extern crate serde_derive;
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^

error: failed to compile `ripgrep v0.10.0`, intermediate artifacts can be found at `/tmp/cargo-installkV0c2k`

I think the problem happens at linking time so I don't know if the additional error message at the end was really helpful.

This should not happen because rustc is not supposed to link against /usr/lib64/libc.so.6:

➜  ~ ldd /tmp/cargo-installkV0c2k/release/deps/libserde_derive-615594b83ebc865a.so
linux-vdso.so.1 (0x00007fffe41ba000)
libdl.so.2 => /home/linuxbrew/.linuxbrew/lib/libdl.so.2 (0x00007ff1ce55a000)
librt.so.1 => /home/linuxbrew/.linuxbrew/lib/librt.so.1 (0x00007ff1ce352000)
libpthread.so.0 => /home/linuxbrew/.linuxbrew/lib/libpthread.so.0 (0x00007ff1ce135000)
libgcc_s.so.1 => /home/linuxbrew/.linuxbrew/lib/libgcc_s.so.1 (0x00007ff1cdf1e000)
libc.so.6 => /home/linuxbrew/.linuxbrew/lib/libc.so.6 (0x00007ff1cdb7f000)
/home/linuxbrew/.linuxbrew/Cellar/glibc/2.23/lib64/ld-linux-x86-64.so.2 (0x00007ff1cea71000)

and /home/linuxbrew/.linuxbrew/lib/libc.so.6 is an updated version of glibc:

➜  ~ strings /home/linuxbrew/.linuxbrew/lib/libc.so.6 | grep ^GLIBC_
GLIBC_2.2.5
GLIBC_2.2.6
GLIBC_2.3
GLIBC_2.3.2
GLIBC_2.3.3
GLIBC_2.3.4
GLIBC_2.4
GLIBC_2.5
GLIBC_2.6
GLIBC_2.7
GLIBC_2.8
GLIBC_2.9
GLIBC_2.10
GLIBC_2.11
GLIBC_2.12
GLIBC_2.13
GLIBC_2.14
GLIBC_2.15
GLIBC_2.16
GLIBC_2.17
GLIBC_2.18
GLIBC_2.22
GLIBC_2.23
GLIBC_PRIVATE
GLIBC_2.23
GLIBC_2.8
GLIBC_2.5
GLIBC_2.9
GLIBC_2.7
GLIBC_2.6
GLIBC_2.18
GLIBC_2.11
GLIBC_2.16
GLIBC_2.10
GLIBC_2.17
GLIBC_2.13
GLIBC_2.2.6

Notes

Output of cargo version:

➜  ~ cargo version
cargo 1.32.0 (8610973aa 2019-01-02)
➜  ~ rustc --version 
rustc 1.32.0 (9fda7c223 2019-01-16)

The platform I have is CentOS 7. And if I downgrade rust to 1.31.0, it works without any problem. So this should be related to the version update.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-linkageArea: linker issues, dylib, cdylib, shared libraries, soC-bugCategory: bugS-triageStatus: This issue is waiting on initial triage.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions