Cmake hung at pkg-config in SLES12

Hi Team,

Cmake is hung while finding any package that depends on pkg-config package:

cmake version: cmake version 3.15.7

in CMakeLists.txt:
find_package(EXPAT REQUIRED)
find_package(X11 REQUIRED)

logs:
pbi-32-s12:/home/sudemo # pstree 8158
cmake───pkg-config

– Found PkgConfig: /usr/bin/pkg-config (found version “0.28”)
– Checking for module ‘expat’
– Found expat, version 2.1.0

/opt/tools/share/cmake-3.15/Modules/FindPkgConfig.cmake(61):  set(_pkgconfig_invoke_result )
/opt/tools/share/cmake-3.15/Modules/FindPkgConfig.cmake(63):  execute_process(COMMAND ${PKG_CONFIG_EXECUTABLE} --static;--cflags expat OUTPUT_VARIABLE _pkgconfig_invoke_result RESULT_VARIABLE _pkgconfig_failed OUTPUT_STRIP_TRAILING_WHITESPACE )
/opt/tools/share/cmake-3.15/Modules/FindPkgConfig.cmake(69):  if(_pkgconfig_failed )
/opt/tools/share/cmake-3.15/Modules/FindPkgConfig.cmake(72):  else()
/opt/tools/share/cmake-3.15/Modules/FindPkgConfig.cmake(73):  string(REGEX REPLACE [\r\n]   _pkgconfig_invoke_result ${_pkgconfig_invoke_result} )
/opt/tools/share/cmake-3.15/Modules/FindPkgConfig.cmake(75):  if(NOT  STREQUAL  )
/opt/tools/share/cmake-3.15/Modules/FindPkgConfig.cmake(79):  separate_arguments(_pkgconfig_invoke_result )
/opt/tools/share/cmake-3.15/Modules/FindPkgConfig.cmake(82):  set(_pkgconfig_STATIC_CFLAGS ${_pkgconfig_invoke_result} )
/opt/tools/share/cmake-3.15/Modules/FindPkgConfig.cmake(83):  _pkgconfig_set(PC_EXPAT_STATIC_CFLAGS ${_pkgconfig_invoke_result} )
/opt/tools/share/cmake-3.15/Modules/FindPkgConfig.cmake(56):  set(PC_EXPAT_STATIC_CFLAGS  CACHE INTERNAL  )
/opt/tools/share/cmake-3.15/Modules/FindPkgConfig.cmake(497):  _pkgconfig_invoke_dyn(${_pkg_check_modules_packages} PC_EXPAT CFLAGS_OTHER  --cflags-only-other )
/opt/tools/share/cmake-3.15/Modules/FindPkgConfig.cmake(98):  _pkgconfig_invoke(expat PC_EXPAT CFLAGS_OTHER  --cflags-only-other )
/opt/tools/share/cmake-3.15/Modules/FindPkgConfig.cmake(61):  set(_pkgconfig_invoke_result )
/opt/tools/share/cmake-3.15/Modules/FindPkgConfig.cmake(63):  execute_process(COMMAND ${PKG_CONFIG_EXECUTABLE} --cflags-only-other expat OUTPUT_VARIABLE _pkgconfig_invoke_result RESULT_VARIABLE _pkgconfig_failed OUTPUT_STRIP_TRAILING_WHITESPACE )
/opt/tools/share/cmake-3.15/Modules/FindPkgConfig.cmake(69):  if(_pkgconfig_failed )
/opt/tools/share/cmake-3.15/Modules/FindPkgConfig.cmake(72):  else()
/opt/tools/share/cmake-3.15/Modules/FindPkgConfig.cmake(73):  string(REGEX REPLACE [\r\n]   _pkgconfig_invoke_result ${_pkgconfig_invoke_result} )
/opt/tools/share/cmake-3.15/Modules/FindPkgConfig.cmake(75):  if(NOT  STREQUAL  )
/opt/tools/share/cmake-3.15/Modules/FindPkgConfig.cmake(79):  separate_arguments(_pkgconfig_invoke_result )
/opt/tools/share/cmake-3.15/Modules/FindPkgConfig.cmake(82):  set(_pkgconfig_CFLAGS_OTHER ${_pkgconfig_invoke_result} )
/opt/tools/share/cmake-3.15/Modules/FindPkgConfig.cmake(83):  _pkgconfig_set(PC_EXPAT_CFLAGS_OTHER ${_pkgconfig_invoke_result} )
/opt/tools/share/cmake-3.15/Modules/FindPkgConfig.cmake(56):  set(PC_EXPAT_CFLAGS_OTHER  CACHE INTERNAL  )
/opt/tools/share/cmake-3.15/Modules/FindPkgConfig.cmake(99):  _pkgconfig_invoke(expat PC_EXPAT STATIC_CFLAGS_OTHER  --static --cflags-only-other )
/opt/tools/share/cmake-3.15/Modules/FindPkgConfig.cmake(61):  set(_pkgconfig_invoke_result )
/opt/tools/share/cmake-3.15/Modules/FindPkgConfig.cmake(63):  execute_process(COMMAND ${PKG_CONFIG_EXECUTABLE} --static;--cflags-only-other expat OUTPUT_VARIABLE _pkgconfig_invoke_result RESULT_VARIABLE _pkgconfig_failed OUTPUT_STRIP_TRAILING_WHITESPACE )

