簡體   English   中英

CMake在Windows 10上構建Tensorflow C ++錯誤:測試COMPILER_OPT_ARCH_NATIVE_SUPPORTED-失敗

[英]CMake build Tensorflow C++ on Windows 10 Error : Test COMPILER_OPT_ARCH_NATIVE_SUPPORTED - failed

我想使用CMake在Windows 10上構建Tensorflow C ++。 但是,我無法通過COMPILER_OPT_ARCH_NATIVE_SUPPORTED測試,這導致構建嘗試失敗。 這是我在tf github repo上的公開問題: https : //github.com/tensorflow/tensorflow/issues/24076 ,它沒有得到任何回應,因此我為什么要在stackoverflow上提問,希望這里有人能啟發我。 我的想法不多了。 我已經嘗試使用Python 3.5和3.6,Visual Studio 2017和2015。所有方法均未成功。

系統信息

  • 操作系統平台和發行版(例如,Linux Ubuntu 16.04):Windows 10

  • 從(源或二進制)安裝TensorFlow:源

  • TensorFlow版本:最新版本
  • Python版本:3.6
  • Bazel版本(如果從源代碼編譯):我正在使用CMake
  • GCC /編譯器版本(如果從源代碼編譯):gcc 6.30
  • CUDA / cuDNN版本:僅安裝CPU版本
  • 我也在使用Microsoft Visual Studio Community 2017版本15.9.3,btw

描述問題,我遵循https://github.com/tensorflow/tensorflow/tree/master/tensorflow/contrib/cmake中的“逐步構建Windows”。 但是,在第3步中,我似乎無法通過Performing Test COMPILER_OPT_ARCH_NATIVE_SUPPORTED ,從而導致構建過程失敗。

提供您在遇到問題之前執行的命令/步驟的確切順序

PS C:\Users\bw\tensorflow\tensorflow\contrib\cmake\build> cmake .. -A x64 -Thost=x64 -DCMAKE_BUILD_TYPE=Release `
>> -DSWIG_EXECUTABLE='C:\Program Files\swigwin-3.0.12\swig.exe' `
>> -DPYTHON_EXECUTABLE='C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python36_64\python.exe' `
>> -DPYTHON_LIBRARIES='C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python36_64\libs\python36.lib'
-- Building for: Visual Studio 15 2017
CMake Warning at CMakeLists.txt:9 (message):
  Your current cmake generator is set to use 32 bit toolset architecture.
  This may cause "compiler out of heap space" errors when building.  Consider
  using the flag -Thost=x64 when running cmake.


-- The C compiler identification is MSVC 19.16.27024.1
-- The CXX compiler identification is MSVC 19.16.27024.1
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.16.27023/bin/Hostx64/x64/cl.exe
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.16.27023/bin/Hostx64/x64/cl.exe -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.16.27023/bin/Hostx64/x64/cl.exe
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.16.27023/bin/Hostx64/x64/cl.exe -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Performing Test COMPILER_OPT_ARCH_NATIVE_SUPPORTED
-- Performing Test COMPILER_OPT_ARCH_NATIVE_SUPPORTED - Failed
-- Performing Test MSVC_OPENMP_SUPPORT
-- Performing Test MSVC_OPENMP_SUPPORT - Success
-- Found PythonInterp: C:/Program Files (x86)/Microsoft Visual Studio/Shared/Python36_64/python.exe (found version "3.6.7")
-- Found PythonLibs: optimized;C:/Program Files (x86)/Microsoft Visual Studio/Shared/Python36_64/libs/python36.lib;debug;C:/Program Files (x86)/Microsoft Visual Studio/Shared/Python36_64/libs/python36_d.lib (found version "3.6.7")
-- Found SWIG: C:/Program Files/swigwin-3.0.12/swig.exe (found version "3.0.12")
CMake Error at tf_python.cmake:811 (string):
  string sub-command REPLACE requires at least four arguments.
Call Stack (most recent call first):
  CMakeLists.txt:583 (include)


CMake Error at tf_python.cmake:812 (string):
  string sub-command REPLACE requires at least four arguments.
Call Stack (most recent call first):
  CMakeLists.txt:583 (include)


CMake Error at tf_python.cmake:813 (string):
  string sub-command REPLACE requires at least four arguments.
Call Stack (most recent call first):
  CMakeLists.txt:583 (include)


-- Configuring incomplete, errors occurred!
See also "C:/Users/bw/tensorflow/tensorflow/contrib/cmake/build/CMakeFiles/CMakeOutput.log".
See also "C:/Users/bw/tensorflow/tensorflow/contrib/cmake/build/CMakeFiles/CMakeError.log".

任何其他信息/日志

CMakeOutput.log: https ://www.dropbox.com/s/7fweyunxdbmxa1k/CMakeOutput.log ? dl =0 CMakeError.log: https ://www.dropbox.com/s/tucx0tl6346kdpd/CMakeError.log ? dl =0

指南的第一行指出:

TensorFlow不建議使用CMAKE構建。 請使用bazel為所有平台構建TF。 有關詳細信息,請參見TensorFlow安裝指南。

顯然,您需要使用一個已知可以在Windows上通過CMAKE正確構建的發行版本。 如果要構建最新的代碼,可能應該切換到推薦的構建系統。

查看此項目的CMakeLists.txt文件,可以看到Performing Test COMPILER_OPT_ARCH_NATIVE_SUPPORTED - Failed是檢查編譯器是否接受-march=native標志的步驟。 並非如此,請參閱此修復程序https://github.com/tensorflow/tensorflow/issues/8724#issuecomment-289326917

實際錯誤是由於tf_python.cmake中的腳本問題tf_python.cmake無法正確解析其中一個源文件。 在我看來,這些問題無關緊要。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM