Executing: compile_rules can't find file to patch at input line 3 Perhaps you used the wrong -p or --strip option? The text leading up to this was: -------------------------- |--- CMakeLists.txt 2022-06-18 19:10:05.000000000 +0200 |+++ CMakeLists.txt 2022-06-18 19:10:18.000000000 +0200 -------------------------- File to patch: Skip this patch? [y] Skipping patch. 1 out of 1 hunk ignored
The one for "-lpthreads" just accidentally happened to be the last one in the log...
Solution: go through the log from the top, identify the section with the configure checks, find the last configure check prior to the point, where CMake identifies failure and dumps its logs.You might also try so search for the text "Configuring incomplete, errors occurred!"
I fight with slim :/.
Issue with cmake build :
-- Found PkgConfig: /usr/bin/pkg-config (found version "0.29.2") -- Checking for one of the modules 'fontconfig' CMake Error at /usr/share/cmake-3.22/Modules/FindPkgConfig.cmake:890 (message): None of the required 'fontconfig' found Call Stack (most recent call first): cmake/modules/FONTCONFIGConfig.cmake:18 (pkg_search_module) CMakeLists.txt:108 (find_package)
FontConfig Found PAM disabled ConsoleKit disabled -- 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 -- Found Threads: TRUE -- Configuring incomplete, errors occurred!
I have c++ project that was smoothly running on a given machine, and now I am trying to compile it on another one with the same operating system (Xubuntu 14.04).
I've installed all the dependencies and I'am using cmake to build the project, although it stops with the following error:
Determining if the function pthread_create exists in the pthreads failed with the following output: ... /usr/bin/ld: cannot find -lpthreads
9 Answers
31
The problem was happening when running cmake. Though, in this case cmake was not the problem the error was silent and the -lpthreads related error/warning was the only thing being written to the cmake error log file, although that was not causing any issue. I've done a minimal version of the cmakelists.txt and started testing it line by line until I found which package was causing it to stop: finally I found it was a version mismatch...
Hint: search for the actual error message
Typically you'd look for the last error message. However, this (often useful) strategy in such cases leads astray.
What you are looking at is the CMakeCache.txt, the CMakeOutput.log or the CMakeError.log. How comes? When some of the macros or tests in the configure phase fails, CMake "helpfully" dumps these files to the output. Unfortunately, these files can be thousands of lines long, and typically contain lots of "*** Error: xyz" entries, for various configure checks. The one for "-lpthreads" just accidentally happened to be the last one in the log...
Solution: go through the log from the top, identify the section with the configure checks, find the last configure check prior to the point, where CMake identifies failure and dumps its logs. You might also try so search for the text "Configuring incomplete, errors occurred!"
Typically you'll either find a very precise actual error message there, or at least you find the name / path of the macro or function called last, and this allows you to pinpoint down what actually went wrong.
-- Found PkgConfig: /usr/bin/pkg-config (found version "0.29.2")
-- Checking for one of the modules 'fontconfig' CMake Error at /usr/share/cmake-3.22/Modules/FindPkgConfig.cmake:890 (message): None of the required 'fontconfig' found Call Stack (most recent call first): cmake/modules/FONTCONFIGConfig.cmake:18 (pkg_search_module) CMakeLists.txt:108 (find_package) FontConfig Found PAM disabled ConsoleKit disabled
-- Looking for pthread.h
-- Found PkgConfig: /usr/bin/pkg-config (found version "0.29.2")
-- 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 -- Found Threads: TRUE -- Configuring incomplete, errors occurred!
cmake-3.22 or cmake-3.19.5
-- Checking for one of the modules 'fontconfig' CMake Error at /usr/share/cmake-3.22/Modules/FindPkgConfig.cmake:890 (message): None of the required 'fontconfig' found
Building C object CMakeFiles/cmTC_88b6c.dir/CheckFunctionExists.c.o /usr/bin/cc -march=i486 -Os -pipe -fomit-frame-pointer -Wall -g -O2 -DCHECK_FUNCTION_EXISTS=pthread_create -o CMakeFiles/cmTC_88b6c.dir/CheckFunctionExists.c.o -c /usr/share/cmake-3.22/Modules/CheckFun
QA: Unable to reach: http://slim.berlios.de sh: bad number Checking build dependencies... Installing dep (pkg/local): cmake-3.19.5.tazpkg
[91/124] Generating PangoXft-1.0.typelib with a custom command [92/124] Generating PangoCairo-1.0.gir with a custom command /usr/lib/gcc/i486-slitaz-linux/8.2.0/include/stddef.h:435: syntax error, unexpected identifier in ' __float128 __max_align_f128 __attribute__((__aligned__(__alignof(__float128))));' at '__float128' ../pango/pangocairo.h:42: Warning: PangoCairo: symbol='PANGO_IS_CAIRO_FONT': Skipping foreign symbol from namespace Pango ../pango/pangocairo.h:56: Warning: PangoCairo: symbol='PANGO_IS_CAIRO_FONT_MAP': Skipping foreign symbol from namespace