【问题标题】:CMake failing on simple test programCMake 在简单的测试程序上失败
【发布时间】:2019-11-02 20:19:21
【问题描述】:

我在 Xubuntu 19.10 上并试图编译一个程序。几天前它还在工作,但是在重新启动我的计算机后,由于某种原因我的build 目录消失了。我正在尝试重新制作它,但 cmake .. 上的事情失败了。我得到的错误是

-- The C compiler identification is GNU 9.2.1
-- The CXX compiler identification is GNU 9.2.1
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- broken
CMake Error at /usr/share/cmake-3.13/Modules/CMakeTestCCompiler.cmake:52 (message):
  The C compiler

"/usr/bin/cc"

  is not able to compile a simple test program.

  It fails with the following output:

Change Dir: /home/bojohnson/Documents/MagPhyxP/build/CMakeFiles/CMakeTmp

Run Build Command:"/usr/bin/gmake" "cmTC_77531/fast"
CMake Error: The source directory "/home/bojohnson/Documents/MagPhyxP/build/CMakeFiles/CMakeTmp/cmTC_77531/fast" does not exist.
Specify --help for usage, or press the help button on the CMake GUI.




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


-- Configuring incomplete, errors occurred!
See also "/home/bojohnson/Documents/MagPhyxP/build/CMakeFiles/CMakeOutput.log".
See also "/home/bojohnson/Documents/MagPhyxP/build/CMakeFiles/CMakeError.log".

我已经尝试了针对此问题找到的多个其他建议,例如 set(CMAKE_TRY_COMPILE_TARGET_TYPE "STATIC_LIBRARY")SET (CMAKE_C_COMPILER_WORKS 1)SET (CMAKE_CXX_COMPILER_WORKS 1) 但我仍然遇到同样的错误。

【问题讨论】:

    标签: ubuntu cmake compiler-errors compilation


    【解决方案1】:

    我将这些项目放在CMakeLists.txt 文件的错误部分的底部。 SET (CMAKE_C_COMPILER_WORKS 1)SET (CMAKE_CXX_COMPILER_WORKS 1) 行需要放在project() 行之前。

    【讨论】:

      猜你喜欢
      • 2019-09-11
      • 2013-01-13
      • 1970-01-01
      • 1970-01-01
      • 2020-10-29
      • 2022-01-19
      • 1970-01-01
      • 2015-08-13
      • 1970-01-01
      相关资源
      最近更新 更多