在 CentOS 7 上构建和使用更新的 GLIBC

Building and using a newer GLIBC on CentOS 7

我使用 CentOS 7 并想使用一些需要 GLIBC_2.18 的 Anaconda python 软件包,而主机 OS 只提供 2.17。我尝试按照这些 instructions 自己编译更新版本的 glibc。当我尝试使用这个较新的 glibc 运行 任何可执行文件时,出现错误:

$ ./testrun.sh ls
ls: error while loading shared libraries: ls: cannot open shared object file: No such file or director

这个问题有解决方法吗?

更新 1:

根据此 中的建议,我需要指定可执行文件的完整路径,现在给出不同的错误消息:

$ cd glibc-2.20/build # build directory
$ ./testrun.sh /bin/ls
/bin/ls: error while loading shared libraries: libselinux.so.1: cannot open shared object file: No such file or directory

更新二:

testrun.sh 中添加系统库路径解决了问题。我不仅可以 运行 ls,而且可以使用前面提到的 python 包。谢谢!

尝试./testrun.sh /bin/ls

就是说,为您的系统构建 Python 软件包确实会更好,而不是像 Danila Vershinin 所建议的那样尝试制作非系统 GLIBC。

更新:

libselinux.so.1: ...: No such file or directory

新 GLIBC 的 testrun.sh 不在系统目录中查找(例如 /usr/lib64)。您需要将 附加 系统目录到它使用的 --library-path 。例如。变化

--library-path "${builddir}":"${builddir}"/math:"${builddir}"/elf:"${builddir}"/dlfcn:"${builddir}"/nss:"${builddir}"/nis:"${builddir}"/rt:"${builddir}"/resolv:"${builddir}"/mathvec:"${builddir}"/support:"${builddir}"/crypt:"${builddir}"/nptl

至:

--library-path "${builddir}":"${builddir}"/math:"${builddir}"/elf:"${builddir}"/dlfcn:"${builddir}"/nss:"${builddir}"/nis:"${builddir}"/rt:"${builddir}"/resolv:"${builddir}"/mathvec:"${builddir}"/support:"${builddir}"/crypt:"${builddir}"/nptl:/usr/lib64:/lib64

(或类似的东西)。