tensorflow Windows链接错误

inn6fuwd  于 6个月前  发布在  Windows
关注(0)|答案(6)|浏览(82)

问题类型

构建/安装

你是否在TF nightly版本中复现了这个bug?

来源

源代码

Tensorflow版本

2.12.0

自定义代码

OS平台和发行版

Windows 10专业版

移动设备

  • 无响应*

Python版本

3.8.5 64位

Bazel版本

5.3.0

GCC/编译器版本

Visual Studio 2019

CUDA/cuDNN版本

  • 无响应*

GPU型号和内存

CPU型号

当前行为?

A bug happened!when I compile TensorFlow 2.12.0  to produce Windows C++ API files. I have tried severl times. The same erro happended. I hope you can help me,thank you

独立代码以重现问题

I used Windows 10 operating system, Visual Studio 2019 C++, Bazel 5.3.0, and TensorFlow 2.12.0 to compile Windows C++ API files. My Bazel build command is: "G:\Bazel5\Bazel --output_user_root=g:\tfoutPut4 build --config=opt --define=no_tensorflow_py_deps=true --jobs=8 --subcommands //tensorflow:tensorflow_cc.dll //tensorflow:install_headers > log.txt 2> err.txt". The compilation was successful, but the linking failed with the error message: "ERROR: G:/tensorflow/tensorflow/BUILD:1219:21: Linking tensorflow/tensorflow_cc.dll failed: (Exit 1120): link.exe failed: error executing command".

相关日志输出

ERROR: G:/tensorflow/tensorflow/BUILD:1219:21: Linking tensorflow/tensorflow_cc.dll failed: (Exit 1120): link.exe failed: error executing command 
  cd /d G:/tfoutput4/ic7qrvhc/execroot/org_tensorflow
  SET LIB=C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\ATLMFC\lib\x64;C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\lib\x64;C:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\lib\um\x64;C:\Program Files (x86)\Windows Kits\10\lib\10.0.19041.0\ucrt\x64;C:\Program Files (x86)\Windows Kits\10\lib\10.0.19041.0\um\x64
    SET PATH=C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\\Extensions\Microsoft\IntelliCode\CLI;C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\bin\HostX64\x64;C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\VC\VCPackages;C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\CommonExtensions\Microsoft\TestWindow;C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer;C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\bin\Roslyn;C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Team Tools\Performance Tools\x64;C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Team Tools\Performance Tools;C:\Program Files (x86)\Microsoft Visual Studio\Shared\Common\VSPerfCollectionTools\vs2019\\x64;C:\Program Files (x86)\Microsoft Visual Studio\Shared\Common\VSPerfCollectionTools\vs2019\;C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.8 Tools\x64\;C:\Program Files (x86)\HTML Help Workshop;C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\Tools\devinit;C:\Program Files (x86)\Windows Kits\10\bin\10.0.19041.0\x64;C:\Program Files (x86)\Windows Kits\10\bin\x64;C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\\MSBuild\Current\Bin;C:\Windows\Microsoft.NET\Framework64\v4.0.30319;C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\;C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\Tools\;;C:\Windows\system32;C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\Llvm\x64\bin;C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin;C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\CommonExtensions\Microsoft\CMake\Ninja
    SET PWD=/proc/self/cwd
    SET PYTHON_BIN_PATH=C:/ProgramData/Anaconda3/python.exe
    SET PYTHON_LIB_PATH=C:/ProgramData/Anaconda3/Lib/site-packages
    SET RUNFILES_MANIFEST_ONLY=1
    SET TEMP=C:\Users\yisir\AppData\Local\Temp
    SET TF2_BEHAVIOR=1
    SET TMP=C:\Users\yisir\AppData\Local\Temp
  C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\bin\HostX64\x64\link.exe @bazel-out/x64_windows-opt/bin/tensorflow/tensorflow_cc.dll-2.params
# Configuration: 86b0c99414660dd887a605e34d6ccaa371dc6e6122db6d3c5d156e9013ebeb17
# Execution platform: @local_execution_config_platform//:platform
INFO: Elapsed time: 8232.786s, Critical Path: 458.51s
INFO: 15506 processes: 3617 internal, 11889 local.
FAILED: Build did NOT complete successfully
FAILED: Build did NOT complete successfully

The following is an excerpt from another log file stdout-23850 int my dirctory G:/tfoutput4/ic7qrvhc/execroot/org_tensorflow/bazel-out/_tmp/actions/ :

tensorflow_cc.dll.if.exp: error LNK2001: unresolved external symbol "public: int __cdecl tensorflow::BytesList::value_size(void)const " (?value_size@BytesList@tensorflow@@QEBAHXZ)
tensorflow_cc.dll.if.exp: error LNK2001: unresolved external symbol "public: int __cdecl tensorflow::FloatList::value_size(void)const " (?value_size@FloatList@tensorflow@@QEBAHXZ)
tensorflow_cc.dll.if.exp: error LNK2001: unresolved external symbol "public: int __cdecl tensorflow::Int64List::value_size(void)const " (?value_size@Int64List@tensorflow@@QEBAHXZ)
ibtensorflow_framework.so.2.12.0.if.lib(libtensorflow_framework.so.2.12.0): error LNK2005: TF_NewBufferFromString already defined in tf_buffer.lib(tf_buffer.obj)
libtensorflow_framework.so.2.12.0.if.lib(libtensorflow_framework.so.2.12.0): error LNK2005: TF_NewTensor already defined in tf_tensor.lib(tf_tensor.obj)
libtensorflow_framework.so.2.12.0.if.lib(libtensorflow_framework.so.2.12.0): error LNK2005: TF_TensorData already defined in tf_tensor.lib(tf_tensor.obj)
Creating library bazel-out/x64_windows-opt/bin/tensorflow/tensorflow_cc.dll.if.lib and object bazel-out/x64_windows-opt/bin/tensorflow/tensorflow_cc.dll.if.exp
LINK: warning LNK4217: symbol "TFE_NewContextOptions" (defined in "c_api.lo.lib(c_api.obj)") already imported in "pass_utils.lib(utils.obj)" (function "?InitializeTFRuntime@quant@mlir@@YAPEAUTFE_Context@@XZ" (?InitializeTFRuntime@quant@mlir@@YAPEAUTFE_Context@@XZ))
LINK: warning LNK4286: symbol "TFE_NewContextOptions" (defined in "c_api.lo.lib(c_api.obj)") already imported in "tf_dialect_passes.lo.lib(constant_fold.obj)"
n8ghc7c1

n8ghc7c12#

@SuryanarayanaY,
我能够在tensorflow v2.12上复现这个问题。请参考下面的引用。

2wnc66cl

2wnc66cl3#

@mraunak, 你能看一下这个问题吗?谢谢!

nwo49xxi

nwo49xxi4#

你好,@yisir323,对于延迟的回复感到抱歉。你能在最新的提交上再次运行上述命令吗?并告诉我们你遇到的问题是什么?

nwlls2ji

nwlls2ji5#

大家好,这个问题有进展了吗?

h4cxqtbf

h4cxqtbf6#

请检查这个问题 #61226
看起来与这个类似。
在某些TensorFlow版本中,似乎tensorflow_cc目标在Windows上不受支持。

相关问题