本文介绍了使用较新版本的 glibc 时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在 linux 服务器上安装 tensorflow,我只是一个没有 root 权限的用户.当我通过跳转服务器 ssh 到它时,我无法向它传输文件/从它传输文件.系统如下:

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

我通过 pip install tensorflow 安装了 tensorflow,tensorflow 程序将显示以下内容:

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

我安装了新版本的 glibc

I installed a new version of glibc

git clone git://sourceware.org/git/glibc.gitcd glibcgit checkout --track -b local_glibc-2.16 origin/release/2.16/mastermkdir 构建光盘构建../configure --prefix=/home/MYNAME/dependency/glibc-2.16制作 -j4进行安装

按照网上的说明,我通过以下方式更改了环境变量:

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

导出 LD_LIBRARY_PATH=/home/MYNAME/dependency/glibc-2.16/lib

但这给我带来了一个问题:我不能使用任何命令.例如,我调用了 ls,它会像这样警告我:

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:加载共享库时出错:__vdso_time:dlopen() 的无效模式:无效参数

然后我按照另一条指令运行命令如下:

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(我不知道在哪里可以找到与 gcc-5.2.0 类似的文件夹,我的 which gcc 显示 /usr/local/sbin/gcc>,但它链接到 /usr/local/gcc-5.3.0/bin/gcc,它没有 lib64 子文件夹)

/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:加载共享库时出错:ls:无法打开共享对象文件

我知道我可以通过将变量导出为空来再次使用 ls.但是我还是不能使用新版本的glibc.任何人都可以帮助我如何正确链接新的 glibc?任何建议将不胜感激!

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!

所以进度如下:

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

/home/MYNAME/dependency/glibc-2.16/lib/ld-2.16.so python
会导致 python: error while loading shared libraries: __vdso_time: invalid mode for dlopen(): Invalid argument

EDIT2 &总结:

EDIT2 & SUMMARY:

为了使 Employed Russian 的回答更加详细,我将在这里粘贴我的最终解决方案.

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

我的目标是在我没有 root 权限的服务器上使用 Python 中的 tensorflow.我被警告 ImportError:/lib64/libc.so.6: version 'GLIBC_2.16' not found 在导入 tensorflow 时.

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.

根据 Employed Russian 的回答,我使用以下命令来运行我的命令:

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=
    • 这部分处理依赖
    • : 表示拆分
    • ???/glibc-2.17/lib/
    • /lib64//usr/local/gcc-5.3.0/lib64/:我通过 find/-name 'libgcc_s.so.1' 因为我是
  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

其他:

  1. glibc-2.17 是从 gnu 下载的.我选择了 2.17,因为 tensorflow 需要 2.17,而 2.17 工作正常.
  2. 此解决方案还有另一个问题.我有时需要在 Python 中调用 shell 命令,例如 os.system('ls')os.system('python xxx.py').但是,如果我以正常方式使用它,它会警告我如下:sh: error while loading shared libraries: __vdso_time: invalid mode for dlopen(): Invalid argument 我还没有找到足够好的对此的解决方案.
  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.

推荐答案

这个答案解释了为什么 LD_LIBRARY_PATH 不起作用,以及你应该怎么做.

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

我阅读了您的帖子并尝试了...
python:加载共享库时出错:__vdso_time:dlopen()的无效模式:参数无效

该错误通常意味着您在ld-linuxlibc.so.6 之间存在不匹配.它们必须匹配.

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

如果您通过 /home/MYNAME/.../ld-2.16.so 使用直接加载器调用,您还必须安排 /home/MYNAME/.../libc.so.6 要加载.

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.

您可以通过将 --library-path ... 传递给 ld-2.16.so 或适当地设置 LD_LIBRARY_PATH 来实现.

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

您使用 ld-2.16 --library-path ... ls 的命令几乎是正确的.您缺少的是 ld-2.16不会搜索您的 PATH.你需要给它完整路径名:ld-2.16 --library-path .../bin/ls.

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.

这篇关于使用较新版本的 glibc 时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-29 14:34
查看更多