2016-09-27 143 views
3

我在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++。

回答

8

此命令似乎解決我的問題:

conda install libgcc 

here

3

編輯:費曼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

相關問題