簡體   English   中英

Windows 上的 Clang 和 CMake - clang.exe 損壞,程序不可執行

[英]Clang and CMake on Windows - clang.exe broken, program not executable

我已經在 Windows 上設置了 Clang 和 CMake,當在 OpenSceneGraph 項目源(配置步驟)上運行 cmake-gui 時,該過程失敗並Check for working C compiler: C:/Program Files (x86)/LLVM/bin/clang.exe -- broken

在整個輸出之后:

The C compiler identification is unknown
The CXX compiler identification is unknown
Found Eclipse version 4.3 ()
Check for working C compiler: C:/Program Files (x86)/LLVM/bin/clang.exe
Check for working C compiler: C:/Program Files (x86)/LLVM/bin/clang.exe -- broken
CMake Error at C:/Program Files (x86)/CMake/share/cmake-2.8/Modules/CMakeTestCCompiler.cmake:61 (message):
  The C compiler "C:/Program Files (x86)/LLVM/bin/clang.exe" is not able to
  compile a simple test program.

  It fails with the following output:

   Change Dir: C:/Users/Adam/Desktop/OpenSceneGraph-3.2.1-rc3/build/CMakeFiles/CMakeTmp



  Run Build Command:C:/PROGRA~2/GnuWin32/bin/make.exe
  "cmTryCompileExec2091697540/fast"

  C:/PROGRA~2/GnuWin32/bin/make.exe -f
  CMakeFiles/cmTryCompileExec2091697540.dir/build.make
  CMakeFiles/cmTryCompileExec2091697540.dir/build


  make.exe[1]: Entering directory
  `C:/Users/Adam/Desktop/OpenSceneGraph-3.2.1-rc3/build/CMakeFiles/CMakeTmp'



  "C:/Program Files (x86)/CMake/bin/cmake.exe" -E cmake_progress_report
  C:/Users/Adam/Desktop/OpenSceneGraph-3.2.1-rc3/build/CMakeFiles/CMakeTmp/CMakeFiles
  1


  "Building C object
  CMakeFiles/cmTryCompileExec2091697540.dir/testCCompiler.c.obj"


  "C:/Program Files (x86)/LLVM/bin/clang.exe" -o
  CMakeFiles/cmTryCompileExec2091697540.dir/testCCompiler.c.obj -c
  C:/Users/Adam/Desktop/OpenSceneGraph-3.2.1-rc3/build/CMakeFiles/CMakeTmp/testCCompiler.c



  clang.exe: error: unable to execute command: program not executable

  clang.exe: error: assembler (via gcc) command failed with exit code 1 (use
  -v to see invocation)

  make.exe[1]: ***
  [CMakeFiles/cmTryCompileExec2091697540.dir/testCCompiler.c.obj] Fehler 1


  make.exe[1]: Leaving directory
  `C:/Users/Adam/Desktop/OpenSceneGraph-3.2.1-rc3/build/CMakeFiles/CMakeTmp'



  make.exe: *** [cmTryCompileExec2091697540/fast] Fehler 2






  CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
  CMakeLists.txt:47 (PROJECT)


Configuring incomplete, errors occurred!
See also "C:/Users/Adam/Desktop/OpenSceneGraph-3.2.1-rc3/build/CMakeFiles/CMakeOutput.log".
See also "C:/Users/Adam/Desktop/OpenSceneGraph-3.2.1-rc3/build/CMakeFiles/CMakeError.log".

這可能是什么原因? 程序之間是否不兼容,或者是否缺少環境變量?

您的 clang 安裝已損壞/未完成,或者可能是 cmake錯誤 首先檢查您是否能夠直接使用 clang 編譯“hello world”(不使用 cmake)

您需要確保將 Visual Studio 生成器與正確的工具集用於 clang

http://public.kitware.com/Bug/view.php?id=14863

不知道cmake-gui有沒有設置工具集的方法,所以改用命令行試試。

cmake.exe .. -T LLVM-vs2010

確保您的 sdk 方向沒有一些特殊字符,例如:'(',')',' '。 通過 .txt 閱讀器檢查日志。 日志在 .externalNativeBuild/cmake/debug/...

正如此鏈接中所述,Windows 上的clang必須能夠找到link.exe

我使用舊的 Visual Studio Express 版鏈接器對其進行了測試,並且運行良好。

暫無
暫無

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

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