CMake using -lpthreads instead of -lpthread

Problems with packages? Post here, using [tags] of the package name.

CMake using -lpthreads instead of -lpthread

Postby TortugaJay » Thu Sep 14, 2017 6:17 pm

Hi,

My apologies if this is a general Arch issue, but it seems to be specific to ARM.
This is output I get from cmake, building a custom app which works fine everywhere else:
(internet searching seems to suggest this should be using -lpthread, not -lpthreads, or disabling this feature if it isn't supported in the built in c++ compiler)

Linking CXX executable cmTC_1b1c7
/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_1b1c7.dir/link.txt --verbose=1
/usr/bin/c++ -DCHECK_FUNCTION_EXISTS=pthread_create CMakeFiles/cmTC_1b1c7.dir/CheckFunctionExists.cxx.o -o cmTC_1b1c7 -lpthreads
/usr/bin/ld: cannot find -lpthreads
collect2: error: ld returned 1 exit status


# uname -a
Linux alarmpi 4.9.50-1-ARCH #1 SMP Thu Sep 14 01:28:48 UTC 2017 armv6l GNU/Linux


Thanks!
TortugaJay
 
Posts: 4
Joined: Thu Sep 14, 2017 6:12 pm

Re: CMake using -lpthreads instead of -lpthread

Postby WarheadsSE » Thu Sep 14, 2017 6:38 pm

This would be an odd item to be at the distribution level. It should indeed be `lpthread`, as there is no `/usr/lib/libpthreads.so`, but `/usr/lib/libpthread.so`

Can you please define "everywhere else" ?
Core Developer
Remember: Arch Linux ARM is entirely community donation supported!
WarheadsSE
Developer
 
Posts: 6807
Joined: Mon Oct 18, 2010 2:12 pm

Re: CMake using -lpthreads instead of -lpthread

Postby TortugaJay » Thu Sep 14, 2017 7:50 pm

grep -R "pthread" ./

returns nothing, so certainly this is not being called from the codebase.

It's working on Ubuntu; I have not tested on Arch x86 yet, however I'd be shocked if something like this wasn't caught on x86 yet.
TortugaJay
 
Posts: 4
Joined: Thu Sep 14, 2017 6:12 pm

Re: CMake using -lpthreads instead of -lpthread

Postby WarheadsSE » Fri Sep 15, 2017 3:39 pm

I am still not certain this is a distribution level cmake bug, but we'd have to try it on another ARM distribution to be sure. Please grep for `Threads`
Core Developer
Remember: Arch Linux ARM is entirely community donation supported!
WarheadsSE
Developer
 
Posts: 6807
Joined: Mon Oct 18, 2010 2:12 pm

Re: CMake using -lpthreads instead of -lpthread

Postby TortugaJay » Fri Sep 15, 2017 4:18 pm

./CMakeLists.txt:find_package(Threads REQUIRED)
./CMakeLists.txt:target_link_libraries(zmq-proxy ${COMMON_LIBS} Threads::Threads)
TortugaJay
 
Posts: 4
Joined: Thu Sep 14, 2017 6:12 pm

Re: CMake using -lpthreads instead of -lpthread

Postby TortugaJay » Sun Sep 24, 2017 9:07 pm

How do I track down the source of the issue?

Thanks!
TortugaJay
 
Posts: 4
Joined: Thu Sep 14, 2017 6:12 pm


Return to Packages

Who is online

Users browsing this forum: No registered users and 7 guests