Upgrading glibc on CentOS 6 to Version 2.14

centos 6 glibc upgradeglibc 2.14 installationandroid sdk environmentlinux system library updateglibc locale fix
Published·Modified·

Background

A test environment running CentOS 6 requires setting up an Android compilation environment. However, the Android SDK requires a minimum glibc version of 2.14, while CentOS 6 defaults to version 2.12. This article records the glibc upgrade process. Please back up your server before upgrading; this operation is not recommended for production environments.

Compile glibc 2.14

To check the system glibc version, use the following command:

strings /lib64/libc.so.6 | grep GLIBC_

Next, download glibc 2.14 and proceed with the upgrade:

# Download source package
wget http://ftp.gnu.org/gnu/glibc/glibc-2.14.tar.gz
# Extract
tar -xvf glibc-2.14.tar.gz
# Enter source directory
cd glibc-2.14
# Create build directory and enter
mkdir build && cd build
# Compile glibc
../configure --prefix=/usr/local/glibc-2.14
make && make install

Modify Symbolic Links

# Remove the original symbolic link
rm -rf /lib64/libc.so.6
# Create a new symbolic link
ln -s /usr/local/glibc-2.14/lib/libc-2.14.so /lib64/libc.so.6
# If system commands become unavailable, execute:
LD_PRELOAD=/usr/local/glibc-2.14/lib/libc-2.14.so ln -s /usr/local/glibc-2.14/lib/libc-2.14.so /lib64/libc.so.6
# If the update fails, execute the rollback:
LD_PRELOAD=/lib64/libc-2.12.so ln -s /lib64/libc-2.12.so /lib64/libc.so.6
# Fix Chinese character display issues after upgrade
cp /usr/lib/locale/locale-archive /usr/local/glibc-2.14/lib/locale/locale-archive
# Fix incorrect timezone issues
ln -sf /etc/localtime /usr/local/glibc-2.14/etc/localtime

Conclusion

glibc is a system-level dependency library. Please ensure proper backups are made before upgrading. Upgrading carries risks; users are responsible for any errors that occur during the process. This article references the following resources: