CMake hung while compiling libical

Hey @brad.king,

In my other trial, I see hang at normal shell process.

brema@hostname:~/x1/x2/x3/check/CMakeFiles> pstree -ap 11758
cmake,11758 …/check
└─(sh,11760)

Not specifically hang at gmake always.

Hello @bill.hoffman and @brad.king,

One more interesting info:
Whenever the Cmake process got to hang, I will try to debug using strace tool. That would help Cmake to come out of its hang. Just by attaching the PID and detaching it will allow the while loop to run till hit the next issue.

The next issue is while identifying the C compiler.

– The C compiler identification is GNU 4.8.3
– Detecting C compiler ABI info
– Detecting C compiler ABI info - done
– Check for working C compiler: /usr/bin/cc - skipped
– Detecting C compile features
– Detecting C compile features - done
– Looking for signal
– Looking for signal - found
– Configuring done
– Generating done
– Build files have been written to: /home/brema/x1/x2/x3/check

The C compiler identification is GNU 4.8.3

============== [[[Hang]]] =====================

Not sure what is wrong with SLES 12 and CMAKE configuration.
NAME=“SLES”
VERSION=“12”
VERSION_ID=“12”
PRETTY_NAME=“SUSE Linux Enterprise Server 12”
ID=“sles”
ANSI_COLOR=“0;32”
CPE_NAME=“cpe:/o:suse:sles:12”
SUSE Linux Enterprise Server 12 (x86_64)
VERSION = 12
PATCHLEVEL = 0
# This file is deprecated and will be removed in a future service pack or release.
# Please check /etc/os-release for details about this release.

Hello @bill.hoffman,

Seems I am having an issue with the Ninja generator on this platform. Any help appreciated

>  brema@hostname:~/x1/x2/x3/check> ls
> CMakeCache.txt  CMakeFiles  CMakeLists.txt
> 
> brema@hostname:~/x1/x2/x3/check>  cmake -G Ninja -D"CMAKE_MAKE_PROGRAM=/usr/bin/make" ../check
> -- The C compiler identification is GNU 4.8.3
> -- Check for working C compiler: /usr/bin/cc
> CMake Error:
>   The detected version of Ninja (GNU Make 4.0
> 
>   Built for x86_64-unknown-linux-gnu
> 
>   Copyright (C) 1988-2013 Free Software Foundation, Inc.
> 
>   License GPLv3+: GNU GPL version 3 or later
>   <http://gnu.org/licenses/gpl.html>
> 
>   This is free software: you are free to change and redistribute it.
> 
>   There is NO WARRANTY, to the extent permitted by law.) is less than the
>   version of Ninja required by CMake (1.3).
> 
> 
> CMake Error at /home/waddell/cmake-3.20.1/Modules/CMakeTestCCompiler.cmake:53 (try_compile):
>   Failed to generate test project build system.
> Call Stack (most recent call first):
>   CMakeLists.txt:2 (project)
> 
> 
> -- Configuring incomplete, errors occurred!
> See also "/home/brema/x1/x2/x3/check/CMakeFiles/CMakeOutput.log".
> See also "/home/brema/x1/x2/x3/check/CMakeFiles/CMakeError.log".
> 

brema@hostname:~/x1/x2/x3/check/CMakeFiles> cat CMakeError.log
Determining if the C compiler works failed with the following output:

Determining if the C compiler works failed with the following output:

You need to get rid of the above and let it find ninja. ninja must be installed on your machine.

Thanks for your reply @bill.hoffman,

I have installed ninja tool and rerun the Cmake test with Ninja build system, Seems same hang issue is observed.

Test logs:
while [ TRUE ]; do echo ; rm -rf build.ninja CMakeCache.txt CMakeFiles cmake_install.cmake ; cmake -G Ninja …/check; done

– The C compiler identification is GNU 4.8.3
– Detecting C compiler ABI info
– Detecting C compiler ABI info - done
– Check for working C compiler: /usr/bin/cc - skipped
– Detecting C compile features
– Detecting C compile features - done
– Looking for signal

brema@hostname:~/x1/x2/x3/check> ps -eaf|grep cmake
brema    31309  6310  0 13:43 pts/1    00:00:00 cmake -G Ninja ../check
brema    31354 14270  0 13:44 pts/2    00:00:00 grep --color=auto cmake
brema@hostname:~/x1/x2/x3/check> pstree -p 31309
cmake(31309)───ninja(31333)
brema@hostname:~/x1/x2/x3/check> pstree -pa 31309
cmake,31309 -G Ninja ../check
  └─(ninja,31333)

It makes me to think, Cmake hang is not related to gmake tool, since in Unix makefile target test also we have observed hang in shell process within Cmake.

Makes me think it is the compiler that is somehow hanging. It is basically doing a try_compile which creates a cmake source tree and then runs cmake on it, then runs ninja or make to see if it builds or not.

Since this does not finish, do you see files in CMakeFiles/CMakeTmp? Maybe run it till it hangs, then kill it with control-c, then cd CMakeFiles/CMakeTmp, then run ninja in that directory what is the output, does it hang?

Hello @bill.hoffman ,

I followed the same steps and ran the ninja tool in tmp directory, seems autogenerate files are missing in it.

-- The C compiler identification is GNU 4.8.3
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Looking for signal
^C
brema@pbi-18-s12:~/x1/x2/x3/check> ls
CMakeFiles  CMakeLists.txt
brema@pbi-18-s12:~/x1/x2/x3/check> cd CMakeFiles/
brema@pbi-18-s12:~/x1/x2/x3/check/CMakeFiles> ls
3.20.1  CMakeOutput.log  CMakeTmp
brema@pbi-18-s12:~/x1/x2/x3/check/CMakeFiles> cd CMakeTmp/
brema@pbi-18-s12:~/x1/x2/x3/check/CMakeFiles/CMakeTmp> ls
CMakeFiles  CMakeLists.txt
brema@pbi-18-s12:~/x1/x2/x3/check/CMakeFiles/CMakeTmp> ninja
ninja: error: loading 'build.ninja': No such file or directory
brema@pbi-18-s12:~/x1/x2/x3/check/CMakeFiles/CMakeTmp> ls
CMakeFiles  CMakeLists.txt
brema@pbi-18-s12:~/x1/x2/x3/check/CMakeFiles/CMakeTmp> cd CMakeFiles/
brema@pbi-18-s12:~/x1/x2/x3/check/CMakeFiles/CMakeTmp/CMakeFiles> ls
brema@pbi-18-s12:~/x1/x2/x3/check/CMakeFiles/CMakeTmp/CMakeFiles> cd ..
brema@pbi-18-s12:~/x1/x2/x3/check/CMakeFiles/CMakeTmp> ls
CMakeFiles  CMakeLists.txt
brema@pbi-18-s12:~/x1/x2/x3/check/CMakeFiles/CMakeTmp>

That indicates something may be going wrong with capturing SIGCHLD when the child process exits. Our signal handler writes to a pipe on which select() is waiting (along with the child output pipes). It is a common POSIX idiom for converting a signal into a selectable event.

Are you running SLES12 on bare metal or in some kind of virtualization or container environment?

Yes, I am running the test on a virtual machine.

Can you reproduce it in a docker container?

Hey @brad.king,

I ran the same test on SLEL12 docker container which is running on the Ubuntu host. I could not reproduce the hang.

But I can consistently get the hang in a virtual machine. Even I tried on another new virtual machine. I can reproduce there. Not sure what is causing this difference between the VM and docker.