strip "-l" from "-lpthread" library, to fix a build failure on ros-ros-comm#975
Conversation
|
This looks like a duplicate of #856. |
|
Some more reasoning for this here: https://bugs.debian.org/915148 |
|
@dirk-thomas: TL;DR: Upstream CMake just started to inject |
|
With the changes in CMake being rolled out I guess we don't have another option than to accept this case and pass it along. Thanks for the patch. |
Felix Geyer Felix, can you please let me know where can I apply this patch in simple steps to get it working. Currently I am stuck at -lpthread error and since I'm new to ROS therefore there's nothing much I can do. Thanks |
when built ros melodic in raspberry pi, stretch, I am encounter same error, even no '-l' before 'pthread'. |
FindBoost.cmake blindly adds `${CMAKE_THREAD_LIBS_INIT}` to
`${Boost_LIBRARIES}` when the component `thread` is found.
On Debian buster the `FindThreads.cmake` sets that to `-pthread`.
This breaks a bunch of stuff becakse `-pthread` is a linker flag, not a
library.
There were earlier fixes for `-lpthread`.
This PR expands upon them.
First this PR modifies the fix from ros#998 to not add `-l` to any linker flag.
Second it adds to the fix in ros#975 to make sure `-pthread` is passed to
downstream users.
There's no standard cmake variable for linker flags, so this PR opts to
create an interface target with just the flag, and add that to
`${PROJECT_NAME}_LIBRARIES` instead.
Both this PR and ros-visualization/python_qt_binding#68 are required to strip or `qt_gui_cpp` will fail at link time.
Signed-off-by: Shane Loretz <sloretz@osrfoundation.org>
* Fix -pthread handling in Debian buster
FindBoost.cmake blindly adds `${CMAKE_THREAD_LIBS_INIT}` to
`${Boost_LIBRARIES}` when the component `thread` is found.
On Debian buster the `FindThreads.cmake` sets that to `-pthread`.
This breaks a bunch of stuff becakse `-pthread` is a linker flag, not a
library.
There were earlier fixes for `-lpthread`.
This PR expands upon them.
First this PR modifies the fix from #998 to not add `-l` to any linker flag.
Second it adds to the fix in #975 to make sure `-pthread` is passed to
downstream users.
There's no standard cmake variable for linker flags, so this PR opts to
create an interface target with just the flag, and add that to
`${PROJECT_NAME}_LIBRARIES` instead.
Both this PR and ros-visualization/python_qt_binding#68 are required to strip or `qt_gui_cpp` will fail at link time.
Signed-off-by: Shane Loretz <sloretz@osrfoundation.org>
* math() output actually used
Signed-off-by: Shane Loretz <sloretz@osrfoundation.org>
* dummyN -> wrapped-linker-optionsN
Signed-off-by: Shane Loretz <sloretz@osrfoundation.org>
* Fix pre-3.13.0 target property setting
Signed-off-by: Shane Loretz <sloretz@osrfoundation.org>
* Add test for propagation of linker options
Signed-off-by: Shane Loretz <sloretz@osrfoundation.org>
* Force add CMakeLists.txt
Signed-off-by: Shane Loretz <sloretz@osrfoundation.org>
* Indent using 2 spaces
Signed-off-by: Shane Loretz <sloretz@osrfoundation.org>
* Increment until target is unique
Signed-off-by: Shane Loretz <sloretz@osrfoundation.org>
No description provided.