Linux/centos upgrade C Basic Runtime CLIBC considerations (when you want to resolve a compilation problem that glibc_2.x cannot find)

Source: Internet
Author: User

Before you get ready to upgrade the GLIBC library, you need to think about it,

Are you sure you want to upgrade glibc?

Do you know what you're doing?

Http://baike.baidu.com/view/1323132.htm?fr=aladdin

GLIBC is the GNU published LIBC library, the C runtime library. GLIBC is the lowest-level API in a Linux system, and almost any other runtime relies on glibc. GLIBC In addition to encapsulating the system services provided by the Linux operating system, it also provides many other necessary functions for the implementation of the service ...

In general, not saying that some of the applications running on Linux, or the products you have deployed before, are the basic commands of many Linux, such as CP, RM, ll and so on.

Many people on the web have a painful lesson, and even after the upgrade failed the system can not re-enter after the exit.

For systems such as CentOS, for the sake of stability (this is debatable) is often a variety of library versions are very low, such as 6.5 or even 7.0 comes with the glibc2.12, and Ubuntu 14.04 with glibc2.19

Upgrading the base C runtime to a version that is too new may affect the operation of CentOS. So if you encounter the CentOS Basic library problems, affecting the operation of their own programs, you should be able to consider:

1. In the lower version of the system to compile their own products, if their own products do not need a new version of the newly supported features

2. Compile with a high-version system, such as Ubuntu, and CentOS, but may need to be deployed to a lower version, then consider making a better installation package with mock and other technologies, and putting dependencies into the package

3. Using container technology, such as Docker, in the lower version of the operating system, the lightweight isolation out of a virtual operating environment, adapted to your program.

Fortunately, I met the problem is glibc2.15 to meet the requirements of the upgrade temporarily did not find the problem, so you can refer to my method:

First look at the first situation, under CentOS6.5

$ ll/lib64/libc.so.6 lrwxrwxrwx 1 root root Sep 08:29/lib64/libc.so.6-/lib64/libc-2.12.so

    • Libc.so.6 is a soft connection, the current glibc is 2.12 version, I encountered the matter glibc_2.15 cannot find the problem, so need to upgrade to at least 2.15

First, download the glibc 2.15 rpm installation package from the Web, but this is not easy because. RPM is for CentOS and Redhat, and a high-version installation package is rare. You can also good one compiled files directly from other systems.

Libc.so.6 (corresponding to glibc 2.15 or higher), but the safest way is to download the source code in the local compilation once (some people are not successful compilation, it can only be found elsewhere)

Each version of glibc can be found from http://ftp.gnu.org/gnu/glibc/, including its plugins glibc-port

Latest to 2.20, my conservative choice of 2.15

For the low version of GLIBC, there are glibc-linuxthreads-2.x need to compile, can refer to a lot of online documents, but 2.15 no, so no

wget http://ftp.gnu.org/gnu/glibc/glibc-2.15.tar.gz wget http://ftp.gnu.org/gnu/glibc/glibc-ports-2.15.tar.gz Tar- XVF glibc-2.15.tar.gz tar-xvf glibc-ports-2.15.tar.gz mv glibc-ports-2.15 glibc-2.15/ports mkdir glibc-build-2 . glibc-build-2.15 CD. /glibc-2.15/configure--prefix=/usr--disable-profile--enable-add-ons--with-headers=/usr/include--with-binutils= /usr/bin make
Make install

If prompted to install successfully, go to the shared library where glibc is located:

ll/lib64/libc*

The

can see that 2.12 of the old library files are still in the 2.15 version of the library file, and the soft link files all point to the 2.15 version.

