wget http://ftp.gnu.org/pub/gnu/glibc/glibc-2.27.tar.xz
tar -xvf glibc-2.27.tar.xz
cd glibc-2.27
mkdir build
cd build
../configure --prefix=/root/glibc_build --with-headers=/usr/include --with-binutils=/usr/bin --enable-obsolete-nsl
make -j10
make install
mkdir /lib/x86_64-linux-gnu
ln -s /opt/work/glibc-2.27/build/math/libm.so.6 /lib/x86_64-linux-gnu/libm.so.6
#check
strings /lib/x86_64-linux-gnu/libm.so.6 | grep GLIBC_
ldd --version
常见问题
1./usr/bin/perl scripts/test-installation.pl /tmp/glibc-2.31/build/
/usr/bin/ld: cannot find -lnss_test2
add $name ne “nss_test2”
vim glibc-2.27/scripts/test-installation.pl
next if ($build_mathvec == 0 && $name eq "mvec");
if ($name ne "nss_ldap" && $name ne "db1"
&& $name ne "thread_db"
&& $name ne "nss_test1" && $name ne "nss_test2" && $name ne "libgcc_s") {
- undefined reference to ‘_nsl_default_nss@GLIBC_PRIVATE’
add --enable-obsolete-nsl
../configure --prefix=/root/glibc_build --with-headers=/usr/include --with-binutils=/usr/bin --enable-obsolete-nsl
make -j10
make install
3./opt/work/glibc-2.27/build/elf/ldconfig: Warning: ignoring configuration file that cannot be opened: /root/glibc_build/etc/ld.so.conf: No such file or directory
find / -name ld.so.conf
cp /etc/ld.so.conf /root/glibc_build/etc/