[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

CMake help: pthread linking issue

Dear mentors,

I am trying to update salmon [1] to the latest upstream version, but it
won't build for reasons I can not really track down well. It uses CMake
as the build system, which I am really not familiar with and to me feels
a bit like magic incantations to me that mostly work if you use the
right spells ;)

Here's the last snippet of build log right before the failure:

Determining if the function pthread_create exists in the pthreads failed
with the following output:
Change Dir: /build/salmon-0.8.0+ds1/obj-x86_64-linux-gnu/CMakeFiles/CMakeTmp

Run Build Command:"/usr/bin/make" "cmTC_14592/fast"
make[2]: Entering directory
/usr/bin/make -f CMakeFiles/cmTC_14592.dir/build.make
make[3]: Entering directory
Building C object CMakeFiles/cmTC_14592.dir/CheckFunctionExists.c.o
/usr/lib/ccache/cc   -g -O2 -fdebug-prefix-map=/build/salmon-0.8.0+ds1=.
-fstack-protector-strong -Wformat -Werror=format-security -Wdate-time
CMakeFiles/cmTC_14592.dir/CheckFunctionExists.c.o   -c
Linking C executable cmTC_14592
/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_14592.dir/link.txt
/usr/lib/ccache/cc -g -O2 -fdebug-prefix-map=/build/salmon-0.8.0+ds1=.
-fstack-protector-strong -Wformat -Werror=format-security -Wdate-time
-D_FORTIFY_SOURCE=2 -DCHECK_FUNCTION_EXISTS=pthread_create  -Wl,-z,relro
-Wl,-z,now  -rdynamic CMakeFiles/cmTC_14592.dir/CheckFunctionExists.c.o
-o cmTC_14592 -lpthreads
/usr/bin/ld: cannot find -lpthreads
collect2: error: ld returned 1 exit status
make[3]: *** [CMakeFiles/cmTC_14592.dir/build.make:87: cmTC_14592] Error 1
make[3]: Leaving directory
make[2]: *** [Makefile:126: cmTC_14592/fast] Error 2
make[2]: Leaving directory

It looks like CMake can not find the POSIX threads libs (just the
headers? or a library?) and tries various spellings and variations of
the library to autodetect the correct situation on the platform? At
least there seems to be some automagically created code involved that
the build process is trying to compile...

Maybe someone more familiar with CMake could give me some pointer where
to continue looking? I'm a bit lost. I've tried to add
libpthread-stubs0-dev to the build-deps but no success.

I have also attached a full build log.

Thanks in advance

[1] https://salsa.debian.org/med-team/salmon

Attachment: buildlog.txt.gz
Description: application/gzip

Attachment: signature.asc
Description: OpenPGP digital signature

Reply to: