Download the .tar.gz or tar.bz2 file for the version of GNU C Library that you want to compile (install) from source from https://ftp.gnu.org/gnu/glibc/. For example, let's say I download glibc-2.25.tar.gz. wget can be used.
wget https://ftp.gnu.org/gnu/glibc/glibc-2.25.tar.gz
Use the tar extract command to extract the TAR file to the /tmp directory.
tar -zxpf glibc-2.25.tar.gz --directory /tmp/
At this point, if you were to move into the /tmp/glibc-2.25 directory and run ./configure, you would get a warning along the lines of "build directory", thus let's create a build directory.
mkdir /tmp/glibc-2.25/build
Move into the build directory.
cd /tmp/glibc-2.25/build
Run the configure command to make GNU C Library in your /usr/local/lib64 directory.
../configure --prefix=/usr/local/lib64
If configure was successful, the following should be displayed at the end of the output.
Thank you for using PHP.
Run make.
sudo make
Run make install.
make install
There may be a current symbolic link pointing to some other version of libc. Once I try to replace the existing symbolic link to point to the new libc-<version>.so file, and this totally broke my system. All commands started to fail. Fortunately, I had a VMWare snapshot taken and I was able to restore my system. So, I wouldn't mess with the symbolic link, as this may totally hose up your system.
~]# ll /lib64/ | grep -i libc.so
-rw-r--r-- 1 root root 253 Mar 22 2022 libc.so
lrwxrwxrwx 1 root root 12 Jun 5 2022 libc.so.6 -> libc-2.17.so
You might be able to export LD_LIBRARY_PATH to point to the new version of GNU C Library that you make.
export LD_LIBRARY_PATH=/path/to/glibc/lib
Did you find this article helpful?
If so, consider buying me a coffee over at