62

I want to install Android NDK on my CentOS 6.5 machine. But when I ran the program, it says it needs glibc 2.14 to be able to run. My CentOS 6.5 only has Glibc 2.12 installed. So I tried to update glibc by:

$ sudo yum update glibc

But after that I found the glibc version is still 2.12, not 2.14.

$ ldd --version
ldd (GNU libc) 2.12

I think glibc 2.14 may not be available on CentOS repositories. So how can I update it to glibc 2.14 on CentOS 6.5?

6
  • 2
    It's easier to upgrade to CentOS7 which contains GLibC 2.14 than it is to upgrade GLibC from 2.12 to 2.14. See Skype Call Recorder
    – eyoung100
    Dec 29, 2014 at 20:34
  • @eyoung100 I still need CentOS 6.5 rather than 7. Is there an easy way to upgrade Glibc to 2.14? Thx!
    – tonga
    Dec 29, 2014 at 20:45
  • 3
    No, see one of my other answers for why.
    – eyoung100
    Dec 29, 2014 at 20:51
  • Based on your answers, it seems that the best solution will be either upgrading to CentOS 7 or using an older version of NDK which requires glibc 2.12. Thanks for your comments.
    – tonga
    Dec 29, 2014 at 21:01
  • 1
    You could also install a CentOS7 chroot to run the NDK in.
    – derobert
    Dec 29, 2014 at 21:23

3 Answers 3

90

You cannot update glibc on Centos 6 safely. However you can install 2.14 alongside 2.12 easily, then use it to compile projects etc. Here is how:

mkdir ~/glibc_install; cd ~/glibc_install 

wget http://ftp.gnu.org/gnu/glibc/glibc-2.14.tar.gz

tar zxvf glibc-2.14.tar.gz

cd glibc-2.14

mkdir build

cd build

../configure --prefix=/opt/glibc-2.14

make -j4

sudo make install

export LD_LIBRARY_PATH="/opt/glibc-2.14/lib${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}"
10
  • 4
    Want to mention, that builing process takes 2.5 hours on slow AWS. Maybe useful for someone the next info: instruction above fixes psycopg2 issue ImportError: /lib/libc.so.6: version 'GLIBC_2.14' (I use Centos 6.5 and PostgreSQL v 9.6) Nov 8, 2016 at 2:54
  • 1
    Brilliant answer! I followed this answer exactly and it worked like a charm. Thank you
    – thonnor
    Sep 21, 2017 at 15:28
  • 5
    Can also be used for later versions; simply change "2.14" to "2.23" or whatever version you need, as highlighted by things like: /usr/local/lib/somlelib.so: undefined reference to 'somefunction@GLIBC_2.23' (the last few digits are the version). To make the compile faster, use make -j8 if you have 8 threads on your cpu etc. Mine completed in few minutes. Feb 19, 2018 at 9:09
  • 1
    Thanks man, worked as expected on CENTOS 6.10. I replaced this line sudo make install with make install while I was root, because my user was not in the sudoers file Apr 16, 2019 at 20:51
  • 2
    Beware that setting LD_LIBRARY_PATH comes with its own host of problems. It’s not an ideal solution by a long shot. Apr 23, 2019 at 13:07
9

To install glibc 2.14 in parallel, add the configure prefix:

tar zxvf glibc-2.14.tar.gz
cd glibc-2.14
mkdir build
cd build
../configure --prefix=/opt/glibc-2.14
make -j4
make install

Following this process, you'll be able to build 2.14 but you will need to tell the compiler where to look for glibc.

Below are the ways you can expose the glibc to your program.

  1. LD_LIBRARY_PATH=/opt/glibc-2.14/lib

    export LD_LIBRARY_PATH.

    The library is exposed during your current login session.

  2. You can permanently link your new glibc version like so, but please read the WARNING below:

    ln -sf /opt/glibc-2.14/glibc-2.14.so /lib/libc.so.6.

Since libc.so.6 is just a symbolic link. Executing the above command will make the link point towards the new glibc library. However this step is not recommended since there are many programs in Linux which depend on older versions and will stop working.

1
  • 3
    Be extremely careful changing the sym link, you can end up breaking a lot of things if you create a wrong sym link.
    – jhnlsn
    Nov 22, 2021 at 23:09
1

Common alternative technique. Installing GLIBC 2.14 in parallel (Intall it to the /opt directory) Then it is available to the programs which require it without breaking your core OS.

1
  • 8
    How would you do this? Download an rpm and ?
    – Ryan
    Jun 22, 2015 at 19:58

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .