Linux/centos Upgrade the C Basic Runtime clibc considerations (when you want to resolve a compilation problem that glibc_2.x cannot find) __linux

Source: Internet
Author: User
Tags: glibccentoslinux base runtime 2014-09-24 10:32 23013 people read comments (21) Favorites Report Category: Development environment (8) Linux (3)

Copyright NOTICE: This article is the original article of the blogger, without the permission of the blogger may not be reproduced.

Before you are ready to upgrade the GLIBC library, you should think about it,

Are you really going to upgrade glibc?

Do you know what you're doing?

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

GLIBC is the GNU Release LIBC Library, the C Run-time library. GLIBC is the most basic API in a Linux system, and almost any other runtime will rely on GLIBC. In addition to encapsulating the system services provided by the Linux operating system, GLIBC itself provides a number of other essential functional services implementations ...

In general, it doesn't say that some of the apps that run on Linux, or the products you've deployed before, are basic commands for Linux, such as CP, RM, LL, and so on.

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

For systems such as CentOS, for the sake of stability (which is debatable), there are often low versions of libraries, such as 6.5 or even 7.0 from the glibc2.12, and Ubuntu 14.04 with glibc2.19

If you upgrade the base C runtime to a too new version, it may affect the operation of the CentOS. So if you encounter CentOS Basic library problems, affecting the operation of their own programs, should be considered:

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

2. With a version of the high system to compile, such as Ubuntu, and CentOS New edition, but may need to deploy to a lower version, you can consider using a mock technology to make better installation package, the dependency into the package

3. The use of container technology, such as Docker, in the lower version of the operating system, the lightweight isolation of a virtual operating environment, adapt to your program.

Fortunately, I encountered the problem is glibc2.15 to meet the requirements of the upgrade has not found a problem, so you can refer to my method:

First look at the first case, under CentOS6.5 [plain] view plain copy $ ll/lib64/libc.so.6 lrwxrwxrwx 1 root Sep 08:29/lib 64/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 can not find the problem, so need to upgrade to at least 2.15

First of all, download the glibc 2.15 rpm installation package from the Internet, but this is not easy, because. RPM is for CentOS and Redhat, the high version installation package is very rare. You can also get a compiled file directly from another system

Libc.so.6 (corresponds to glibc 2.15 or higher), but the safest way is to download the source code in the local compile once (some people do not succeed in compiling, it can only be found elsewhere)

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

Newest to 2.20, I conservative option 2.15

For low version glibc, there are glibc-linuxthreads-2.x need to compile, refer to many online documents, but 2.15 no, so no more [plain] view plain copy 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.15           cd glibc-build-2.15         ... /glibc-2.15/configure  --prefix=/usr --disable-profile --enable-add-ons -- with-headers=/usr/include --with-binutils=/usr/bin         make     [plain] view plain copy make install  

If prompted install success, go to the shared library where glibc is located: [plain] view plain copy ll/lib64/libc*

You 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 file all point to 2.15 version.[Plain] View Plain copy-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 &Nbsp;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 get the error after make install. Here error I did not go to the careful, after the Netizen reminder, may be because there is no sudo caused, because make install is to copy files to several protected system directory.

If still not, you can look at the system at this time glibc version, refer to the practice of the beginning. If the version is not upgraded, we can only install it manually:

First make is successful, then we will find a new libc.so.6 in the build directory (/glibc-build-2.15/libc.so.6, we will find that this is actually a soft connection, real Lib file when libc.so, Output [HTML] view plain copy $ ll  libc.so.6   Lrwxrwxrwx 1 root  root 7 Sep 23 07:41 libc.so.6 -> libc.so   [HTML] view plain Copy [USR@LINUX GLIBC-BUILD-2.15]$ STRINGS LIBC.SO | GREP GLIBC    [plain] view plain copy glibc_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   glibc_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, and then to update the system's library.

Here to note that the update system in the link (my is/lib64/libc.so.6) is very easy to make mistakes, I do not know if there is no better way, is generally to delete old links, create new links

But after you delete the old links, many commands are not available, because GLIBC libraries are not in this time. This time you need to temporarily specify a glibc library, as follows (libc.so renamed to make it better to update later versions): [HTML] view plain copy [Usr@linux CP/****/ glibc-build-2.15/libc.so/lib64/libc-2.15.so [HTML] view plain copy 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:
[HTML] view plain copy $ strings/lib64/libc.so.6 | grep GLIBC [plain] view plain copy glibc_2.2.5 glibc_2.2.6 glibc_2.3 glibc_2.3.2 glibc_2.3.3. 3.4 glibc_2.4 glibc_2.5 glibc_2.6 glibc_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



The dependencies of glibc_2.15 and the following versions will not occur if the connection update succeeds and then compiles.

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.