Error while using a newer version of glibc

Kaho Chan picture Kaho Chan · Dec 2, 2016 · Viewed 13.7k times · Source

I am trying to install tensorflow on a linux server where I am just a user without the root permission. And I cannot transfer files to/from it as I ssh to it through a jump server. The system is as following :

Linux THENAME_OF_SURVER 2.6.32-573.18.1.el6.x86_64 #1 SMP Tue Feb 9 22:46:17 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux

I installed the tensorflow through pip install tensorflow and a tensorflow program would display the following:

ImportError: /lib64/libc.so.6: version `GLIBC_2.16' not found

I installed a new version of glibc

git clone git://sourceware.org/git/glibc.git cd glibc git checkout --track -b local_glibc-2.16 origin/release/2.16/master mkdir build cd build ../configure --prefix=/home/MYNAME/dependency/glibc-2.16 make -j4 make install

Followed the instructions online, I changed the environment variables through:

export LD_LIBRARY_PATH=/home/MYNAME/dependency/glibc-2.16/lib

BUT this leads me to a problem: I cannot use any command. For example, I called ls and it would warn me like this:

ls: error while loading shared libraries: __vdso_time: invalid mode for dlopen(): Invalid argument

I then followed another instruction to run the command as following:

/home/MYNAME/dependency/glibc-2.16/lib/ld-linux-x86-64.so.2 --library-path /home/MYNAME/dependency/glibc-2.16/lib:$LD_LIBRARY_PATH:/path/to/gcc-5.2.0/lib64:/usr/lib64/:/usr/lib64/ ls (I do not know where to find the similar folder as gcc-5.2.0, my which gcc shows /usr/local/sbin/gcc, but it links to /usr/local/gcc-5.3.0/bin/gcc, which doesn't have a lib64 subfolder)

But then it came with the following warning:

ls: error while loading shared libraries: ls: cannot open shared object file

I know that I can use ls again by export the variable to empty. But I still cannot use the new version of glibc. Could anyone help me with how to correctly link the new glibc? Any suggestions would be appreciated!

EDIT: So the progress is as following:

  1. LD_LIBRARY_PATH=/home/MYNAME/dependency/glibc-2.16/lib python
    would result in python: error while loading shared libraries: __vdso_time: invalid mode for dlopen(): Invalid argument

  2. /home/MYNAME/dependency/glibc-2.16/lib/ld-2.16.so python
    would result in python: error while loading shared libraries: __vdso_time: invalid mode for dlopen(): Invalid argument

EDIT2 & SUMMARY:

To make Employed Russian's answer more detailed, I would paste my final solutions here.

My goal is to use tensorflow in Python on a server that I do not have the root permission. I was warned that ImportError: /lib64/libc.so.6: version 'GLIBC_2.16' not found when import tensorflow.

Based on Employed Russian's answer, I used the following to run my command:

LD_LIBRARY_PATH=/home/USERNAME/dependency/glibc-2.17/lib/:/lib64/:/usr/local/gcc-5.3.0/lib64/ /home/USERNAME/dependency/glibc-2.17/lib/ld-2.17.so /home/USERNAME/anaconda2/bin/python

Split the command into the following parts (I would use ??? to represent the paths that are different for different people.):

  1. LD_LIBRARY_PATH=
    • this part deals with dependencies
    • : means split
    • ???/glibc-2.17/lib/
    • /lib64/ and /usr/local/gcc-5.3.0/lib64/: I found these folders by find / -name 'libgcc_s.so.1' because I was
  2. /???/glibc-2.17/lib/ld-2.17.so
  3. /???/python the path of your executable. For Python, import sys; print(sys.executable) to see your Python path.

Other things:

  1. glibc-2.17 is download from gnu. I chose 2.17 because tensorflow needs 2.17 and 2.17 works fine.
  2. There is another problem of this solution. I sometimes need to call shell command in Python like os.system('ls') or os.system('python xxx.py'). But it warned me as following if I used it in its normal way: sh: error while loading shared libraries: __vdso_time: invalid mode for dlopen(): Invalid argument and I haven't found a good enough solution for this.

Answer

Employed Russian picture Employed Russian · Dec 2, 2016

export LD_LIBRARY_PATH=/home/MYNAME/dependency/glibc-2.16/lib

This answer explains why LD_LIBRARY_PATH doesn't work, and what you should do instead.

I read your post and tried ...
python: error while loading shared libraries: __vdso_time: invalid mode for dlopen(): Invalid argument

The error usually means that you have a mismatch between ld-linux and libc.so.6. They must match.

If you are using direct loader invocation via /home/MYNAME/.../ld-2.16.so, you must also arrange for /home/MYNAME/.../libc.so.6 to be loaded.

You can do that by passing --library-path ... to ld-2.16.so, or setting LD_LIBRARY_PATH appropriately.

Your command with ld-2.16 --library-path ... ls is almost correct. The thing you are missing is that ld-2.16 will not search your PATH. You need to give it full pathname: ld-2.16 --library-path ... /bin/ls.