-rwxr-xr-x  1 root root 1921096 aug 30 02:16 /lib64/libc-2.12.so   -rwxr-xr-x  1 root root 9801632 sep 25 13:46 /lib64/ Libc-2.15.so  lrwxrwxrwx. 1 root root      18 may  19 18:51 /lib64/libcap-ng.so.0 -> libcap-ng.so.0.0.0  -rwxr-xr-x.  1 root root   18672 jun 25  2011 /lib64/libcap-ng.so.0.0.0   lrwxrwxrwx. 1 root root      14 may 19  18:51 /lib64/libcap.so.2 -> libcap.so.2.16  -rwxr-xr-x  1  root root   19016 dec  8  2011 /lib64/libcap.so.2.16   lrwxrwxrwx. 1 root root      19 may 19 18:57  /lib64/libcgroup.so.1 -> libcgroup.so.1.0.40  -rwxr-xr-x  1 root root    97016 Dec  9  2013 /lib64/libcgroup.so.1.0.40  -rwxr-xr-x   1 root root  197064 Aug 30 02:16 /lib64/libcidn-2.12.so   -rwxr-xr-x  1 root root  267972 sep 25 13:46 /lib64/ Libcidn-2.15.so  lrwxrwxrwx  1 root root      15  sep 25 13:52 /lib64/libcidn.so.1 -> libcidn-2.15.so  lrwxrwxrwx.  1 root root      17 may 19 18:51 /lib64/ libcom_err.so.2 -> libcom_err.so.2.1  -rwxr-xr-x  1 root root    17256 Nov 22  2013 /lib64/libcom_err.so.2.1  -rwxr-xr-x   1 root root   40400 aug 30 02:16 /lib64/libcrypt-2.12.so  -rwxr-xr-x   1 root root  142947 sep 25 13:46 /lib64/libcrypt-2.15.so   lrwxrwxrwx. 1 root root      22 may 19 18:57  /lib64/libcryptsetup.so.1 -> libcryptsetup.so.1.1.0  -rwxr-xr-x  1 root  root   97072 Jun 22  2012 /lib64/libcryptsetup.so.1.1.0   lrwxrwxrwx  1 root root      16 Sep 25  13:52 /lib64/libcrypt.so.1 -> libcrypt-2.15.so  lrwxrwxrwx  1 root  root      12 Sep 25 13:52 /lib64/libc.so.6 ->  libc-2.15.so

Some people will error after make install. Here error I did not go to scrutiny, after the Netizen reminds, probably because there is no sudo caused, because make install is to copy files to several protected system directory.

If not, you can check the GLIBC version of the system at this point, and refer to the beginning of the procedure. If the version is not upgraded, we can only install it manually:

First make is successful, then we will find the build directory compiled a new libc.so.6 (/glibc-build-2.15/libc.so.6, we will find this is actually a soft connection, the real Lib file when libc.so, output

$ ll libc.so.6 lrwxrwxrwx 1 root root 7 Sep 07:41 libc.so.6 libc.so[[email protected] glibc-build-2.15]$ string S libc.so | grep glibcglibc_2.2.5 glibc_2.2.6 glibc_2.3 glibc_2.3.2 glibc_2.3.3 glibc_2.3.4 glibc_2.4 GLIBC_2.5 GLIBC_2.6 GLI bc_2.7 glibc_2.8 glibc_2.9 glibc_2.10 glibc_2.11 glibc_2.12 glibc_2.13 glibc_2.14 glibc_2.15 GLIBC_PRIVATE


This is the lib we need, then go to update the system library.

Note here that updating the link in the system (my/lib64/libc.so.6) is easy to make mistakes, I don't know if there is any better way, usually delete the old link, create a new link

However, after deleting the old link, many commands are not available, because the GLIBC library is not at this time. At this point, you need to temporarily specify a glibc library, as follows (libc.so change the name so that you can differentiate between other versions that are updated later):

[email protected] CP/****/glibc-build-2.15/libc.so/lib64/libc-2.15.so
Rm-rf/lib64/libc.so.6 ld_preload=/lib64/libc-2.15.so ln-s/lib64/libc-2.15.so lib64/libc.so.6


The update connection is complete, and then:

$ strings/lib64/libc.so.6 | grep glibcglibc_2.2.5 glibc_2.2.6 glibc_2.3 glibc_2.3.2 glibc_2.3.3 glibc_2.3.4 glibc_2.4 GLIBC_2.5 GLIBC_2.6 GLI bc_2.7 glibc_2.8 glibc_2.9 glibc_2.10 glibc_2.11 glibc_2.12 glibc_2.13 glibc_2.14 glibc_2.15 GLIBC_PRIVATE

If the connection update is successful and then compiled, the dependencies of glibc_2.15 and the following versions will not appear.



Linux/centos upgrade C Basic Runtime CLIBC considerations (when you want to resolve a compilation problem that glibc_2.x cannot find)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.