If you run this command, does it work locally?

FYI @Dakon

pbi-26-s12-cray:/home/sanketb # /usr/bin/pkg-config --static --cflags-only-other expat

pbi-26-s12-cray:/home/sanketb #

Hey,
Can someone please take a look on why cmake hung at pkg-config in SLES12 platform ?

I think using strace -f to figure out where it is hanging would be one way to continue on in lieu of any specific help here (sorry, I don’t have the time right now).

Hey Ben,

Here is the strace log attached, when cmake was hung.

ps -ef | grep cmake
root 10654 10507 7 16:53 pts/0 00:00:03 cmake -DPBS_VERSION=2022.1.0.20220603185800 -DCMAKE_C_FLAGS=-g -Wall -Werror -Wno-unused-result -fPIC -D_LARGEFILE_SOURCE -O2 -DCMAKE_CXX_FLAGS=-g -Wall -Werror -Wno-unused-result -fPIC -O2 -D–with-database-dir=/home/pbsbuild/ramdisk/workspace/build/linux312_x86_64-work/pgsql -D–with-database-user=pbsdata -D–with-editline=/home/pbsbuild/ramdisk/workspace/build/linux312_x86_64-work/editline -D–with-tcl=/home/pbsbuild/ramdisk/workspace/build/linux312_x86_64-work/tcltk -D–with-libical=/home/pbsbuild/ramdisk/workspace/build/linux312_x86_64-work/libical -D–with-python=/home/pbsbuild/ramdisk/workspace/build/linux312_x86_64-work/python -D–with-alsdk=/home/pbsbuild/ramdisk/workspace/build/linux312_x86_64-work/alsdk -D–with-swig=/home/pbsbuild/ramdisk/workspace/build/linux312_x86_64-work/swig -D–with-expat=/home/pbsbuild/ramdisk/workspace/build/linux312_x86_64-work/expat -D–with-hwloc=/home/pbsbuild/ramdisk/workspace/build/linux312_x86_64-work/hwloc -D–with-webapi=/home/pbsbuild/ramdisk/workspace/build/linux312_x86_64-work/webapi --enable-alps -D–prefix=/opt/pbs /home/pbsbuild/ramdisk/workspace/build/pbspro
root 12543 12494 0 16:54 pts/1 00:00:00 grep --color=auto cmake

As am unable to attach the full strace log, sharing the snippet:

