【问题标题】:cmake loads cpu without any effectcmake加载cpu没有任何影响
【发布时间】:2014-08-16 12:36:47
【问题描述】:

最近我开始使用 cmake 而不是手动创建 make-files。此外,我使用 kdevelop 作为 IDE。所以,我用 kdevelop 创建了简单的 cmake 项目。它构建并成功执行。但问题是,当我尝试从终端运行 cmake(过程中不涉及 kdevelop)时,我看到 cmake 只是尽可能高地加载 cpu,大约半小时没有结果。我等不及了,所以我只是终止了该进程。

这是我的 cmake 文件:

project(robot)
cmake_minimum_required(VERSION 2.8)
set(CMAKE_BUILD_TYPE Debug)

include_directories(include)
add_library(mylib SHARED mylibsrc/mylib.cpp)

这是 kdevelop 开始运行 cmake 的方式:

/home/sergey/projects/project-test/build> /usr/bin/cmake -DCMAKE_BUILD_TYPE=Debug /home/sergey/projects/project-test/
-- The C compiler identification is GNU 4.7.2
-- The CXX compiler identification is GNU 4.7.2
-- Check for working C compiler: /home/sergey/bin/gcc
-- Check for working C compiler: /home/sergey/bin/gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /home/sergey/bin/c++
-- Check for working CXX compiler: /home/sergey/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Configuring done
-- Generating done
-- Build files have been written to: /home/sergey/projects/project-test/build

我尝试以相同的方式运行 cmake,但我收到的只是可能的最高 cpu 负载。

kdevelop 版本 - 4.8.4

cmake 版本 - 2.8.9

您对此有何建议?

对不起,我的英语不好。

【问题讨论】:

  • I try to run cmake in same way but all I receive is the highest possible cpu load. 任何类似-- The C compiler identification is GNU 4.7.2 的消息?

标签: cmake kdevelop4


【解决方案1】:

您可以尝试在 cmake 调用中添加 --trace 选项。问题仍然存在,但至少你应该看看是什么花了这么长时间,然后可以进一步调查。 --debug-output 选项也可能有帮助。

/usr/bin/cmake -DCMAKE_BUILD_TYPE=Debug --trace --debug-output /home/sergey/projects/project-test/

【讨论】:

  • 现在好像挂了/usr/share/cmake-2.8/Modules/CMakeDetermineCCompiler.cmake(39): GET_FILENAME_COMPONENT(CMAKE_C_COMPILER_INIT $ENV{CC} PROGRAM PROGRAM_ARGS CMAKE_C_FLAGS_ENV_INIT ) Called from: [2] /usr/share/cmake-2.8/Modules/CMakeDetermineCCompiler.cmake [1] /home/sergey/projects/project-test/CMakeLists.txt
  • 嗯,这很奇怪。您可以尝试从构建目录中删除 CMakeCache 文件或在其他地方创建一个新的构建目录并在那里使用给定的命令行调用 cmake 吗?
  • 我从一个带有空 build 目录的新仓库运行 cmake。
  • 此外,我可以说的是我在 zsh 中运行 cmake 并且它挂起。但是,当我在 bash 中运行 cmake 时,它​​运行顺利。
  • 终于弄明白了:$CC 被设置为 'gcc'(不是 'gcc',请看引号后的空格)。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2021-06-17
  • 1970-01-01
  • 2020-05-10
  • 2013-04-09
  • 2020-01-09
  • 2018-10-28
  • 1970-01-01
相关资源
最近更新 更多