On 12/6/18 4:16 PM, Jochen Sprickerhof wrote: > after reading up on this, I think this needs fixing in cmake. > > So neither adding -lpthread, > nor adding /usr/lib/x86_64-linux-gnu/libpthread.so > seems correct to me.
Both are valid ways to link to the pthread library, which is all the `-pthread` flag does when used to drive linking. > I will revert the workaround in ros-catkin if you agree. The patch here: http://launchpadlibrarian.net/399812910/ros-catkin_0.7.14-7_0.7.14-7ubuntu1.diff.gz is not a workaround. The input to that logic could contain -lfoo generated by other means for other libraries. This case just happened to expose the existing bug in that logic. Actually looking at the applied fix https://sources.debian.org/src/ros-catkin/0.7.14-8/cmake/templates/pkgConfig.cmake.in/#L118 that logic may need additional work to handle plain `-pthread` or other link flags. > [FindThreads] promotes CMAKE_THREAD_PREFER_PTHREAD to get -pthread It's THREADS_PREFER_PTHREAD_FLAG for that. CMake's FindBoost and FindThreads could use some work to use `-pthread` more completely (perhaps with a policy to use it by default on appropriate compilers), and there is an issue related to this here: https://gitlab.kitware.com/cmake/cmake/issues/18638 However, that does not mean the above change should be reverted. -Brad

