【问题标题】:Building TensorFlow from source on Ubuntu 16.04 w/ GPU: `GLIBCXX_3.4.20' not found在带有 GPU 的 Ubuntu 16.04 上从源代码构建 TensorFlow:未找到“GLIBCXX_3.4.20”
【发布时间】:2016-09-27 14:26:55
【问题描述】:

我在 Ubuntu 16.04 上,正在尝试根据 this 从源代码构建支持 GPU 的 TensorFlow。一切正常,直到我执行“构建 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。

【问题讨论】:

    标签: ubuntu installation tensorflow anaconda bazel


    【解决方案1】:

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

    conda install libgcc
    

    来自here

    【讨论】:

      【解决方案2】:

      编辑:Feynman27 的解决方案似乎更干净,请先尝试。

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

      1. 获取可用的最新 libstdc++ 6(可能不需要):

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

      2. 更新 anaconda 中的符号链接,我是在 anaconda 的 python2 环境中完成的,也许你需要直接在 ~/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

      【讨论】:

      • 重读你的问题,我意识到我得到的错误只是在尝试在 python 中导入 tensorflow 时,而不是在安装时(我昨天做过,不记得这样的错误)。无论如何,我认为这些步骤值​​得一试
      • 对我来说,它有助于设置库路径以指向 Anacondas 库文件夹:LD_LIBRARY_PATH=$HOME/anaconda2/lib:$LD_LIBRARY_PATH 或 LD_LIBRARY_PATH=$HOME/anaconda3/lib:$LD_LIBRARY_PATH 分别用于 anaconda3
      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-04-28
      • 2016-11-19
      • 2017-04-25
      • 1970-01-01
      相关资源
      最近更新 更多