38

The cmake partial output looks like this:

-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
Neo
  • 676
  • 1
  • 4
  • 12
  • 1
    What is the exit code of cmake? Sometimes libraries search for functionality in multiple possible places. I saw similar output when building either cmake, xerces-c or qt5. Not sure which one it was, but unless cmake exits with a non-zero code, you're fine. Usually in case the exit code is non-0 the last 3 or so lines in the output contain a message that an error occured. If this is a open source lib, mentioning it could be helpful. I'm not sure this kind of output is predetermined by cmake. – fabian Oct 24 '20 at 15:04
  • There is no exit code since the cmake execution was complete and the makefile was created. Just trying to figure out if the make file missed out something because of the above failed operation – Neo Oct 24 '20 at 16:17
  • 1
    Even if cmake completes there is a exit code. Every program produces and exit code, non-zero exit code means there is an error. It's just not printed by default. You need to check for the type of console/script you're using, how to access that exit code. e.g. `echo $LastExitCode` for powershell, `echo $?` in bash... (both need to be run immediately after you run cmake, since they can only access the exit code of the last command) – fabian Oct 25 '20 at 05:57

1 Answers1

55

The lines

-- Looking for pthread.h
-- Looking for pthread.h - found
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found

are output of a call like

find_package(Threads)

This call is used in a script CMakeLists.txt by many CMake projects which want to use threads-related functionality (like pthread_create).

When process this call, CMake (by means of FindThreads.cmake script) tries to determine kind of thread support for the current platform.

The check Looking for pthread.h is self-explanatory: CMake checks whether header pthread.h exists and available.

The check Performing Test CMAKE_HAVE_LIBC_PTHREAD is about whether thread support functions are compiled into libc library directly, or one need to link additional libraries (like -lpthread).

The check Looking for pthread_create in pthreads tries to find pthreads library and function pthread_create in it.

The check Looking for pthread_create in pthread tries to find pthread library and function pthread_create in it.


That particular output could be interpreted as:

The platform supports threads by providing the header pthread.h and the library pthread.

This output is common for Unix-like systems. Despite "Failed" and "not found" words, this is perfectly good output.

Tsyvarev
  • 60,011
  • 17
  • 110
  • 153
  • So if I want to compile a windows Win32 would it be a problem or I should ignore this error? – Reza Akraminejad Nov 12 '22 at 08:11
  • @Hamed_gibago: What "error" are you talking about? There is no word "error" in the output. – Tsyvarev Nov 12 '22 at 10:26
  • This error: `Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed` – Reza Akraminejad Nov 12 '22 at 14:01
  • This is not the "error". And yes, you may ignore it. – Tsyvarev Nov 12 '22 at 15:03
  • Well, I'm build oneTbb for windows 10 and want to build it to use pagmo2 and pygmo2 in python 32 bit. After configuring building tbb, during build I get error: `LINK : fatal error LNK1104: cannot open file 'c:\hwloc-win32-build-2.5.0\lib.obj' [C:\oneTBB-master\build\src\tbbbind\t bbbind_2_5.vcxproj]` despite I downloaded and passed path of hwloc. Would you help me? – Reza Akraminejad Nov 12 '22 at 15:42
  • Looks like you have passed the path of hwlock incorrectly. Write a question post and describe all details about your problem in it. – Tsyvarev Nov 12 '22 at 21:46
  • I am installing DSView project at Debian 11.6. When I run `cmake CMakelists.txt` I get the same output, then I install `libpthreadpool-dev` and `libpthread-stubs0-dev`, and it was no more issue of the output. – tedy58 Mar 14 '23 at 14:17