在Ubuntu 16.04 w/GPU上构建TensorFlow源代码:`GLIBCXX_3.4.20'找不到

问题描述:

我在Ubuntu 16.04上,并且试图根据this从源代码构建支持GPU的TensorFlow。一切工作正常,直到“构建TensorFlow”步骤,其中我执行:在Ubuntu 16.04 w/GPU上构建TensorFlow源代码:`GLIBCXX_3.4.20'找不到

bazel build -c opt --config=cuda //tensorflow/tools/pip_package:build_pip_package 

编译命中误差与输出:

ERROR: /home/thomas/tensorflow/tensorflow/core/BUILD:978:28: Executing genrule //tensorflow/core:proto_text_srcs_all failed: bash failed: error executing command /bin/bash -c ... (remaining 1 argument(s) skipped): com.google.devtools.build.lib.shell.BadExitStatusException: Process exited with status 1. 
bazel-out/host/bin/tensorflow/tools/proto_text/gen_proto_text_functions: /home/thomas/anaconda2/lib/libstdc++.so.6: version `GLIBCXX_3.4.20' not found (required by bazel-out/host/bin/tensorflow/tools/proto_text/gen_proto_text_functions) 
bazel-out/host/bin/tensorflow/tools/proto_text/gen_proto_text_functions: /home/thomas/anaconda2/lib/libstdc++.so.6: version `CXXABI_1.3.8' not found (required by bazel-out/host/bin/tensorflow/tools/proto_text/gen_proto_text_functions) 
bazel-out/host/bin/tensorflow/tools/proto_text/gen_proto_text_functions: /home/thomas/anaconda2/lib/libstdc++.so.6: version `GLIBCXX_3.4.21' not found (required by bazel-out/host/bin/tensorflow/tools/proto_text/gen_proto_text_functions) 
Target //tensorflow/tools/pip_package:build_pip_package failed to build 
Use --verbose_failures to see the command lines of failed build steps. 

我的怀疑是错误有事情做与蟒蛇因为bazel似乎在从〜/ anaconda2/lib中寻找libstdC++。

此命令似乎解决我的问题:

conda install libgcc 

here

编辑:费曼27的解决方案似乎更清洁,先试一下。

有同样的问题。这些步骤已经解决了这个问题对我来说(根,加sudo需要时):

  1. 获取最新的libstdC++提供6(可能不需要):

    add-apt-repository ppa:ubuntu-toolchain-r/test apt-get update apt-get upgrade

  2. 更新的符号链接中ananconda,我做到了在蟒蛇我python2 ENV,也许你需要直接做在〜/蟒蛇/ lib目录下:

    cd ~/anaconda2/envs/python2/lib mv libstdc++.so libstdc++.so.backup mv libstdc++.so.6 libstdc++.so.6.backup ln -s /usr/lib/x86_64-linux-gnu/libstdc++.so.6 libstdc++.so ln -s /usr/lib/x86_64-linux-gnu/libstdc++.so.6 libstdc++.so.6

+0

重新读你的问题,我意识到我得到的错误只是当试图在python中导入tensorflow,而不是在安装时(我昨天做过,不记得这样的错误)。无论如何,我认为这些步骤值​​得一试 – florentbuisson

+0

对我来说,它帮助设置库路径指向Anaconda库文件夹:LD_LIBRARY_PATH = $ HOME/anaconda2/lib:$ LD_LIBRARY_PATH或LD_LIBRARY_PATH = $ HOME/anaconda3/lib:$ LD_LIBRARY_PATH为anaconda3 reprasctively – Max