nrdblg

Installing multiple glibc versions on Linux

Sometimes you need an older glibc version because some application just won’t cooperate with your system’s default. Here’s how to install multiple versions side by side. 🛠️

Tested on Pop!_OS 24.04

Install build dependencies

1
2
sudo apt update
sudo apt install build-essential gawk bison

Download and compile glibc

Grab the version you need from the GNU FTP :

1
2
3
wget https://ftp.gnu.org/gnu/glibc/glibc-2.38.tar.bz2
tar -xvf glibc-2.38.tar.bz2
cd glibc-2.38

Create a separate build directory (glibc insists on this 🙄):

1
2
3
4
mkdir build && cd build
../configure --prefix=/usr/local/glibc-2.38
make -j$(nproc)
sudo make install

This takes a while. Go grab a coffee. ☕

Using the custom glibc

Point your application to the custom library:

1
2
export LD_LIBRARY_PATH=/usr/local/glibc-2.38/lib:$LD_LIBRARY_PATH
./your-stubborn-application

Or use LD_PRELOAD for a single run:

1
LD_PRELOAD=/usr/local/glibc-2.38/lib/libc.so.6 ./your-app

That’s it. Now your legacy apps can live happily alongside modern ones. 🎉

#Linux #Development #How-To