
Almost always, it makes sense to do this as root since GNU C Library will almost always be in the /usr/lib64 directory (which is owned by root). Or, you can use sudo, assuming your user has sudo permission.
su - root
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. This will not create the libc-<version>.so file in the specified directory (/usr/local/glibc in this example) but instead prepares to make the libc-<version>.so file in the specified directory.
It is also noteworthy that shared library files are typically in these directories:
- /usr/lib
- /usr/lib64
- /lib
- /lib64
Going with /usr/local/glibc isolates the version of GNU C Library being installed from the other shared library files.
../configure --prefix=/usr/local/glibc
It is also noteworthy that on an Amazon Web Services (AWS) EC2 instance, I had no issues configuring version 2.27 of glibc, but when attempting to configuring version 2.28 I got "the following programs are missing or too old".
These critical programs are missing or too old: make
Thus I compiled the latest version of make from source (version 4.4) but I still got the error. Looking at the glibc configure script, I came to determine the issue was with the gmake CLI, not the make CLI.
]# gmake --version
GNU Make 3.82
Built for x86_64-koji-linux-gnu
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
I resolved this by updating the configure script to allow version 3.82 of gmake.
if test -z "$MAKE"; then
ac_verc_fail=yes
else
# Found it, now check the version.
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking version of $MAKE" >&5
$as_echo_n "checking version of $MAKE... " >&6; }
ac_prog_version=`$MAKE --version 2>&1 | sed -n 's/^.*GNU Make[^0-9]*\([0-9][0-9.]*\).*$/\1/p'`
echo ac_prog_version = $ac_prog_version
case $ac_prog_version in
'') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;;
[4-9].* | [1-9][0-9]*|3.82)
Run make.
sudo make
Run make install.
make install
There should already be a symbolic between /usr/lib64/libc.so and a certain version of GNU C Library, such as libc-2.17.so. Whatever you do, do not update the libc.so symbolic link. Updating the libc.so symbolic link may cause all commands to fail.
~]# 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
When running the configure command, if you used --prefix=/usr/local/glibc then make install should have created the libc-<version>.so file in the /usr/local/glibc/lib directory (e.g. /usr/local/glibc/lib/libc-2.17.so). In this scenario, you may want to create a symbolic link from the library file in the /usr/local/glibc/lib directory to /usr/lib64 because some programs (such as Node.js) will look for a specific version of the GNU C Library file in the /usr/lib64 directory.
ln -s /usr/local/lib64/lib/libc-2.27.so /usr/lib64/libc-2.27.so
Did you find this article helpful?
If so, consider buying me a coffee over at