Closed
Description
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
[package]
name = "temp"
version = "0.1.0"
[dependencies]
structopt = "0.2.14"
src/main.rs
#[macro_use]
extern crate structopt;
use structopt::StructOpt;
#[derive(Debug, StructOpt)]
pub struct Opt {}
fn main() {
let _ = Opt::from_args();
println!("Hello, world!");
}
Build result
$ rustup override set 1.32.0
$ cargo clean; cargo run
Compiling structopt v0.2.14
error: /lib64/libc.so.6: version `GLIBC_2.18' not found (required by /home/dalance/work/repos/temp/target/debug/deps/libstructopt_derive-cdf0ae629ff7e333.so)
--> /home/dalance/.cargo/registry/src/github.com-1ecc6299db9ec823/structopt-0.2.14/src/lib.rs:490:1
|
490 | extern crate structopt_derive;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: aborting due to previous error
error: Could not compile `structopt`.
The ldd
result of libstructopt_derive....so
is below.
In this result, linker should search to linuxbrew's glibc, but actually search to system glibc.
$ ldd /home/dalance/work/repos/temp/target/debug/deps/libstructopt_derive-cdf0ae629ff7e333.so
linux-vdso.so.1 (0x00007fffac483000)
libdl.so.2 => /home/dalance/.linuxbrew/lib/libdl.so.2 (0x00007f2c95292000)
librt.so.1 => /home/dalance/.linuxbrew/lib/librt.so.1 (0x00007f2c95288000)
libpthread.so.0 => /home/dalance/.linuxbrew/lib/libpthread.so.0 (0x00007f2c95268000)
libgcc_s.so.1 => /home/dalance/.linuxbrew/lib/libgcc_s.so.1 (0x00007f2c95051000)
libc.so.6 => /home/dalance/.linuxbrew/lib/libc.so.6 (0x00007f2c94eb3000)
/home/dalance/.linuxbrew/Cellar/glibc/2.23/lib64/ld-linux-x86-64.so.2 (0x00007f2c9566a000)
Workaround
If .cargo/config
set to below, build is passed at Rust 1.32.0.
[target.x86_64-unknown-linux-gnu]
linker = "/usr/bin/cc"
Broken revision
I run git bisect
from 1.31.1 to 1.32.0. The result is below.
188d2dafcdd4d0dbd54315412503fb8011d716b6 is the first bad commit
commit 188d2dafcdd4d0dbd54315412503fb8011d716b6
Author: Eduard-Mihai Burtescu <edy.burt@gmail.com>
Date: Thu Apr 26 14:11:08 2018 +0300
Statically link proc_macro into proc macros.
:040000 040000 a218f2092aad86632374db4fc3ba0effe6705d7f b8357a8a11394a8ab0f6e20875802930dd0ecc9f M src
bisect run success
git bisect log
is below.
# bad: [9fda7c2237db910e41d6a712e9a2139b352e558b] Auto merge of #57600 - rust-lang:stable-next, r=alexcrichton
# good: [b6c32da9b0481e3e9d737153286b3ff8aa39a22c] Auto merge of #56960 - pietroalbini:gpg-stable, r=pietroalbini
git bisect start '1.32.0' '1.31.1'
# good: [4bd4e4130ed531a644263db26bf8461704215c77] Auto merge of #54490 - wesleywiser:rewrite_it_in_mir, r=oli-obk
git bisect good 4bd4e4130ed531a644263db26bf8461704215c77
# good: [6ca7bc0eb8648abc8673a971c85b777a6bc62e16] Rollup merge of #55781 - pnkfelix:issue-54382-more-precise-spans-for-temps-and-their-drops, r=davidtwco
git bisect good 6ca7bc0eb8648abc8673a971c85b777a6bc62e16
# good: [45e5a856a6551ae1b77fe8c5585e80f886b44b6e] Rollup merge of #56100 - RalfJung:visiting-generators, r=oli-obk
git bisect good 45e5a856a6551ae1b77fe8c5585e80f886b44b6e
# bad: [fb2b2f5582b9eff3ee5d98ec5c9461847b6f0b2d] Rollup merge of #56367 - alexreg:move-feature-gate-tests-1, r=Centril
git bisect bad fb2b2f5582b9eff3ee5d98ec5c9461847b6f0b2d
# good: [5d7717360c8f343f70a33455029355f00e39dea2] fix test
git bisect good 5d7717360c8f343f70a33455029355f00e39dea2
# good: [1fe2085441c5c9afc1523c19c1c1ddbf86bae462] Rollup merge of #56322 - petrochenkov:edlints, r=eddyb
git bisect good 1fe2085441c5c9afc1523c19c1c1ddbf86bae462
# bad: [b8198da4d2a9e643a9863bf4cddd82d01ebc3f71] Rollup merge of #55821 - ljedrz:cached_key_sorts, r=michaelwoerister
git bisect bad b8198da4d2a9e643a9863bf4cddd82d01ebc3f71
# good: [67afeef9e472812ba85341114c21289c75790a3e] proc_macro: move to a dependency of libtest.
git bisect good 67afeef9e472812ba85341114c21289c75790a3e
# bad: [eb2c71cdf2d154a217e155d96474f4988e04a253] bootstrap: don't use libraries from MUSL_ROOT on non-musl targets.
git bisect bad eb2c71cdf2d154a217e155d96474f4988e04a253
# bad: [fcca22cb4072097fc2cd1ae78ff84c7d59aacda2] tests: move all proc_macro tests from -fulldeps.
git bisect bad fcca22cb4072097fc2cd1ae78ff84c7d59aacda2
# bad: [d3ab4a74efad266155fcd402c8d159af9e443e3d] tests: remove ignore-stage1 where possible in proc_macro tests.
git bisect bad d3ab4a74efad266155fcd402c8d159af9e443e3d
# bad: [188d2dafcdd4d0dbd54315412503fb8011d716b6] Statically link proc_macro into proc macros.
git bisect bad 188d2dafcdd4d0dbd54315412503fb8011d716b6
# first bad commit: [188d2dafcdd4d0dbd54315412503fb8011d716b6] Statically link proc_macro into proc macros.
Related issue
This issue seems to be the same.
rust-lang/cargo#6582