当前位置: 首页 > 知识库问答 >
问题:

运行命令“bazel build tensorflow/examples/image_Retaining:Retain”时生成失败

公良鸿光
2023-03-14

我正在尝试在Ubuntu14.04 LTS上使用Python2.7构建tensorflow,没有GPU。当我在终端上运行本教程中的以下命令时:

bazel build tensorflow/examples/image_retraining:retrain

它说无法使用日志进行构建

ERROR: /home/yuan/tensorflow_source/tensorflow/tensorflow/python/BUILD:1826:1: Linking of rule '//tensorflow/python:_pywrap_tensorflow.so' failed: gcc failed: error executing command 
  (cd /home/yuan/.cache/bazel/_bazel_yuan/e5b8b6538ba16bbae5b1e0f5c26b7a12/execroot/tensorflow && \
  exec env - \
  /usr/bin/gcc -shared -o bazel-out/local-fastbuild/bin/tensorflow/python/_pywrap_tensorflow.so -Wl,--version-script tensorflow/tf_version_script.lds -pthread -Wl,-no-as-needed -B/usr/bin -B/usr/bin -pass-exit-codes '-Wl,--build-id=md5' '-Wl,--hash-style=gnu' -Wl,-S -Wl,@bazel-out/local-fastbuild/bin/tensorflow/python/_pywrap_tensorflow.so-2.params): com.google.devtools.build.lib.shell.BadExitStatusException: Process exited with status 1.
bazel-out/local-fastbuild/bin/tensorflow/core/libversion_lib.a(version_info.pic.o): In function `tf_git_version()':
version_info.cc:(.text+0x0): multiple definition of `tf_git_version()'
bazel-out/local-fastbuild/bin/tensorflow/core/libframework_internal.lo(version_info.pic.o):version_info.cc:(.text+0x0): first defined here
bazel-out/local-fastbuild/bin/tensorflow/core/libversion_lib.a(version_info.pic.o): In function `tf_compiler_version()':
version_info.cc:(.text+0xd): multiple definition of `tf_compiler_version()'
bazel-out/local-fastbuild/bin/tensorflow/core/libframework_internal.lo(version_info.pic.o):version_info.cc:(.text+0xd): first defined here
collect2: error: ld returned 1 exit status
Target //tensorflow/examples/image_retraining:retrain failed to build
INFO: Elapsed time: 52.885s, Critical Path: 34.63s

这是我的构建环境:

OS:Ubuntu14.04 LTS 64位内存12Gib
gcc版本:4.8.4
python版本:2.7.6
bazel版本:0.3.2
git版本的tensorflow源代码:v0。11.0rc0-1541-g3737ac3

有人有办法修复这个错误吗?谢谢!

共有1个答案

史烈
2023-03-14

@David谢谢你的帮助,看来我的./配置结果不如预期。

我最终通过以下步骤成功构建了

>

  • 将张量流源同步到HEAD

    快跑/重新配置,如果有任何错误,请参考此。

    再次运行build命令

    bazel build tensorflow/示例/图像再培训:再培训

    我的构建结果不会有错误。

  •  类似资料:
    • 我在我的代码中包括boost,cpprest和openssl,但它给我的错误像follow在android studio使用ndk我给了所有路径的目录和添加到程序它构建成功,但当我运行它时,它给我以下错误 我的cmakelist.txt是 android{compileSdkVersion 28 defaultConfig{applicationId“com.example.dell.cppadd

    • 问题内容: 我有两个运行Windows Server 2012的虚拟机。一个运行Jenkins,另一个运行Jenkins的构建作业之一。作业从Subversion中检出测试代码,然后在Windows批处理脚本中运行。该测试可以编译并运行,但是会失败,并显示。这些是使用Selenium和Firefox驱动程序的TestNG测试。 如果我使用完全相同的命令并从Windows命令行运行它,则测试成功。我

    • 在示例空手道测试项目中,我们有一个功能文件和一个runner类。 尝试使用下面的命令通过命令行执行测试 抛出以下错误... [信息]-------------------------------------------------------------[信息]生成失败[信息]-------------------------------------------------------------

    • 当我在命令行中运行TestNG时,抛出异常: c:\test>java org.testng.testng testng.xml线程“main”java.lang.noClassDefounderror:com/beust/jcommander/parameterexception在java.lang.class.getDeclaredMethods0(本机方法)在java.lang.class.

    • 我有一个java应用程序的Maven项目。我使用的软件版本如下:Maven 3.6.3,Java 1.8.0_241。 我在这个Maven项目中有一些junit测试,我正试图使用Maven“mvn”命令运行这些测试。当我在我的Maven项目上运行命令“mvn clean test”以运行单元测试时,我得到了下面提到的构建失败。 我在网上看了很多关于上面提到的问题,但是已经好几天没有解决这个问题了。