* Brad King <brad.k...@kitware.com> [2018-12-07 07:29]:
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 don't agree. Quoting from my mail: * Jochen Sprickerhof <jspri...@debian.org> [2018-12-06 22:16]:
| -pthread | | Define additional macros required for using the POSIX threads | library. You should use this option consistently for both | compilation and linking. This option is supported on GNU/Linux | targets, most other Unix derivatives, and also on x86 Cygwin and | MinGW targets.
"Define additional macros required" see: diff <(g++ -dM -E -x c++ - < /dev/null) <(g++ -pthread -dM -E -x c++ - < /dev/null) 106a107
#define _REENTRANT 1
(But I'm not a compiler expert.)
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.
I agree.
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.
I don't agree, -pthread should be in CXXFLAGS, whereas the pkgConfig.cmake process @PKG_CONFIG_LIBRARIES@.
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:
+1. Cheers Jochen
signature.asc
Description: PGP signature