Skip to content
Advertisement

Building and using a newer GLIBC on CentOS 7

I use CentOS 7 and would like to use some Anaconda python package that requires GLIBC_2.18 while the host OS only provides 2.17. I tried compiling a newer version of glibc myself following these instructions. When I try to run any executable with this newer glibc I am getting an error:

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

Is there a workaround for this issue?

Update 1:

As per suggestion in this answer I needed to specify the full path to the executable, which now gives a different error message:

$ 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

Update 2:

Adding paths to the system libraries in testrun.sh solved the problem. I can not only run ls but also the aforementioned python package. Thank you!

Advertisement

Answer

Try ./testrun.sh /bin/ls.

That said, you will really be better off building the Python package for your system, instead of trying to make non-system GLIBC, as Danila Vershinin suggested.

Update:

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

The testrun.sh for the new GLIBC does not look in system directories (e.g. /usr/lib64). You need to append system directories to the --library-path it uses. E.g. change

--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

to:

--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

(or something like that).

Advertisement