glibc version information and installation

 

Compiled on a higher version of glibc cannot run on a machine of the last version of glibc


Question: I need to find out the version of the GNU C library (glibc) on my Linux system, how can I check the glibc version on Linux?

 

The GNU C Library (glibc) is the GNU implementation of the standard C library. glibc is a key component of the GNU toolchain for use with binary tools and compilers to generate userspace applications for the target architecture.
When building from source, some Linux programs may need to link against a specific version of glibc. In this case you may want to check the installed glibc info to see if the dependencies are satisfied.
Here are a few easy ways to check the glibc version on Linux.
A simple command to check the GNU C library from the command line is given below.


Method one
$ ldd --version


Method 2
Another method is to "type" the name of the glibc library (eg, libc.so.6) on the command line and execute it just like the command.
The output will show more detailed information about the glibc library, including the glibc version and the GNU compiler used, as well as information on glibc extensions. The location of the glibc variable depends on the Linux version and processor architecture.
On Debian-based 64-bit systems:
$ /lib/x86_64-linux-gnu/libc.so.6 On
Debian-based 32-bit systems:
$ /lib/i386-linux-gnu/libc.so.6
On Red Hat 64-bit systems:
$ /lib64/libc.so.6
On Red Hat-based 32-bit systems:
$ /lib/libc.so.6


There is corresponding version number information in the output information:

server:/lib/libc.so.6
GNU C Library stable release version 2.5, by Roland McGrath et al.
Copyright (C) 2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.
Compiled by GNU CC version 4.1.2 20080704 (Red Hat 4.1.2-46).
Compiled on a Linux 2.6.9 system on 2010-03-10.
Available extensions:
        The C stubs add-on version 2.1.2.
        crypt add-on version 2.1 by Michael Glad and others
        GNU Libidn by Simon Josefsson
        GNU libio by Per Bothner
        NIS(YP)/NIS+ NSS modules 0.19 by Thorsten Kukuk
        Native POSIX Threads Library by Ulrich Drepper et al
        BIND-8.2.3-T5B
        RT using linux kernel aio
Thread-local storage support included.
For bug reporting instructions, please see:
<http://www.gnu.org/software/libc/bugs.html>.


===========================================================================================
===========================================================================================
===========================================================================================


glibc installation and compilation


Some software may require a higher version of Glibc on the system to function properly. If your Glibc is lower than the required version, you will have to upgrade your Glibc in order to run these software. You can look for compiled rpm packages or upgrade Glibc from source.

下载glibc
wget <http://ftp.gnu.org/gnu/glibc/glibc-2.7.tar.gz>

下载glibc-linuxthreads
wget <http://ftp.gnu.org/gnu/glibc/glibc-linuxthreads-2.5.tar.bz2>

 
解压
#tar -zxvf glibc-2.7.tar.gz
#cd glibc-2.7
#tar -zxvf ../glibc-linuxthreads-2.3.6.tar.gz
#cd ..
#export CFLAGS="-g -O2 -march=i486"
#./glibc-2.7/configure --prefix=/usr --disable-profile --enable-add-ons --with-headers=/usr/include --with-binutils=/usr/bin --disable-sanity-checks

#make
#make install


There are three points to pay attention to during the installation and compilation process:
1. Unzip glibc-linuxthreads to the glibc directory.
2. You cannot run configure in the current directory of glibc.
3. Add the optimization switch, export CFLAGS="-g -O2 -march=i486", otherwise there will be an error
'#error "glibc cannot be compiled without optimization"'


When the optimization switch -O2 is added in some places on the Internet (capital letter O), it is written as -02 (digital zero), so the error in 3 still occurs when copied, so please pay attention.

After installation, you can check that ls -l /lib/libc.so.6 has been upgraded

lrwxrwxrwx 1 root root 11 Nov 12 09:24 /lib/libc.so.6 -> libc-2.7.so

 

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326198161&siteId=291194637