0

Recently I've started using cmake instead of creating make-files manually. Moreover I use kdevelop as an IDE. So, I created simple cmake project with kdevelop. It builds and executes successfully. But the thing is that when I try to run cmake from terminal (without kdevelop involved in the process) I see that cmake just loads the cpu as high as possible and there is no result for about half an hour. I couldn't wait more so I've just kill the process.

Here is my cmake file:

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

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

Here is how kdevelop starts runs 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

I try to run cmake in same way but all I receive is the highest possible cpu load.

kdevelop version - 4.8.4

cmake version - 2.8.9

Can you advice anything about that?

Sorry for my broken English.

Sergey Kanaev
  • 570
  • 5
  • 18
  • `I try to run cmake in same way but all I receive is the highest possible cpu load.` any messages like `-- The C compiler identification is GNU 4.7.2`? –  Aug 23 '14 at 10:46

1 Answers1

2

You can try adding the --trace option to the cmake call. The problem will still exist, but at least you should see then what is taking so long and can then further investigate. The --debug-output option might also help.

/usr/bin/cmake -DCMAKE_BUILD_TYPE=Debug --trace --debug-output /home/sergey/projects/project-test/
Phil Be
  • 524
  • 4
  • 5
  • Looks like it hangs at this point `/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` – Sergey Kanaev Aug 17 '14 at 09:10
  • 1
    Hm, thats weird. Can you try to remove the CMakeCache file from your build directory or create a new build dir somewhere else and call cmake with the given command line there? – Phil Be Aug 17 '14 at 09:36
  • I run cmake from a fresh repo with empty `build` directory. – Sergey Kanaev Aug 20 '14 at 17:48
  • Moreover what I can say is that I run cmake within zsh and it hangs. However, when I run cmake within bash it runs smoothly. – Sergey Kanaev Sep 25 '14 at 18:36
  • Finally, figured it out: $CC was set to ' gcc' (not 'gcc', see the space after a quote). – Sergey Kanaev Sep 25 '14 at 19:55