我们有许多基于 Gentoo 的旧机器,正在尝试升级它们。这些主机中至少有三台出现故障,最新的 glibc 出现了一个常见错误:
x86_64-pc-linux-gnu-gcc -m32 -Wl,-O1 -Wl,--as-needed -Wl,-O1 -Wl,--as-needed -shared -static-libgcc -Wl,-O1 -Wl,-z,defs -Wl,-dynamic-linker=/lib32/ld-linux.so.2 -B/v
ar/tmp/portage/sys-libs/glibc-2.20-r2/work/build-x86-x86_64-pc-linux-gnu-nptl/csu/ -Wl,--version-script=/var/tmp/portage/sys-libs/glibc-2.20-r2/work/build-x86-x86_64-p
c-linux-gnu-nptl/libc.map -Wl,-soname=libc.so.6 -Wl,-z,combreloc -Wl,-z,relro -nostdlib -nostartfiles -e __libc_main -Wl,-z,now -L/var/tmp/portage/sys-libs/glibc-2.20-r
2/work/build-x86-x86_64-pc-linux-gnu-nptl -L/var/tmp/portage/sys-libs/glibc-2.20-r2/work/build-x86-x86_64-pc-linux-gnu-nptl/math -L/var/tmp/portage/sys-libs/glibc-2.20-
r2/work/build-x86-x86_64-pc-linux-gnu-nptl/elf -L/var/tmp/portage/sys-libs/glibc-2.20-r2/work/build-x86-x86_64-pc-linux-gnu-nptl/dlfcn -L/var/tmp/portage/sys-libs/glibc
-2.20-r2/work/build-x86-x86_64-pc-linux-gnu-nptl/nss -L/var/tmp/portage/sys-libs/glibc-2.20-r2/work/build-x86-x86_64-pc-linux-gnu-nptl/nis -L/var/tmp/portage/sys-libs/g
libc-2.20-r2/work/build-x86-x86_64-pc-linux-gnu-nptl/rt -L/var/tmp/portage/sys-libs/glibc-2.20-r2/work/build-x86-x86_64-pc-linux-gnu-nptl/resolv -L/var/tmp/portage/sys-
libs/glibc-2.20-r2/work/build-x86-x86_64-pc-linux-gnu-nptl/crypt -L/var/tmp/portage/sys-libs/glibc-2.20-r2/work/build-x86-x86_64-pc-linux-gnu-nptl/nptl -Wl,-rpath-link=
/var/tmp/portage/sys-libs/glibc-2.20-r2/work/build-x86-x86_64-pc-linux-gnu-nptl:/var/tmp/portage/sys-libs/glibc-2.20-r2/work/build-x86-x86_64-pc-linux-gnu-nptl/math:/va
r/tmp/portage/sys-libs/glibc-2.20-r2/work/build-x86-x86_64-pc-linux-gnu-nptl/elf:/var/tmp/portage/sys-libs/glibc-2.20-r2/work/build-x86-x86_64-pc-linux-gnu-nptl/dlfcn:/
var/tmp/portage/sys-libs/glibc-2.20-r2/work/build-x86-x86_64-pc-linux-gnu-nptl/nss:/var/tmp/portage/sys-libs/glibc-2.20-r2/work/build-x86-x86_64-pc-linux-gnu-nptl/nis:/
var/tmp/portage/sys-libs/glibc-2.20-r2/work/build-x86-x86_64-pc-linux-gnu-nptl/rt:/var/tmp/portage/sys-libs/glibc-2.20-r2/work/build-x86-x86_64-pc-linux-gnu-nptl/resolv
:/var/tmp/portage/sys-libs/glibc-2.20-r2/work/build-x86-x86_64-pc-linux-gnu-nptl/crypt:/var/tmp/portage/sys-libs/glibc-2.20-r2/work/build-x86-x86_64-pc-linux-gnu-nptl/n
ptl -o /var/tmp/portage/sys-libs/glibc-2.20-r2/work/build-x86-x86_64-pc-linux-gnu-nptl/libc.so -T /var/tmp/portage/sys-libs/glibc-2.20-r2/work/build-x86-x86_64-pc-linux
-gnu-nptl/shlib.lds /var/tmp/portage/sys-libs/glibc-2.20-r2/work/build-x86-x86_64-pc-linux-gnu-nptl/csu/abi-note.o /var/tmp/portage/sys-libs/glibc-2.20-r2/work/build-x8
6-x86_64-pc-linux-gnu-nptl/elf/soinit.os /var/tmp/portage/sys-libs/glibc-2.20-r2/work/build-x86-x86_64-pc-linux-gnu-nptl/libc_pic.os /var/tmp/portage/sys-libs/glibc-2.2
0-r2/work/build-x86-x86_64-pc-linux-gnu-nptl/elf/sofini.os /var/tmp/portage/sys-libs/glibc-2.20-r2/work/build-x86-x86_64-pc-linux-gnu-nptl/elf/interp.os /var/tmp/portag
e/sys-libs/glibc-2.20-r2/work/build-x86-x86_64-pc-linux-gnu-nptl/elf/ld.so -lgcc
/usr/lib/gcc/x86_64-pc-linux-gnu/4.8.5/../../../../x86_64-pc-linux-gnu/bin/ld: /var/tmp/portage/sys-libs/glibc-2.20-r2/work/build-x86-x86_64-pc-linux-gnu-nptl/libc_pic.
os: warning: relocation against `_dl_sysinfo' in readonly section `.text.compat'.
/var/tmp/portage/sys-libs/glibc-2.20-r2/work/build-x86-x86_64-pc-linux-gnu-nptl/libc_pic.os: In function `__GI_kill':
(.text+0x14af1): undefined reference to `_dl_sysinfo'
/var/tmp/portage/sys-libs/glibc-2.20-r2/work/build-x86-x86_64-pc-linux-gnu-nptl/libc_pic.os: In function `__sigaltstack':
(.text+0x150b1): undefined reference to `_dl_sysinfo'
/var/tmp/portage/sys-libs/glibc-2.20-r2/work/build-x86-x86_64-pc-linux-gnu-nptl/libc_pic.os: In function `__getcontext':
(.text+0x268b1): undefined reference to `_dl_sysinfo'
/var/tmp/portage/sys-libs/glibc-2.20-r2/work/build-x86-x86_64-pc-linux-gnu-nptl/libc_pic.os: In function `setcontext':
(.text+0x268f6): undefined reference to `_dl_sysinfo'
/var/tmp/portage/sys-libs/glibc-2.20-r2/work/build-x86-x86_64-pc-linux-gnu-nptl/libc_pic.os: In function `swapcontext':
(.text+0x26a14): undefined reference to `_dl_sysinfo'
/var/tmp/portage/sys-libs/glibc-2.20-r2/work/build-x86-x86_64-pc-linux-gnu-nptl/libc_pic.os:(.text+0x46f91): more undefined references to `_dl_sysinfo' follow
/usr/lib/gcc/x86_64-pc-linux-gnu/4.8.5/../../../../x86_64-pc-linux-gnu/bin/ld: warning: creating a DT_TEXTREL in object.
collect2: error: ld returned 1 exit status
../Makerules:601: recipe for target '/var/tmp/portage/sys-libs/glibc-2.20-r2/work/build-x86-x86_64-pc-linux-gnu-nptl/libc.so' failed
我们尝试在另一台 Gentoo 机器上寻找参考_dl_sysinfo
,但是无济于事:
xxxxxx ~ # find /lib64/ -name "*.so" -exec strings {} \; | grep dl_sysinfo
xxxxxx ~ # find /usr/lib64/ -name "*.so" -exec strings {} \; | grep dl_sysinfo
xxxxxx ~ #
我们还尝试添加-fPIC -DPIC
到CFLAGS
,但错误仍然存在。我们不确定为什么glibc
包必须更新,因为我们已经使用安装了最新的包PORTAGE_BINHOST
。 也是一样gcc
。
问题是:如何解决这个问题?
更新:我刚刚注意到将配置文件从 切换hardened/linux/amd64
到default/linux/amd64/13.0
会阻止glibc
出现,但这只是一个临时解决方案。我们肯定希望继续使用强化配置文件。
答案1
如果 gcc 没有强化使用标志,则使用强化使用标志的 glibc 会失败。我在一些服务器上遇到过这种情况,因为 HHVM 对强化 gcc 存在问题。解决方案是也为 sys-libs/glibc 指定“-hardened”。