【问题标题】:Clang and CMake on Windows - clang.exe broken, program not executableWindows 上的 Clang 和 CMake - clang.exe 损坏,程序无法执行
【发布时间】:2014-06-06 04:38:06
【问题描述】:

我已经在 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".

这可能是什么原因?是程序之间不兼容,还是缺少环境变量?

【问题讨论】:

    标签: c++ windows cmake clang


    【解决方案1】:

    您的 clang 安装已损坏/不完整,或者可能是 cmake bug。首先检查您是否能够直接使用clang(不使用cmake)编译“hello world”

    【讨论】:

      【解决方案2】:

      您需要确保使用 Visual Studio 生成器和正确的 clang 工具集

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

      我不知道cmake-gui是否有设置工具集的方法,所以在命令行上试试吧。

      cmake.exe .. -T LLVM-vs2010
      

      【讨论】:

      • 我没有安装 Visual Studio 工具集,也不打算这样做。没有另一个工具链就没有办法让它工作吗?我使用的生成器是Eclipse CTD - Unix Makefiles(使用GnuWin32-make)或Eclipse CTD - Ninja Makefiles。
      【解决方案3】:

      确保您的 sdk 方向没有一些特殊字符,例如:'(',')',''。 通过 .txt 阅读器检查日志。日志位于 .externalNativeBuild/cmake/debug/...

      【讨论】:

        【解决方案4】:

        正如link 中提到的,Windows 上的 clang 必须能够找到 link.exe。

        我使用旧的 Visual Studio Express 版本的链接器对其进行了测试,它运行良好。

        【讨论】:

          猜你喜欢
          • 1970-01-01
          • 1970-01-01
          • 2017-11-16
          • 2016-03-23
          • 2017-10-05
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 2020-08-21
          相关资源
          最近更新 更多