# CMake hung while compiling libical

**URL:** https://discourse.cmake.org/t/cmake-hung-while-compiling-libical/3018
**Category:** Usage
**Tags:** os:linux
**Created:** [March 25, 2021, 10:33am UTC](https://discourse.cmake.org/t/cmake-hung-while-compiling-libical/3018 "2021-03-25T10:33:10Z")
**Posts on this page:** 20
**Page:** 1

<div class="post-metadata">

### Author: ![prakashcv13](https://discourse.cmake.org/user_avatar/discourse.cmake.org/prakashcv13/32/1320_2.png) [@prakashcv13](https://discourse.cmake.org/u/prakashcv13)
#### Post date: [March 25, 2021, 10:33am UTC](https://discourse.cmake.org/t/cmake-hung-while-compiling-libical/3018/1 "2021-03-25T10:33:10Z")

</div>

Hi All,

While compiling libical using CMake on SLES12 - we see that CMake gets hung.  
CMake details -

# cmake --version

cmake **version 3.5.2**

On cranking gdb to CMake, we see the below backtrace.  
(gdb) bt  
#0 0x00007fe49d392a43 in \_\_select\_nocancel () from /lib64/libc.so.6  
#1 0x0000000000ab5c5a in kwsysProcessWaitForPipe ()  
#2 0x0000000000ab5780 in cmsysProcess\_WaitForData ()  
#3 0x000000000083b02d in cmSystemTools::RunSingleCommand(std::vector\<std::string, std::allocator\< std::string\> \> const&, std::string\*, std::string\*, int\*, char const\*, cmSystemTools::OutputOption, double) ()  
#4 0x0000000000a05e07 in cmGlobalGenerator::Build(std::string const&, std::string const&, std::string const&, std::string const&, std::string&, std::string const&, std::string const&, bool, bool, bool, double, cmSystemTools::OutputOption, std::vector\<std::string, std::allocator\< std::string\> \> const&) ()  
#5 0x0000000000a05756 in cmGlobalGenerator::TryCompile(std::string const&, std::string const&, std::string const&, std::string const&, bool, std::string&, cmMakefile\*) ()  
#6 0x00000000007dc3f4 in cmMakefile::TryCompile(std::string const&, std::string const&, std::string const&, std::string const&, bool, std::vector\<std::string, std::allocator\< std::string\> \> const\*, std::string&) ()  
#7 0x00000000008a806c in cmCoreTryCompile::TryCompileCode(std::vector\<std::string, std::allocator\< std::string\> \> const&) ()  
#8 0x0000000000919bcc in cmTryCompileCommand::InitialPass(std::vector\<std::string, std::allocator\< std::string\> \> const&, cmExecutionStatus&) ()  
#9 0x00000000008d57e1 in cmCommand::InvokeInitialPass(std::vector\<cmListFileArgument, std::allocator \> const&, cmExecutionStatus&) ()  
#10 0x00000000007cd8bf in cmMakefile::ExecuteCommand(cmListFileFunction const&, cmExecutionStatus&) ()  
#11 0x00000000008faa3f in cmIfFunctionBlocker::IsFunctionBlocked(cmListFileFunction const&, cmMakefile&, cmExecutionStatus&) ()  
#12 0x00000000007daa64 in cmMakefile::IsFunctionBlocked(cmListFileFunction const&, cmExecutionStatus&) ()  
#13 0x00000000007cd733 in cmMakefile::ExecuteCommand(cmListFileFunction const&, cmExecutionStatus&) ()  
#14 0x000000000090871a in cmMacroHelperCommand::InvokeInitialPass(std::vector\<cmListFileArgument, std::allocator \> const&, cmExecutionStatus&) ()  
#15 0x00000000007cd8bf in cmMakefile::ExecuteCommand(cmListFileFunction const&, cmExecutionStatus&) ()  
#16 0x000000000090871a in cmMacroHelperCommand::InvokeInitialPass(std::vector\<cmListFileArgument, std::allocator \> const&, cmExecutionStatus&) ()  
#17 0x00000000007cd8bf in cmMakefile::ExecuteCommand(cmListFileFunction const&, cmExecutionStatus&) ()  
#18 0x00000000008faa3f in cmIfFunctionBlocker::IsFunctionBlocked(cmListFileFunction const&, cmMakefile&, cmExecutionStatus&) ()  
#19 0x00000000007daa64 in cmMakefile::IsFunctionBlocked(cmListFileFunction const&, cmExecutionStatus&) ()  
#20 0x00000000007cd733 in cmMakefile::ExecuteCommand(cmListFileFunction const&, cmExecutionStatus&) ()  
#21 0x00000000007ceb98 in cmMakefile::ReadListFile(cmListFile const&, std::string const&) ()  
#22 0x00000000007d36a2 in cmMakefile::Configure() ()  
#23 0x0000000000a01fcd in cmGlobalGenerator::Configure() ()  
#24 0x0000000000a21fb2 in cmGlobalUnixMakefileGenerator3::Configure() ()  
#25 0x00000000008625f4 in cmake::ActualConfigure() ()  
#26 0x000000000086175f in cmake::Configure() ()  
#27 0x000000000086333b in cmake::Run(std::vector\<std::string, std::allocatorstd::string \> const&, bool) ()  
#28 0x000000000078a6d2 in do\_cmake(int, char const\* const\*) ()  
#29 0x0000000000789c9d in main ()  
(gdb)

Could anyone help in fixing this.

Thanks,  
Prakash

---

<div class="post-metadata">

### Author: ![YMba9g8j9CJp0wLoQf5y](https://discourse.cmake.org/user_avatar/discourse.cmake.org/ymba9g8j9cjp0wloqf5y/32/1244_2.png) [@YMba9g8j9CJp0wLoQf5y](https://discourse.cmake.org/u/YMba9g8j9CJp0wLoQf5y)
#### Post date: [March 25, 2021, 4:02pm UTC](https://discourse.cmake.org/t/cmake-hung-while-compiling-libical/3018/2 "2021-03-25T16:02:14Z")

</div>

Does this happen on the latest version of CMake?

3.5.2 was a while ago.

---

<div class="post-metadata">

### Author: ![bill.hoffman](https://discourse.cmake.org/user_avatar/discourse.cmake.org/bill.hoffman/32/13_2.png) [@bill.hoffman](https://discourse.cmake.org/u/bill.hoffman)
#### Post date: [March 26, 2021, 2:31pm UTC](https://discourse.cmake.org/t/cmake-hung-while-compiling-libical/3018/3 "2021-03-26T14:31:03Z")

</div>

> [@prakashcv13](#):
>
> libical

Looks like it gets hung in a try-compile. Can you run cmake --trace and figure out which try\_compile is hanging? Or do you see any output that might give a clue as to where it is stuck?

---

<div class="post-metadata">

### Author: ![kjakkali](https://discourse.cmake.org/user_avatar/discourse.cmake.org/kjakkali/32/1377_2.png) [@kjakkali](https://discourse.cmake.org/u/kjakkali)
#### Post date: [April 15, 2021, 11:15am UTC](https://discourse.cmake.org/t/cmake-hung-while-compiling-libical/3018/4 "2021-04-15T11:15:55Z")

</div>

Ran cmake with --trace option

/opt/tools/share/cmake-3.5/Modules/CheckFunctionExists.cmake(70): try\_compile(HAVE\_OPEN ${CMAKE\_BINARY\_DIR} ${\_cfe\_source} COMPILE\_DEFINITIONS ${CMAKE\_REQUIRED\_DEFINITIONS} ${CHECK\_FUNCTION\_EXISTS\_ADD\_LIBRARIES} CMAKE\_FLAGS -DCOMPILE\_DEFINITIONS:STRING=${MACRO\_CHECK\_FUNCTION\_DEFINITIONS} ${CHECK\_FUNCTION\_EXISTS\_ADD\_INCLUDES} OUTPUT\_VARIABLE OUTPUT )  
CMake Warning (dev) at /opt/tools/share/cmake-3.5/Modules/CheckFunctionExists.cmake:70 (try\_compile):  
Policy CMP0056 is not set: Honor link flags in try\_compile() source-file  
signature. Run “cmake --help-policy CMP0056” for policy details. Use the  
cmake\_policy command to set the policy and suppress this warning.

For compatibility with older versions of CMake, try\_compile is not honoring  
caller link flags (e.g. CMAKE\_EXE\_LINKER\_FLAGS) in the test project.  
Call Stack (most recent call first):  
ConfigureChecks.cmake:36 (check\_function\_exists)  
CMakeLists.txt:320 (include)  
This warning is for project developers. Use -Wno-dev to suppress it.

/opt/tools/share/cmake-3.5/Modules/CheckFunctionExists.cmake(78): unset(\_cfe\_source )  
/opt/tools/share/cmake-3.5/Modules/CheckFunctionExists.cmake(80): if(HAVE\_OPEN )  
/opt/tools/share/cmake-3.5/Modules/CheckFunctionExists.cmake(81): set(HAVE\_OPEN 1 CACHE INTERNAL Have function open )  
/opt/tools/share/cmake-3.5/Modules/CheckFunctionExists.cmake(82): if(NOT CMAKE\_REQUIRED\_QUIET )  
/opt/tools/share/cmake-3.5/Modules/CheckFunctionExists.cmake(83): message(STATUS Looking for open - found )  
– Looking for open - found  
/opt/tools/share/cmake-3.5/Modules/CheckFunctionExists.cmake(85): file(APPEND ${CMAKE\_BINARY\_DIR}${CMAKE\_FILES\_DIRECTORY}/CMakeOutput.log Determining if the function open exists passed with the following output:\n ${OUTPUT}\n\n )  
/home/kumarj/d1/d2/d3/2022.0.0/binaries/libical/ConfigureChecks.cmake(37): check\_function\_exists(nanosleep HAVE\_NANOSLEEP )  
/opt/tools/share/cmake-3.5/Modules/CheckFunctionExists.cmake(42): if(NOT DEFINED HAVE\_NANOSLEEP OR x${HAVE\_NANOSLEEP} STREQUAL xHAVE\_NANOSLEEP )  
/opt/tools/share/cmake-3.5/Modules/CheckFunctionExists.cmake(43): set(MACRO\_CHECK\_FUNCTION\_DEFINITIONS -DCHECK\_FUNCTION\_EXISTS=nanosleep ${CMAKE\_REQUIRED\_FLAGS} )  
/opt/tools/share/cmake-3.5/Modules/CheckFunctionExists.cmake(45): if(NOT CMAKE\_REQUIRED\_QUIET )  
/opt/tools/share/cmake-3.5/Modules/CheckFunctionExists.cmake(46): message(STATUS Looking for nanosleep )  
– Looking for nanosleep  
/opt/tools/share/cmake-3.5/Modules/CheckFunctionExists.cmake(48): if(CMAKE\_REQUIRED\_LIBRARIES )  
/opt/tools/share/cmake-3.5/Modules/CheckFunctionExists.cmake(51): else()  
/opt/tools/share/cmake-3.5/Modules/CheckFunctionExists.cmake(52): set(CHECK\_FUNCTION\_EXISTS\_ADD\_LIBRARIES )  
/opt/tools/share/cmake-3.5/Modules/CheckFunctionExists.cmake(54): if(CMAKE\_REQUIRED\_INCLUDES )  
/opt/tools/share/cmake-3.5/Modules/CheckFunctionExists.cmake(57): else()  
/opt/tools/share/cmake-3.5/Modules/CheckFunctionExists.cmake(58): set(CHECK\_FUNCTION\_EXISTS\_ADD\_INCLUDES )  
/opt/tools/share/cmake-3.5/Modules/CheckFunctionExists.cmake(61): if(CMAKE\_C\_COMPILER\_LOADED )  
/opt/tools/share/cmake-3.5/Modules/CheckFunctionExists.cmake(62): set(\_cfe\_source ${CMAKE\_ROOT}/Modules/CheckFunctionExists.c )  
/opt/tools/share/cmake-3.5/Modules/CheckFunctionExists.cmake(70): try\_compile(HAVE\_NANOSLEEP ${CMAKE\_BINARY\_DIR} ${\_cfe\_source} COMPILE\_DEFINITIONS ${CMAKE\_REQUIRED\_DEFINITIONS} ${CHECK\_FUNCTION\_EXISTS\_ADD\_LIBRARIES} CMAKE\_FLAGS -DCOMPILE\_DEFINITIONS:STRING=${MACRO\_CHECK\_FUNCTION\_DEFINITIONS} ${CHECK\_FUNCTION\_EXISTS\_ADD\_INCLUDES} OUTPUT\_VARIABLE OUTPUT )  
CMake Warning (dev) at /opt/tools/share/cmake-3.5/Modules/CheckFunctionExists.cmake:70 (try\_compile):  
Policy CMP0056 is not set: Honor link flags in try\_compile() source-file  
signature. Run “cmake --help-policy CMP0056” for policy details. Use the  
cmake\_policy command to set the policy and suppress this warning.

For compatibility with older versions of CMake, try\_compile is not honoring  
caller link flags (e.g. CMAKE\_EXE\_LINKER\_FLAGS) in the test project.  
Call Stack (most recent call first):  
ConfigureChecks.cmake:37 (check\_function\_exists)  
CMakeLists.txt:320 (include)  
This warning is for project developers. Use -Wno-dev to suppress it.

---

<div class="post-metadata">

### Author: ![prakashcv13](https://discourse.cmake.org/user_avatar/discourse.cmake.org/prakashcv13/32/1320_2.png) [@prakashcv13](https://discourse.cmake.org/u/prakashcv13)
#### Post date: [April 15, 2021, 12:49pm UTC](https://discourse.cmake.org/t/cmake-hung-while-compiling-libical/3018/5 "2021-04-15T12:49:41Z")

</div>

Thank you @YMba9g8j9CJp0wLoQf5y and @bill.hoffman,

We tried with Cmake 3.20 on SLES12 platform, we still see the intermittent hang -

Stack trace  
gdb) bt  
#0 0x00007f4fc5694a43 in \_\_select\_nocancel () from /lib64/libc.so.6  
#1 0x000000000091a92a in cmsysProcess\_WaitForData ()  
#2 0x000000000050f9ac in cmSystemTools::RunSingleCommand(std::vector\<std::string, std::allocator\< std::string\> \> const&, std::string\*, std::string\*, int\*, char const\*, cmSystemTools::OutputOption, std::chrono::duration\<double, std::ratio\<1l, 1l\> \>, cmProcessOutput::Encoding) ()  
#3 0x00000000007cd870 in cmGlobalGenerator::Build(int, std::string const&, std::string const&, std::string const&, std::vector\<std::string, std::allocator\< std::string\> \> const&, std::string&, std::string const&, std::string const&, bool, bool, bool, std::chrono::duration\<double, std::ratio\<1l, 1l\> \>, cmSystemTools::OutputOption, std::vector\<std::string, std::allocator\< std::string\> \> const&) ()  
#4 0x00000000007ce25a in cmGlobalGenerator::TryCompile(int, std::string const&, std::string const&, std::string const&, std::string const&, bool, std::string&, cmMakefile\*) ()  
#5 0x0000000000492543 in cmMakefile::TryCompile(std::string const&, std::string const&, std::string const&, std::string const&, bool, int, std::vector\<std::string, std::allocator\< std::string\> \> const\*, std::string&) ()  
#6 0x00000000008a4c66 in cmCoreTryCompile::TryCompileCode(std::vector\<std::string, std::allocator\< std::string\> \> const&, bool) ()  
#7 0x000000000064c0b9 in cmTryCompileCommand::InitialPass(std::vector\<std::string, std::allocator\< std::string\> \> const&, cmExecutionStatus&) ()  
#8 0x00000000005555dc in cmCommand::InvokeInitialPass(std::vector\<cmListFileArgument, std::allocator \> const&, cmExecutionStatus&)  
()  
#9 0x0000000000555815 in cmLegacyCommandWrapper::operator()(std::vector\<cmListFileArgument, std::allocator \> const&, cmExecutionStatus&) const ()  
#10 0x00000000004a3aba in cmMakefile::ExecuteCommand(cmListFileFunction const&, cmExecutionStatus&, cm::optional\< std::string\>) ()  
#11 0x00000000005e032e in cmIfFunctionBlocker::Replay(std::vector\<cmListFileFunction, std::allocator \>, cmExecutionStatus&) ()  
#12 0x00000000005d6f0c in cmFunctionBlocker::IsFunctionBlocked(cmListFileFunction const&, cmExecutionStatus&) ()  
#13 0x00000000004a33c6 in cmMakefile::ExecuteCommand(cmListFileFunction const&, cmExecutionStatus&, cm::optional\< std::string\>) ()  
#14 0x0000000000613ed1 in (anonymous namespace)::cmMacroHelperCommand::operator()(std::vector\<cmListFileArgument, std::allocator \> const&, cmExecutionStatus&) const ()  
#15 0x00000000004a3aba in cmMakefile::ExecuteCommand(cmListFileFunction const&, cmExecutionStatus&, cm::optional\< std::string\>) ()  
#16 0x00000000005e032e in cmIfFunctionBlocker::Replay(std::vector\<cmListFileFunction, std::allocator \>, cmExecutionStatus&) ()  
#17 0x00000000005d6f0c in cmFunctionBlocker::IsFunctionBlocked(cmListFileFunction const&, cmExecutionStatus&) ()  
#18 0x00000000004a33c6 in cmMakefile::ExecuteCommand(cmListFileFunction const&, cmExecutionStatus&, cm::optional\< std::string\>) ()  
#19 0x00000000004a6c77 in cmMakefile::RunListFile(cmListFile const&, std::string const&, cmMakefile::DeferCommands\*) [clone .constprop.786] ()  
#20 0x00000000004a7262 in cmMakefile::ReadDependentFile(std::string const&, bool) ()  
#21 0x00000000005e337e in cmIncludeCommand(std::vector\<std::string, std::allocator\< std::string\> \> const&, cmExecutionStatus&) ()  
#22 0x00000000004f14f5 in std::\_Function\_handler\<bool (std::vector\<cmListFileArgument, std::allocator \> const&, cmExecutionStatus&), cmState::AddBuiltinCommand(std::string const&, bool (_)(std::vector\<std::string, std::allocator\< std::string\> \> const&, cmExecutionStatus&))::{lambda(std::vector\<cmListFileArgument, std::allocator \> const&, cmExecutionStatus&)#1}\>::\_M\_invoke(std::\_Any\_data const&, std::vector\<cmListFileArgument, std::allocator \> const&, cmExecutionStatus&) ()  
 #23 0x00000000004a3aba in cmMakefile::ExecuteCommand(cmListFileFunction const&, cmExecutionStatus&, cm::optional\< std::string\>) ()  
 #24 0x00000000004a422e in cmMakefile::RunListFile(cmListFile const&, std::string const&, cmMakefile::DeferCommands_) ()  
#25 0x00000000004a4ef2 in cmMakefile::Configure() ()  
#26 0x00000000007dc216 in cmGlobalGenerator::Configure() ()  
#27 0x00000000007eda83 in cmGlobalUnixMakefileGenerator3::Configure() ()  
#28 0x000000000053fc61 in cmake::ActualConfigure() ()  
#29 0x0000000000540f3d in cmake::Configure() ()  
#30 0x000000000054dbb3 in cmake::Run(std::vector\<std::string, std::allocator\< std::string\> \> const&, bool) ()  
#31 0x0000000000433095 in (anonymous namespace)::do\_cmake(int, char const\* const\*) ()  
#32 0x000000000041afb1 in main ()  
(gdb)

cmake --trace

/home/kj/cmake-3.20.1/Modules/CheckFunctionExists.cmake(58): if(NOT DEFINED HAVE\_SIGNAL OR x${HAVE\_SIGNAL} STREQUAL xHAVE\_SIGNAL )  
/home/kj/cmake-3.20.1/Modules/CheckFunctionExists.cmake(59): set(MACRO\_CHECK\_FUNCTION\_DEFINITIONS -DCHECK\_FUNCTION\_EXISTS=signal ${CMAKE\_REQUIRED\_FLAGS} )  
/home/kj/cmake-3.20.1/Modules/CheckFunctionExists.cmake(61): if(NOT CMAKE\_REQUIRED\_QUIET )  
/home/kj/cmake-3.20.1/Modules/CheckFunctionExists.cmake(62): message(CHECK\_START Looking for signal )  
– Looking for signal  
/home/kj/cmake-3.20.1/Modules/CheckFunctionExists.cmake(64): if(CMAKE\_REQUIRED\_LINK\_OPTIONS )  
/home/kumarj/x1/x2/x3/2022.0.0/binaries/libical/ConfigureChecks.cmake(67): else()  
/home/kj/cmake-3.20.1/Modules/CheckFunctionExists.cmake(68): set(CHECK\_FUNCTION\_EXISTS\_ADD\_LINK\_OPTIONS )  
/home/kj/cmake-3.20.1/Modules/CheckFunctionExists.cmake(70): if(CMAKE\_REQUIRED\_LIBRARIES )  
/home/kumarj/x1/x2/x3/2022.0.0/binaries/libical/ConfigureChecks.cmake(73): else()  
/home/kj/cmake-3.20.1/Modules/CheckFunctionExists.cmake(74): set(CHECK\_FUNCTION\_EXISTS\_ADD\_LIBRARIES )  
/home/kj/cmake-3.20.1/Modules/CheckFunctionExists.cmake(76): if(CMAKE\_REQUIRED\_INCLUDES )  
/home/kumarj/x1/x2/x3/2022.0.0/binaries/libical/ConfigureChecks.cmake(79): else()  
/home/kj/cmake-3.20.1/Modules/CheckFunctionExists.cmake(80): set(CHECK\_FUNCTION\_EXISTS\_ADD\_INCLUDES )  
/home/kj/cmake-3.20.1/Modules/CheckFunctionExists.cmake(83): if(CMAKE\_C\_COMPILER\_LOADED )  
/home/kj/cmake-3.20.1/Modules/CheckFunctionExists.cmake(84): set(\_cfe\_source ${CMAKE\_ROOT}/Modules/CheckFunctionExists.c )  
/home/kj/cmake-3.20.1/Modules/CheckFunctionExists.cmake(92): try\_compile(HAVE\_SIGNAL ${CMAKE\_BINARY\_DIR} ${\_cfe\_source} COMPILE\_DEFINITIONS ${CMAKE\_REQUIRED\_DEFINITIONS} ${CHECK\_FUNCTION\_EXISTS\_ADD\_LINK\_OPTIONS} ${CHECK\_FUNCTION\_EXISTS\_ADD\_LIBRARIES} CMAKE\_FLAGS -DCOMPILE\_DEFINITIONS:STRING=${MACRO\_CHECK\_FUNCTION\_DEFINITIONS} ${CHECK\_FUNCTION\_EXISTS\_ADD\_INCLUDES} OUTPUT\_VARIABLE OUTPUT )  
CMake Warning (dev) at /home/kj/cmake-3.20.1/Modules/CheckFunctionExists.cmake:92 (try\_compile):  
Policy CMP0066 is not set: Honor per-config flags in try\_compile()  
source-file signature. Run “cmake --help-policy CMP0066” for policy  
details. Use the cmake\_policy command to set the policy and suppress this  
warning.

For compatibility with older versions of CMake, try\_compile is not honoring  
caller config-specific compiler flags (e.g. CMAKE\_C\_FLAGS\_DEBUG) in the  
test project.  
Call Stack (most recent call first):  
ConfigureChecks.cmake:38 (check\_function\_exists)  
CMakeLists.txt:320 (include)  
This warning is for project developers. Use -Wno-dev to suppress it.

CMake Warning (dev) at /home/kj/cmake-3.20.1/Modules/CheckFunctionExists.cmake:92 (try\_compile):  
Policy CMP0056 is not set: Honor link flags in try\_compile() source-file  
signature. Run “cmake --help-policy CMP0056” for policy details. Use the  
cmake\_policy command to set the policy and suppress this warning.

For compatibility with older versions of CMake, try\_compile is not honoring  
caller link flags (e.g. CMAKE\_EXE\_LINKER\_FLAGS) in the test project.  
Call Stack (most recent call first):  
ConfigureChecks.cmake:38 (check\_function\_exists)  
CMakeLists.txt:320 (include)  
This warning is for project developers. Use -Wno-dev to suppress it.

I hope the above logs help in understanding the issue. Please let us know if we could try something else to get more information and/or fix it.

Thanks in advance.

Regards,  
Prakash

---

<div class="post-metadata">

### Author: ![YMba9g8j9CJp0wLoQf5y](https://discourse.cmake.org/user_avatar/discourse.cmake.org/ymba9g8j9cjp0wloqf5y/32/1244_2.png) [@YMba9g8j9CJp0wLoQf5y](https://discourse.cmake.org/u/YMba9g8j9CJp0wLoQf5y)
#### Post date: [April 15, 2021, 5:28pm UTC](https://discourse.cmake.org/t/cmake-hung-while-compiling-libical/3018/6 "2021-04-15T17:28:56Z")

</div>

Looks like the bug is occurring in the CheckFunctionExists module. Is that correct? If so could you create a [SSCCE](http://sscce.org/)?

In the meantime try using CheckSymbolExists instead.

From the docs:

```auto

Note

Prefer using CheckSymbolExists instead of this module, for the following reasons:

    check_function_exists() can't detect functions that are inlined in headers or specified as a macro.

    check_function_exists() can't detect anything in the 32-bit versions of the Win32 API, because of a mismatch in calling conventions.

    check_function_exists() only verifies linking, it does not verify that the function is declared in system headers.

```

---

<div class="post-metadata">

### Author: ![bill.hoffman](https://discourse.cmake.org/user_avatar/discourse.cmake.org/bill.hoffman/32/13_2.png) [@bill.hoffman](https://discourse.cmake.org/u/bill.hoffman)
#### Post date: [April 15, 2021, 6:52pm UTC](https://discourse.cmake.org/t/cmake-hung-while-compiling-libical/3018/7 "2021-04-15T18:52:58Z")

</div>

Looks like the problem is here:

> [@prakashcv13](#):
>
> ConfigureChecks.cmake:38 (check\_function\_exists)

What is on that line in your project? If you have a CMakeLists.txt with just that line in it does it still hang? What function is that checking for? Is there anything in CMakeFiles/CMakeOutput.log or CMakeError.log that is useful? Seems like other function exist calls are working. So what is it about this one?

---

<div class="post-metadata">

### Author: ![kjakkali](https://discourse.cmake.org/user_avatar/discourse.cmake.org/kjakkali/32/1377_2.png) [@kjakkali](https://discourse.cmake.org/u/kjakkali)
#### Post date: [April 16, 2021, 10:05am UTC](https://discourse.cmake.org/t/cmake-hung-while-compiling-libical/3018/8 "2021-04-16T10:05:52Z")

</div>

@bill.hoffman : We use cmake to compile Libical version 3.0.8

---

<div class="post-metadata">

### Author: ![bill.hoffman](https://discourse.cmake.org/user_avatar/discourse.cmake.org/bill.hoffman/32/13_2.png) [@bill.hoffman](https://discourse.cmake.org/u/bill.hoffman)
#### Post date: [April 16, 2021, 5:33pm UTC](https://discourse.cmake.org/t/cmake-hung-while-compiling-libical/3018/9 "2021-04-16T17:33:31Z")

</div>

> [@prakashcv13](#):
>
> we still see the intermittent hang

So, this does not happen every time? Sometimes it works? Can you post the CMakeOutput.log and CMakeError.log files? Looks like for some reason the compiler is hanging and cmake is waiting for it to finish. There might be something in those files. If you create a small cmake project with just this:

```
cmake_minimum_required(VERSION 3.1.0) 
project(libical C) #CXX is optional for the bindings
include(CheckFunctionExists)
check_function_exists(signal HAVE_SIGNAL)

```

Does that work?

---

<div class="post-metadata">

### Author: ![bremanandjk](https://discourse.cmake.org/user_avatar/discourse.cmake.org/bremanandjk/32/1403_2.png) [@bremanandjk](https://discourse.cmake.org/u/bremanandjk)
#### Post date: [April 26, 2021, 5:44am UTC](https://discourse.cmake.org/t/cmake-hung-while-compiling-libical/3018/10 "2021-04-26T05:44:55Z")

</div>

> [@bill.hoffman](#):
>
> CMakeOutput.log and CMakeError.log files

Hey,  
Is there any config that needs to be enabled to generate these files “CMakeOutput.log and CMakeError.log”?

---

<div class="post-metadata">

### Author: ![bill.hoffman](https://discourse.cmake.org/user_avatar/discourse.cmake.org/bill.hoffman/32/13_2.png) [@bill.hoffman](https://discourse.cmake.org/u/bill.hoffman)
#### Post date: [April 26, 2021, 4:45pm UTC](https://discourse.cmake.org/t/cmake-hung-while-compiling-libical/3018/11 "2021-04-26T16:45:08Z")

</div>

No, they should be in the build tree by default in the CMakeFiles directory.

---

<div class="post-metadata">

### Author: ![bremanandjk](https://discourse.cmake.org/user_avatar/discourse.cmake.org/bremanandjk/32/1403_2.png) [@bremanandjk](https://discourse.cmake.org/u/bremanandjk)
#### Post date: [May 28, 2021, 6:47pm UTC](https://discourse.cmake.org/t/cmake-hung-while-compiling-libical/3018/12 "2021-05-28T18:47:25Z")

</div>

Hey,  
I got the hang issue with cmake v3.5

cmake logs:  
/home/brema/d1/d2/d3/2022.0.0/binaries/libical/CMakeLists.txt(127): add\_definitions(-DWITH\_CXX\_BINDINGS )  
/home/brema/d1/d2/d3/2022.0.0/binaries/libical/CMakeLists.txt(136): add\_feature\_info(Option WITH\_CXX\_BINDINGS WITH\_CXX\_BINDINGS build the C++ bindings. Requires a C++ compiler )  
/opt/tools/share/cmake-3.5/Modules/FeatureSummary.cmake(284): if(${\_enabled} )  
/opt/tools/share/cmake-3.5/Modules/FeatureSummary.cmake(285): set\_property(GLOBAL APPEND PROPERTY ENABLED\_FEATURES ${\_name} )  
/opt/tools/share/cmake-3.5/Modules/FeatureSummary.cmake(290): set\_property(GLOBAL PROPERTY _CMAKE_${\_name}\_DESCRIPTION ${\_desc} )  
/home/brema/d1/d2/d3/2022.0.0/binaries/libical/CMakeLists.txt(142): option(STATIC\_ONLY Build static libraries only. )  
/home/brema/d1/d2/d3/2022.0.0/binaries/libical/CMakeLists.txt(143): add\_feature\_info(Option STATIC\_ONLY STATIC\_ONLY build static libraries only )  
/opt/tools/share/cmake-3.5/Modules/FeatureSummary.cmake(284): if(${\_enabled} )  
/opt/tools/share/cmake-3.5/Modules/FeatureSummary.cmake(286): else()  
/opt/tools/share/cmake-3.5/Modules/FeatureSummary.cmake(287): set\_property(GLOBAL APPEND PROPERTY DISABLED\_FEATURES ${\_name} )  
/opt/tools/share/cmake-3.5/Modules/FeatureSummary.cmake(290): set\_property(GLOBAL PROPERTY _CMAKE_${\_name}\_DESCRIPTION ${\_desc} )  
/home/brema/d1/d2/d3/2022.0.0/binaries/libical/CMakeLists.txt(148): if(STATIC\_ONLY )  
/home/brema/d1/d2/d3/2022.0.0/binaries/libical/CMakeLists.txt(152): option(SHARED\_ONLY Build shared (dynamic) libraries only. Takes precedence over STATIC\_ONLY )  
/home/brema/d1/d2/d3/2022.0.0/binaries/libical/CMakeLists.txt(153): add\_feature\_info(Option SHARED\_ONLY SHARED\_ONLY build shared libraries only )  
/opt/tools/share/cmake-3.5/Modules/FeatureSummary.cmake(284): if(${\_enabled} )  
/opt/tools/share/cmake-3.5/Modules/FeatureSummary.cmake(286): else()  
/opt/tools/share/cmake-3.5/Modules/FeatureSummary.cmake(287): set\_property(GLOBAL APPEND PROPERTY DISABLED\_FEATURES ${\_name} )  
/opt/tools/share/cmake-3.5/Modules/FeatureSummary.cmake(290): set\_property(GLOBAL PROPERTY _CMAKE_${\_name}\_DESCRIPTION ${\_desc} )  
/home/brema/d1/d2/d3/2022.0.0/binaries/libical/CMakeLists.txt(158): if(SHARED\_ONLY )  
/home/brema/d1/d2/d3/2022.0.0/binaries/libical/CMakeLists.txt(163): if(NOT STATIC\_ONLY AND NOT SHARED\_ONLY )  
/home/brema/d1/d2/d3/2022.0.0/binaries/libical/CMakeLists.txt(164): add\_feature\_info(Build types TRUE build both shared and static libraries )  
/opt/tools/share/cmake-3.5/Modules/FeatureSummary.cmake(284): if(${\_enabled} )  
/opt/tools/share/cmake-3.5/Modules/FeatureSummary.cmake(285): set\_property(GLOBAL APPEND PROPERTY ENABLED\_FEATURES ${\_name} )  
/opt/tools/share/cmake-3.5/Modules/FeatureSummary.cmake(290): set\_property(GLOBAL PROPERTY _CMAKE_${\_name}\_DESCRIPTION ${\_desc} )  
/home/brema/d1/d2/d3/2022.0.0/binaries/libical/CMakeLists.txt(171): if(STATIC\_ONLY )  
/home/brema/d1/d2/d3/2022.0.0/binaries/libical/CMakeLists.txt(180): find\_package(Perl REQUIRED )  
/opt/tools/share/cmake-3.5/Modules/FindPerl.cmake(28): include(${CMAKE\_CURRENT\_LIST\_DIR}/FindCygwin.cmake )  
/opt/tools/share/cmake-3.5/Modules/FindCygwin.cmake(20): if(WIN32 )  
/opt/tools/share/cmake-3.5/Modules/FindPerl.cmake(30): set(PERL\_POSSIBLE\_BIN\_PATHS ${CYGWIN\_INSTALL\_PATH}/bin )  
/opt/tools/share/cmake-3.5/Modules/FindPerl.cmake(34): if(WIN32 )  
/opt/tools/share/cmake-3.5/Modules/FindPerl.cmake(45): find\_program(PERL\_EXECUTABLE NAMES perl PATHS ${PERL\_POSSIBLE\_BIN\_PATHS} )  
/opt/tools/share/cmake-3.5/Modules/FindPerl.cmake(50): if(PERL\_EXECUTABLE )  
/opt/tools/share/cmake-3.5/Modules/FindPerl.cmake(52): execute\_process(COMMAND ${PERL\_EXECUTABLE} -V:version OUTPUT\_VARIABLE PERL\_VERSION\_OUTPUT\_VARIABLE RESULT\_VARIABLE PERL\_VERSION\_RESULT\_VARIABLE ERROR\_QUIET OUTPUT\_STRIP\_TRAILING\_WHITESPACE )

I could not attach the error logs due to new user restrictions.

---

<div class="post-metadata">

### Author: ![bremanandjk](https://discourse.cmake.org/user_avatar/discourse.cmake.org/bremanandjk/32/1403_2.png) [@bremanandjk](https://discourse.cmake.org/u/bremanandjk)
#### Post date: [June 1, 2021, 5:59am UTC](https://discourse.cmake.org/t/cmake-hung-while-compiling-libical/3018/14 "2021-06-01T05:59:16Z")

</div>

Hey @bill.hoffman

I have tried the same test which was suggesting, seems the check\_function\_exists macro is failing to detect the function’s existence in the system,

I ran the CMake project once, it is getting a successful result.  
while running in a loop. It fails.

Test project code:  
brema@pbi-18-s12:~/x1/x2/x3/check\> cat CMakeLists.txt  
cmake\_minimum\_required(VERSION 3.1.0)  
project(libical C) #CXX is optional for the bindings  
include(CheckFunctionExists)  
check\_function\_exists(signal HAVE\_SIGNAL)

Logs:

– The C compiler identification is GNU 4.8.3  
– Check for working C compiler: /usr/bin/cc  
– Check for working C compiler: /usr/bin/cc – works  
– Detecting C compiler ABI info  
– Detecting C compiler ABI info - done  
– 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  
– Check for working C compiler: /usr/bin/cc  
– Check for working C compiler: /usr/bin/cc – works  
– Detecting C compiler ABI info  
– Detecting C compiler ABI info - done  
– 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  
– Check for working C compiler: /usr/bin/cc  
– Check for working C compiler: /usr/bin/cc – works  
– Detecting C compiler ABI info  
– Detecting C compiler ABI info - done  
– Detecting C compile features  
– Detecting C compile features - done  
– Looking for signal

GDB logs on hanged Cmake proces:  
warning: /etc/gdbinit.d/gdb-heap.py: No such file or directory  
-: No such file or directory.  
Attaching to process 18334  
Reading symbols from /bin/bash…(no debugging symbols found)…done.  
Reading symbols from /lib64/libreadline.so.6…(no debugging symbols found)…done.  
Loaded symbols for /lib64/libreadline.so.6  
Reading symbols from /lib64/libtinfo.so.5…(no debugging symbols found)…done.  
Loaded symbols for /lib64/libtinfo.so.5  
Reading symbols from /lib64/libdl.so.2…(no debugging symbols found)…done.  
Loaded symbols for /lib64/libdl.so.2  
Reading symbols from /lib64/libc.so.6…(no debugging symbols found)…done.  
Loaded symbols for /lib64/libc.so.6  
Reading symbols from /lib64/ld-linux-x86-64.so.2…(no debugging symbols found)…done.  
Loaded symbols for /lib64/ld-linux-x86-64.so.2  
0x00007fb589c792dc in waitpid () from /lib64/libc.so.6  
Missing separate debuginfos, use: zypper install bash-debuginfo-4.2-75.2.x86\_64  
(gdb) bt  
#0 0x00007fb589c792dc in waitpid () from /lib64/libc.so.6  
#1 0x0000000000429781 in ?? ()  
#2 0x000000000042aa92 in wait\_for ()  
#3 0x000000000046222f in execute\_command\_internal ()  
#4 0x0000000000460676 in execute\_command\_internal ()  
#5 0x0000000000462951 in execute\_command ()  
#6 0x0000000000424164 in ?? ()  
#7 0x0000000000462176 in execute\_command\_internal ()  
#8 0x0000000000462951 in execute\_command ()  
#9 0x000000000041b7f1 in reader\_loop ()  
#10 0x000000000041b4db in main ()  
(gdb)

Looks like the Cmake tool is waiting for some pid.

---

<div class="post-metadata">

### Author: ![bill.hoffman](https://discourse.cmake.org/user_avatar/discourse.cmake.org/bill.hoffman/32/13_2.png) [@bill.hoffman](https://discourse.cmake.org/u/bill.hoffman)
#### Post date: [June 2, 2021, 3:40pm UTC](https://discourse.cmake.org/t/cmake-hung-while-compiling-libical/3018/15 "2021-06-02T15:40:47Z")

</div>

What version of CMake are you running in this last test and where did the build come from? Does it work if you use this one: [https://github.com/Kitware/CMake/releases/download/v3.20.3/cmake-3.20.3-linux-x86\_64.tar.gz](https://github.com/Kitware/CMake/releases/download/v3.20.3/cmake-3.20.3-linux-x86_64.tar.gz)

---

<div class="post-metadata">

### Author: ![brad.king](https://discourse.cmake.org/user_avatar/discourse.cmake.org/brad.king/32/11_2.png) [@brad.king](https://discourse.cmake.org/u/brad.king)
#### Post date: [June 2, 2021, 3:49pm UTC](https://discourse.cmake.org/t/cmake-hung-while-compiling-libical/3018/16 "2021-06-02T15:49:41Z")

</div>

When CMake’s process blocks inside `cmsysProcess_WaitForData`, it means that it is waiting for some child process to write data to its output pipes, or close them. If the child process creates long-lived/daemonized grandchildren that inherit those pipes, then CMake will continue to block waiting for those.

Does `pstree` show any child processes of the hung CMake process?

---

<div class="post-metadata">

### Author: ![bremanandjk](https://discourse.cmake.org/user_avatar/discourse.cmake.org/bremanandjk/32/1403_2.png) [@bremanandjk](https://discourse.cmake.org/u/bremanandjk)
#### Post date: [June 3, 2021, 7:49pm UTC](https://discourse.cmake.org/t/cmake-hung-while-compiling-libical/3018/17 "2021-06-03T19:49:56Z")

</div>

Hey @bill.hoffman, [CMake hung while compiling libical](https://discourse.cmake.org/t/cmake-hung-while-compiling-libical/3018)

I was using Cmake 3.20.1 in my last test.

I have installed the same binaries(i.e 3.20.3) which you have shared, even in this build also seeing the same hang issue.

```auto
-- 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
-- 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

```

OS details:

```auto
brema@hostname:~> cat /etc/os-release
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"

```

Please let me if any info needed to debug further, Thanks

Hi @brad.king

pstree details:

```auto
brema@pbi-18-s12:~> pstree -alps 30335
systemd,1 --switched-root --system --deserialize 19
  └─sshd,1308 -D
      └─sshd,30329
          └─sshd,30334
              └─bash,30335
                  └─cmake,11784 ../check
                      └─(gmake,11806)
brema@pbi-18-s12:~> pstree -alp 30335
bash,30335
  └─cmake,11784 ../check
      └─(gmake,11806)
brema@pbi-18-s12:~> pstree -ap 30335
bash,30335
  └─cmake,11784 ../check
      └─(gmake,11806)
brema@pbi-18-s12:~> pstree -p 30335
bash(30335)───cmake(11784)───gmake(11806)
brema@pbi-18-s12:~> pstree -a 30335
bash
  └─cmake ../check
      └─(gmake)

```

---

<div class="post-metadata">

### Author: ![brad.king](https://discourse.cmake.org/user_avatar/discourse.cmake.org/brad.king/32/11_2.png) [@brad.king](https://discourse.cmake.org/u/brad.king)
#### Post date: [June 4, 2021, 10:38am UTC](https://discourse.cmake.org/t/cmake-hung-while-compiling-libical/3018/18 "2021-06-04T10:38:00Z")

</div>

> `bash(30335)───cmake(11784)───gmake(11806)`

From that `pstree` output, we can see that it is actually `gmake` that is hanging, and `cmake` is blocked waiting for it.

---

<div class="post-metadata">

### Author: ![bill.hoffman](https://discourse.cmake.org/user_avatar/discourse.cmake.org/bill.hoffman/32/13_2.png) [@bill.hoffman](https://discourse.cmake.org/u/bill.hoffman)
#### Post date: [June 7, 2021, 3:25pm UTC](https://discourse.cmake.org/t/cmake-hung-while-compiling-libical/3018/19 "2021-06-07T15:25:24Z")

</div>

Can you try it with the ninja build generator to see if it is a gmake issue? Another thought would be to try _–debug-trycompile_ as an option. Then running gmake by hand in the “left over” files. And see if gmake hangs without cmake.

---

<div class="post-metadata">

### Author: ![bill.hoffman](https://discourse.cmake.org/user_avatar/discourse.cmake.org/bill.hoffman/32/13_2.png) [@bill.hoffman](https://discourse.cmake.org/u/bill.hoffman)
#### Post date: [June 7, 2021, 5:46pm UTC](https://discourse.cmake.org/t/cmake-hung-while-compiling-libical/3018/20 "2021-06-07T17:46:28Z")

</div>

One other question, are you deleting the build tree in between runs of CMake?

---

<div class="post-metadata">

### Author: ![bremanandjk](https://discourse.cmake.org/user_avatar/discourse.cmake.org/bremanandjk/32/1403_2.png) [@bremanandjk](https://discourse.cmake.org/u/bremanandjk)
#### Post date: [June 7, 2021, 6:24pm UTC](https://discourse.cmake.org/t/cmake-hung-while-compiling-libical/3018/21 "2021-06-07T18:24:26Z")

</div>

Hey @bill.hoffman,

Yes, I am deleting all CMake autogenerate files in each iteration.

brema@hostname:~/x1/x2/x3/check\> ls  
CMakeFiles CMakeLists.txt

brema@hostname:~/x1/x2/x3/check\> cat CMakeLists.txt  
cmake\_minimum\_required(VERSION 3.1.0)  
project(libical C) #CXX is optional for the bindings  
include(CheckFunctionExists)  
check\_function\_exists(signal HAVE\_SIGNAL)

while [TRUE]; do echo ; rm -rf CMakeCache.txt CMakeFiles cmake\_install.cmake Makefile ; cmake …/check; done

[Next page](https://discourse.cmake.org/t/cmake-hung-while-compiling-libical/3018.md?page=2)
