首页 文章

在Ubuntu 16.04上使用GPU Build TensorFlow:找不到`GLIBCXX_3.4.20'

提问于
浏览
3

我正在使用Ubuntu 16.04,并且正在尝试使用来自源的GPU支持构建TensorFlow,根据this . 一切正常,直到我执行的"Build TensorFlow"步骤:

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.

我怀疑这个错误与anaconda有关,因为bazel似乎在〜/ anaconda2 / lib中寻找libstdc .so .

2 回答

  • 9

    这个命令似乎解决了我的问题:

    conda install libgcc
    

    来自here .

  • 3

    编辑:Feynman27的解决方案看起来更干净,先试试吧 .

    有同样的问题 . 这些步骤已经为我解决了(root,需要时添加sudo):

    • 获取最新的libstdc 6(可能不需要):

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

    • 更新ananconda中的符号链接,我是在anaconda的python2 env中完成的,也许你需要在〜/ anaconda / 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

相关问题