Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/tensorflow/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
CROSSTOOL中的tensorflow链接器_标志_Tensorflow_Installation_Linker_Bazel - Fatal编程技术网

CROSSTOOL中的tensorflow链接器_标志

CROSSTOOL中的tensorflow链接器_标志,tensorflow,installation,linker,bazel,Tensorflow,Installation,Linker,Bazel,我正在使用Tensorflow 1.1.0、gcc 5.2.0和bazel 0.4.5 当我这样做时: ./configure bazel build --verbose_failures --config=opt //tensorflow/tools/pip_package:build_pip_package /配置 bazel构建——详细的失败——config=opt//tensorflow/tools/pip\u包:构建pip\u包 我收到以下错误消息: ERROR: /remot

我正在使用Tensorflow 1.1.0、gcc 5.2.0和bazel 0.4.5 当我这样做时:

./configure bazel build --verbose_failures --config=opt //tensorflow/tools/pip_package:build_pip_package /配置 bazel构建——详细的失败——config=opt//tensorflow/tools/pip\u包:构建pip\u包 我收到以下错误消息:

ERROR: /remote/us03home4/rogerlo/.cache/bazel/_bazel_rogerlo/c6e718933b1d81ab029d890c5eecbc01/external/protobuf/BUILD:67 9:1: null failed: protoc failed: error executing command (cd /remote/us03home4/rogerlo/.cache/bazel/_bazel_rogerlo/c6e718933b1d81ab029d890c5eecbc01/execroot/tensorflow && \ exec env - \ bazel-out/host/bin/external/protobuf/protoc '--python_out=bazel-out/local-opt/genfiles/external/protobuf/python' -Iexternal/protobuf/python -Ibazel-out/local-opt/genfiles/external/protobuf/python bazel-out/local-opt/genfiles/external/protobuf/python/google/protobuf/any.proto bazel-out/local-opt/genfiles/external/protobuf/python/google/protobuf/api.proto bazel-out/local-opt/genfiles/external/protobuf/python/google/protobuf/compiler/plugin.proto bazel-out/local-opt/genfiles/external/protobuf/python/google/protobuf/descriptor.proto bazel-out/local-opt/genfiles/external/protobuf/python/google/protobuf/duration.proto bazel-out/local-opt/genfiles/external/protobuf/python/google/protobuf/empty.proto bazel-out/local-opt/genfiles/external/protobuf/python/google/protobuf/field_mask.proto bazel-out/local-opt/genfiles/external/protobuf/python/google/protobuf/source_context.proto bazel-out/local-opt/genfiles/external/protobuf/python/google/protobuf/struct.proto bazel-out/local-opt/genfiles/external/protobuf/python/google/protobuf/timestamp.proto bazel-out/local-opt/genfiles/external/protobuf/python/google/protobuf/type.proto bazel-out/local-opt/genfiles/external/protobuf/python/google/protobuf/wrappers.proto): com.google.devtools.build.lib.shell.BadExitStatusException: Process exited with status 1. bazel-out/host/bin/external/protobuf/protoc: /usr/lib64/libstdc++.so.6: version `GLIBCXX_3.4.20' not found (required by bazel-out/host/bin/external/protobuf/protoc) bazel-out/host/bin/external/protobuf/protoc: /usr/lib64/libstdc++.so.6: version `CXXABI_1.3.8' not found (required by bazel-out/host/bin/external/protobuf/protoc) bazel-out/host/bin/external/protobuf/protoc: /usr/lib64/libstdc++.so.6: version `GLIBCXX_3.4.18' not found (required by bazel-out/host/bin/external/protobuf/protoc) bazel-out/host/bin/external/protobuf/protoc: /usr/lib64/libstdc++.so.6: version `GLIBCXX_3.4.21' not found (required by bazel-out/host/bin/external/protobuf/protoc) ____Building complete. Target //tensorflow/tools/pip_package:build_pip_package failed to build ____Elapsed time: 101.992s, Critical Path: 54.24s make: *** [tensorflow] Error 1 错误:/remote/us03home4/rogerlo/.cache/bazel/_bazel_rogerlo/c6e718933b1d81ab029d890c5eecbc01/external/protobuf/BUILD:67 9:1:null失败:协议失败:执行命令时出错 (cd/remote/us03home4/rogerlo/.cache/bazel/_bazel_rogerlo/c6e718933b1d81ab029d890c5eecbc01/execroot/tensorflow&&\ 行政环境\ bazel out/host/bin/external/protobuf/protoc'-python_out=bazel out/local opt/genfiles/external/protobuf/python-Ibazel out/local opt/genfiles/external/protobuf/python bazel out/local opt/genfiles/external/protobuf/python/google/protobuf/any.protobazel out/local opt/genfiles/genfiles/external/protobuf/external/protobuf/protobuf/api.proto bazel out/local opt/genfiles/external/protobuf/python/google/protobuf/compiler/plugin.proto bazel out/local opt/genfiles/external/protobuf/python/descriptor.proto bazel out/local opt/genfiles/external/protobuf/python/python/google/protobuf/empty.proto bazel out/local opt/genfiles/external/protobuf/python/google/protobuf/field_mask.proto bazel out/local opt/genfiles/external/protobuf/python/source_context.proto bazel out/local opt/genfiles/external/protobuf/python/protobuf/python/struct.protobazel out/local opt/genfiles/external/protobuf/python/python/protobuf/timestamp.proto bazel out/local opt/genfiles/external/protobuf/python/google/protobuf/type.proto bazel out/local opt/genfiles/external/protobuf/python/google/protobuf/wrappers.proto):com.google.devtools.build.lib.shell.badexitstatuseException:进程退出,状态为1。 bazel out/host/bin/external/protobuf/protoc:/usr/lib64/libstdc++.so.6:找不到版本'GLIBCXX_3.4.20'(bazel out/host/bin/external/protobuf/protoc所需) bazel out/host/bin/external/protobuf/protoc:/usr/lib64/libstdc++.so.6:找不到版本“CXXABI_1.3.8”(bazel out/host/bin/external/protobuf/protoc需要) bazel out/host/bin/external/protobuf/protoc:/usr/lib64/libstdc++.so.6:找不到版本'GLIBCXX_3.4.18'(bazel out/host/bin/external/protobuf/protoc所需) bazel out/host/bin/external/protobuf/protoc:/usr/lib64/libstdc++.so.6:找不到版本'GLIBCXX_3.4.21'(bazel out/host/bin/external/protobuf/protoc所需) ____大楼完工了。 目标//tensorflow/tools/pip\u包:生成\u pip\u包未能生成 ____运行时间:101.992s,关键路径:54.24s make:**[tensorflow]错误1 但如果我加上这一行:

linker_flag: "-Wl,-rpath,/depot/gcc-5.2.0/lib64" 链接器_标志:“-Wl,-rpath,/depot/gcc-5.2.0/lib64” 归档

$TENSORFLOW_ROOT/bazel-tensorflow/external/local_config_cc/CROSSTOOL $TENSORFLOW\u ROOT/bazel TENSORFLOW/external/local\u config\u cc/CROSSTOOL 构建将通过

我想知道是否可以从配置文件或其他地方配置链接器_标志

我确实将它添加到构建选项中,但它不起作用

bazel build --verbose_failures --config=opt --linkopt="-Wl,-rpath,/depot/gcc-5.2.0/lib6 4" //tensorflow/tools/pip_package:build_pip_package bazel构建——详细_失败——config=opt--linkopt=“-Wl,-rpath,/depot/gcc-5.2.0/lib6 4”//tensorflow/tools/pip\u包:构建pip\u包 编辑:添加了bazel版本

解决方案

  • 将链接器选项添加到Bazel的配置中
  • 重新编译Bazel
  • 用重新编译的Bazel编译Tensorflow将通过
  • 调查

    目标由外部crosstool构建,因此--linkopt无法工作。根据Bazel官员的说法,外部crosstool(C++)的配置是自动检测的。它指出了问题所在

    链接器标志rpath由$LD\u LIBRARY\u PATH计算。也就是说,如果在$LD_library_PATH中定义了一些库路径,那么Bazel将在linker_标志中生成它们的rpath

    但由于[issue#2099](github.com/bazelbuild/bazel/issues/2099)的原因,这种依赖关系被删除了

    因此,在[v0.4.5](github.com/bazelbuild/bazel/blob/0.4.5/tools/cpp/cc#u configure.bzl#L250)中设置$LD#u LIBRARY#PATH不起作用

    但是,我还没有弄清楚如何正确地执行(设置env_操作或其他)。因此,快速解决方案是在配置文件中对其进行硬编码

    (请原谅我上面那些难看的超链接。我的声誉不足以在一篇文章中拥有超过2个链接。)

    [将我的答案复制到这里]

    解决方案

  • 将链接器选项添加到Bazel的配置中
  • 重新编译Bazel
  • 用重新编译的Bazel编译Tensorflow将通过
  • 调查

    目标由外部crosstool构建,因此--linkopt无法工作。根据Bazel官员的说法,外部crosstool(C++)的配置是自动检测的。它指出了问题所在

    链接器标志rpath由$LD\u LIBRARY\u PATH计算。也就是说,如果在$LD_library_PATH中定义了一些库路径,那么Bazel将在linker_标志中生成它们的rpath

    但由于[issue#2099](github.com/bazelbuild/bazel/issues/2099)的原因,这种依赖关系被删除了

    因此,在[v0.4.5](github.com/bazelbuild/bazel/blob/0.4.5/tools/cpp/cc#u configure.bzl#L250)中设置$LD#u LIBRARY#PATH不起作用

    但是,我还没有弄清楚如何正确地执行(设置env_操作或其他)。因此,快速解决方案是在配置文件中对其进行硬编码


    (请原谅我上面那些难看的超链接。我的名声不足以在一篇文章中包含2个以上的链接。)

    将标志添加为--linkopt无效?它应该(在我的小测试用例中也是如此)。是否将该标志添加到链接命令行?您可以使用-s标志检查Bazel发出的各个命令行。@mhlopko,否--linkopt对我不起作用,因为目标是由外部crosstool生成的。我将在原始帖子中更新我的解决方案。--linkopt应该仍然有效,即使目标是由自动生成的crosstool构建的。你能复制吗?我会的