10654 — SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=12454, si_status=0, …} —
10654 read(3, 0x7fffdd5d6643, 1) = -1 EAGAIN (Resource temporarily unavailable)
10654 write(4, “\1”, 1) = 1
10654 rt_sigreturn() = -1 EINTR (Interrupted system call)
10654 select(4, [3], NULL, NULL, NULL) = 1 (in [3])
10654 read(3, “\1”, 1024) = 1
10654 rt_sigprocmask(SIG_BLOCK, [INT TERM], [], 8) = 0
10654 wait4(12454, [{WIFEXITED(s) && WEXITSTATUS(s) == 0}], WNOHANG, NULL) = 12454
10654 close(4) = 0
10654 rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
10654 select(4, [3], NULL, NULL, NULL) = 1 (in [3])
10654 read(3, “”, 1024) = 0
10654 close(3) = 0
10654 rt_sigaction(SIGCHLD, {SIG_DFL, [], SA_RESTORER, 0x7ffca2725890}, NULL, 8) = 0
.
.
12549 execve("/usr/bin/pkg-config", ["/usr/bin/pkg-config", “–libs-only-l”, “expat”], [/* 69 vars */] <unfinished …>
10654 <… read resumed> “”, 1) = 0
12549 <… execve resumed> ) = 0
10654 close(11) = 0
12549 brk(0 <unfinished …>
10654 rt_sigprocmask(SIG_SETMASK, [], <unfinished …>
12549 <… brk resumed> ) = 0xf34000
10654 <… rt_sigprocmask resumed> NULL, 8) = 0
10654 read(9, <unfinished …>
12549 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0 <unfinished …>
10654 <… read resumed> “”, 1024) = 0
12549 <… mmap resumed> ) = 0x7fce89436000
10654 close(9) = 0
12549 access("/etc/ld.so.preload", R_OK <unfinished …>
10654 close(6 <unfinished …>
12549 <… access resumed> ) = -1 ENOENT (No such file or directory)
10654 <… close resumed> ) = 0
10654 close(8 <unfinished …>
12549 open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC <unfinished …>
10654 <… close resumed> ) = 0
12549 <… open resumed> ) = 3
10654 select(8, [3 5 7], NULL, NULL, NULL <unfinished …>
12549 fstat(3, {st_mode=S_IFREG|0644, st_size=78202, …}) = 0

Noticed, after running strace the hung got cleared

Noticed similar type of hang at pkg-config for FindX11.cmake module too:

/opt/tools/share/cmake-3.15/Modules/FindPkgConfig.cmake(56): set(PKG_FONTCONFIG_STATIC_CFLAGS -I/usr/include/freetype2 CACHE INTERNAL )
Called from: [8] /opt/tools/share/cmake-3.15/Modules/FindPkgConfig.cmake
[7] /opt/tools/share/cmake-3.15/Modules/FindPkgConfig.cmake
[6] /opt/tools/share/cmake-3.15/Modules/FindPkgConfig.cmake
[5] /opt/tools/share/cmake-3.15/Modules/FindPkgConfig.cmake
[4] /opt/tools/share/cmake-3.15/Modules/FindPkgConfig.cmake
[3] /opt/tools/share/cmake-3.15/Modules/FindFontconfig.cmake
[2] /opt/tools/share/cmake-3.15/Modules/FindX11.cmake
[1] /home/pbsbuild/ramdisk/workspace/build/pbspro/CMakeLists.txt
/opt/tools/share/cmake-3.15/Modules/FindPkgConfig.cmake(497): _pkgconfig_invoke_dyn(fontconfig PKG_FONTCONFIG CFLAGS_OTHER --cflags-only-other )
Called from: [5] /opt/tools/share/cmake-3.15/Modules/FindPkgConfig.cmake
[4] /opt/tools/share/cmake-3.15/Modules/FindPkgConfig.cmake
[3] /opt/tools/share/cmake-3.15/Modules/FindFontconfig.cmake
[2] /opt/tools/share/cmake-3.15/Modules/FindX11.cmake
[1] /home/pbsbuild/ramdisk/workspace/build/pbspro/CMakeLists.txt
/opt/tools/share/cmake-3.15/Modules/FindPkgConfig.cmake(98): _pkgconfig_invoke(fontconfig PKG_FONTCONFIG CFLAGS_OTHER --cflags-only-other )
Called from: [6] /opt/tools/share/cmake-3.15/Modules/FindPkgConfig.cmake
[5] /opt/tools/share/cmake-3.15/Modules/FindPkgConfig.cmake
[4] /opt/tools/share/cmake-3.15/Modules/FindPkgConfig.cmake
[3] /opt/tools/share/cmake-3.15/Modules/FindFontconfig.cmake
[2] /opt/tools/share/cmake-3.15/Modules/FindX11.cmake
[1] /home/pbsbuild/ramdisk/workspace/build/pbspro/CMakeLists.txt
/opt/tools/share/cmake-3.15/Modules/FindPkgConfig.cmake(61): set(_pkgconfig_invoke_result )
Called from: [7] /opt/tools/share/cmake-3.15/Modules/FindPkgConfig.cmake
[6] /opt/tools/share/cmake-3.15/Modules/FindPkgConfig.cmake
[5] /opt/tools/share/cmake-3.15/Modules/FindPkgConfig.cmake
[4] /opt/tools/share/cmake-3.15/Modules/FindPkgConfig.cmake
[3] /opt/tools/share/cmake-3.15/Modules/FindFontconfig.cmake
[2] /opt/tools/share/cmake-3.15/Modules/FindX11.cmake
[1] /home/pbsbuild/ramdisk/workspace/build/pbspro/CMakeLists.txt
/opt/tools/share/cmake-3.15/Modules/FindPkgConfig.cmake(63): execute_process(COMMAND /usr/bin/pkg-config --cflags-only-other fontconfig OUTPUT_VARIABLE _pkgconfig_invoke_result RESULT_VARIABLE _pkgconfig_failed OUTPUT_STRIP_TRAILING_WHITESPACE )
Called from: [7] /opt/tools/share/cmake-3.15/Modules**/FindPkgConfig.cmake**
[6] /opt/tools/share/cmake-3.15/Modules/FindPkgConfig.cmake
[5] /opt/tools/share/cmake-3.15/Modules/FindPkgConfig.cmake
[4] /opt/tools/share/cmake-3.15/Modules/FindPkgConfig.cmake
[3] /opt/tools/share/cmake-3.15/Modules/FindFontconfig.cmake
[2] /opt/tools/share/cmake-3.15/Modules/FindX11.cmake
[1] /home/pbsbuild/ramdisk/workspace/build/pbspro/CMakeLists.txt
^C

CMake is not progressing after this.

pbi-26-s12-cray:/home/pbsbuild/ramdisk/workspace/build # /usr/bin/pkg-config --cflags-only-other fontconfig

pbi-26-s12-cray:/home/pbsbuild/ramdisk/workspace/build #

corresponding strace log:

22964 execve("/usr/bin/pkg-config", ["/usr/bin/pkg-config", “–static”, “–cflags-only-other”, “fontconfig”], [/* 69 vars */] <unfinished …>
21009 <… read resumed> “”, 1) = 0
22964 <… execve resumed> ) = 0
21009 close(11) = 0
21009 rt_sigprocmask(SIG_SETMASK, [], <unfinished …>
22964 brk(0 <unfinished …>
21009 <… rt_sigprocmask resumed> NULL, 8) = 0
22964 <… brk resumed> ) = 0x1aa3000
21009 read(9, “”, 1024) = 0
21009 close(9 <unfinished …>
22964 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0 <unfinished …>
21009 <… close resumed> ) = 0
22964 <… mmap resumed> ) = 0x7f554247c000
21009 close(6) = 0
22964 access("/etc/ld.so.preload", R_OK <unfinished …>
21009 close(8 <unfinished …>
22964 <… access resumed> ) = -1 ENOENT (No such file or directory)
21009 <… close resumed> ) = 0
21009 select(8, [3 5 7], NULL, NULL, NULL <unfinished …>

Is there any problem in pkg-config for SLES12 platform ?

Noticed cmake hung issue for “cmake version 3.19.2” also.

/opt/tools/share/cmake-3.19/Modules/FindPkgConfig.cmake(571): _pkgconfig_invoke(expat PC_EXPAT VERSION --modversion )
Called from: [4] /opt/tools/share/cmake-3.19/Modules/FindPkgConfig.cmake
[3] /opt/tools/share/cmake-3.19/Modules/FindPkgConfig.cmake
[2] /home/pbsbuild/ramdisk/workspace/build/pbspro/cmake/FindEXPAT.cmake
[1] /home/pbsbuild/ramdisk/workspace/build/pbspro/CMakeLists.txt
/opt/tools/share/cmake-3.19/Modules/FindPkgConfig.cmake(88): set(_pkgconfig_invoke_result )
Called from: [5] /opt/tools/share/cmake-3.19/Modules/FindPkgConfig.cmake
[4] /opt/tools/share/cmake-3.19/Modules/FindPkgConfig.cmake
[3] /opt/tools/share/cmake-3.19/Modules/FindPkgConfig.cmake
[2] /home/pbsbuild/ramdisk/workspace/build/pbspro/cmake/FindEXPAT.cmake
[1] /home/pbsbuild/ramdisk/workspace/build/pbspro/CMakeLists.txt
/opt/tools/share/cmake-3.19/Modules/FindPkgConfig.cmake(90): execute_process(COMMAND /usr/bin/pkg-config --modversion expat OUTPUT_VARIABLE _pkgconfig_invoke_result RESULT_VARIABLE _pkgconfig_failed OUTPUT_STRIP_TRAILING_WHITESPACE )
Called from: [5] /opt/tools/share/cmake-3.19/Modules/FindPkgConfig.cmake
[4] /opt/tools/share/cmake-3.19/Modules/FindPkgConfig.cmake
[3] /opt/tools/share/cmake-3.19/Modules/FindPkgConfig.cmake
[2] /home/pbsbuild/ramdisk/workspace/build/pbspro/cmake/FindEXPAT.cmake
[1] /home/pbsbuild/ramdisk/workspace/build/pbspro/CMakeLists.txt

Output of the command from cli:

pbi-32-s12:/home/sudemo # /usr/bin/pkg-config --modversion expat
2.1.0
pbi-32-s12:/home/sudemo #usage

Strace log snippet:

27674 write(2, “/opt/tools/share/cmake-3.19/Modu”…, 133) = 133
27674 write(2, “\n Called from: [6]\t/opt/tools/”…, 473) = 473
27674 write(2, “\n”, 1) = 1
.
.
3811 execve("/usr/bin/pkg-config", ["/usr/bin/pkg-config", “–variable=prefix”, “expat”], [/* 130 vars */] <unfinished …>
27674 <… read resumed> “”, 1) = 0
3811 <… execve resumed> ) = 0
27674 close(11) = 0
3811 brk(0 <unfinished …>
27674 rt_sigprocmask(SIG_SETMASK, [QUIT], <unfinished …>
3811 <… brk resumed> ) = 0xb34000
27674 <… rt_sigprocmask resumed> NULL, 8) = 0
27674 read(9, “”, 1024) = 0
3811 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0 <unfinished …>
27674 close(9 <unfinished …>
3811 <… mmap resumed> ) = 0x7f0c305f1000
27674 <… close resumed> ) = 0
27674 close(6 <unfinished …>
3811 access("/etc/ld.so.preload", R_OK <unfinished …>
27674 <… close resumed> ) = 0
3811 <… access resumed> ) = -1 ENOENT (No such file or directory)
27674 close(8) = 0
3811 open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC <unfinished …>
27674 select(8, [3 5 7], NULL, NULL, NULL <unfinished …>
3811 <… open resumed> ) = 3
3811 fstat(3, {st_mode=S_IFREG|0644, st_size=97128, …}) = 0
3811 mmap(NULL, 97128, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f0c305d9000
3811 close(3) = 0

Ca you please confirm whether the problem exists in FindPkgConfig.cmake module or SLES12 platform specific ?

I haven’t heard about it from anyone else at least. I’ll keep an eye out for similar reports though.