CMake on MSYS2 freezes up
CMake on MSYS2 freezes up
I'm running MSYS2 on Windows 8, and having problems with CMake freezing / locking up.
Here's a minimal example:
main.cpp
:
main.cpp
#include <iostream>
int main()
std::cout << "Hello World!" << std::endl;
return 0;
CMakeLists.txt
:
CMakeLists.txt
cmake_minimum_required(VERSION 3.0.0)
project (helloworld)
add_executable(helloworld main.cpp)
If I open the MSYS2 console, go to the directory in which both of the above files are located, and execute the command
cmake .
there is no further output and the console locks up. An empty CMakeFiles folder is created, but nothing else happens. I've tried with CMake 3.10.2 and 3.2.3 and the same happens for both versions.
Below is some strace
output if at all of interest:
If I run the command
strace
strace cmake .
I get different output at different times. Sometimes the final line is something like
19 4436 [main] cmake 2320 child_copy: done
Sometimes it is something like
44 239509 [main] cmake 9820 open_shared: name cygpid.10668 n 10668, shared 0xBB0000 (wanted 0x0), h 0x344, *m 6
And sometimes the end of the output is something like
20 2735480 [main] cmake 14200 kill_pgrp: killing pid 5900, pgrp 5900, p->ctty /dev/pty0, ctty /dev/pty5
24 2735504 [main] cmake 14200 sig_send: 1 = SetNamedPipeHandleState (0x358, PIPE_NOWAIT, NULL, NULL)
16 2735520 [main] cmake 14200 sig_send: sendsig 0x358, pid 5900, signal 17, its_me 0
19 2735539 [main] cmake 14200 sig_send: Not waiting for sigcomplete. its_me 0 signal 17
24 2735563 [main] cmake 14200 sig_send: returning 0x0 from sending signal 17
23 2735586 [main] cmake 14200 _pinfo::kill: 0 = _pinfo::kill (17), pid 5900, process_state 0x4C5
20 2735606 [main] cmake 14200 kill_pgrp: killing pid 15152, pgrp 15152, p->ctty /dev/pty5, ctty /dev/pty5
3486 2739092 [main] cmake 14200 sig_send: 1 = SetNamedPipeHandleState (0x3A0, PIPE_NOWAIT, NULL, NULL)
44 2739136 [main] cmake 14200 sig_send: sendsig 0x3A0, pid 15152, signal 17, its_me 0
33 2739169 [main] cmake 14200 sig_send: Not waiting for sigcomplete. its_me 0 signal 17
27 2739196 [main] cmake 14200 sig_send: returning 0x0 from sending signal 17
25 2739221 [main] cmake 14200 _pinfo::kill: 0 = _pinfo::kill (17), pid 15152, process_state 0x61
What could be the reason for these problems?
EDIT:
The output of
cmake . --trace
is as follows, before it freezes:
Running with trace output on.
d/Dropbox/Programming/Cplusplus/workspace/Testprograms/test_cmake/CMakeLists.txt(1): cmakeminimum_required(VERSION 3.0.0 )
d/Dropbox/Programming/Cplusplus/workspace/Testprograms/test_cmake/CMakeLists.txt(2): project(helloworld )
usr/share/cmake-3.10.2/Modules/CMakeDetermineSystem.cmake(36):
if(CMAKE_HOST_UNIX )
usr/share/cmake-3.10.2/Modules/CMakeDetermineSystem.cmake(37): find_program(CMAKE_UNAME uname /bin /usr/bin /usr/local/bin )
usr/share/cmake-3.10.2/Modules/CMakeDetermineSystem.cmake(38): if(CMAKE_UNAME)
usr/share/cmake-3.10.2/Modules/CMakeDetermineSystem.cmake(39): if(CMAKE_HOST_SYSTEM_NAME STREQUAL AIX )
usr/share/cmake-3.10.2/Modules/CMakeDetermineSystem.cmake(45): else()
usr/share/cmake-3.10.2/Modules/CMakeDetermineSystem.cmake(46):
exec_program(${CMAKE_UNAME1 ARGS -r OUTPUT_VARIABLE CMAKE_HOST_SYSTEM_VERSION )
cmake --trace
strace cmake
Also, have you tried uninstalling the MSYS2 package and installing the Windows native CMake instead? I realize it's a pain to type the MSYS2 equivalent of
$(cygpath -w /cygdrive/c/path/to/directory/)
to feed the Windows version of CMake the directory C:pathtodirectory
, but this is only for testing; MSYS2 adds some patches to CMake prior to its build that may be the problem.– Chrono Kitsune
Sep 2 at 14:50
$(cygpath -w /cygdrive/c/path/to/directory/)
C:pathtodirectory
Lastly, ensure your environment is updated:
pacman -Syuu
. If it is, you might search for an existing issue or open a new one on the MSYS2 packages issue tracker on GitHub for CMake. While perhaps unrelated since MSYS2 and MINGW are fairly different (like MINGW and Cygwin), I did find this issue in the MINGW packages issue tracker. Perhaps something similar is happening to what's described there and killing cc1.exe works? It might be something to include in your own bug report.– Chrono Kitsune
Sep 2 at 15:02
pacman -Syuu
And if you've upgraded recently, you might consider downgrading something that was recently upgraded.
– Chrono Kitsune
Sep 2 at 15:10
I added the output of
cmake --trace
as an edit (yes, it still hangs). If I explicitly call Windows' CMake installation, /f/ProgramFiles/CMake/bin/cmake.exe .. -G "Unix Makefiles"
it works! I'll file a bug report. Thanks for the help!– andreasdr
Sep 3 at 7:59
cmake --trace
/f/ProgramFiles/CMake/bin/cmake.exe .. -G "Unix Makefiles"
1 Answer
1
CMake doesn't like in tree builds. Make a separate build folder.
mkdir build
cd build
cmake ..
CMake doesn't build your programs, it only creates build files. Your next step would be.
mingw32-make
Unless you have other issues, you should be able to run your program.
Mike
That doesn't work either. This time I got the error message
4 [main] cmake 16324 chi1d_info_fork::abort: F:msy532usrbinmsys—idn2—O.d11: Loaded to different address: parent(0x370000) != chi1d(0x800000)
– andreasdr
Sep 1 at 19:49
4 [main] cmake 16324 chi1d_info_fork::abort: F:msy532usrbinmsys—idn2—O.d11: Loaded to different address: parent(0x370000) != chi1d(0x800000)
1- Is that the only error? 2- Are you running MinGW or Cygwin? 3- At what stage are you getting this error?
– Michael Surette
Sep 1 at 20:02
Re 2-: it's MSYS2, a fork of Cygwin using Arch Linux's
pacman
and makepkg
packaging system, and probably a lot of other customizations.– Chrono Kitsune
Sep 2 at 15:49
pacman
makepkg
Thanks for contributing an answer to Stack Overflow!
But avoid …
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
But avoid …
To learn more, see our tips on writing great answers.
Required, but never shown
Required, but never shown
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.
What about
cmake --trace
instead ofstrace cmake
? Does it still hang?– Chrono Kitsune
Sep 2 at 14:40