Skip to content
This repository was archived by the owner on May 31, 2025. It is now read-only.

strip "-l" from "-lpthread" library, to fix a build failure on ros-ros-comm#975

Merged
dirk-thomas merged 1 commit intoros:kinetic-develfrom
jspricke:minus_l_lib
Jan 26, 2019
Merged

strip "-l" from "-lpthread" library, to fix a build failure on ros-ros-comm#975
dirk-thomas merged 1 commit intoros:kinetic-develfrom
jspricke:minus_l_lib

Conversation

@jspricke
Copy link
Copy Markdown
Member

@jspricke jspricke commented Dec 2, 2018

No description provided.

@dirk-thomas
Copy link
Copy Markdown
Member

This looks like a duplicate of #856.

@jspricke
Copy link
Copy Markdown
Member Author

Some more reasoning for this here: https://bugs.debian.org/915148

@mathias-luedtke
Copy link
Copy Markdown
Contributor

@dirk-thomas: TL;DR: Upstream CMake just started to inject -lpthread into Boost_LIBRARIES .

@dirk-thomas
Copy link
Copy Markdown
Member

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.

@wajeehulhassanvii
Copy link
Copy Markdown

No description provided.

Felix Geyer
@jspricke
strip "-l" from "-lpthread" library, to fix a build failure on ros-ro…

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

@xlla
Copy link
Copy Markdown

xlla commented Jul 20, 2019

@dirk-thomas: TL;DR: Upstream CMake just started to inject -lpthread into Boost_LIBRARIES .

when built ros melodic in raspberry pi, stretch, I am encounter same error, even no '-l' before 'pthread'.
after change to boost-libraries, it work.

sloretz added a commit to sloretz/catkin that referenced this pull request Aug 3, 2019
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>
dirk-thomas pushed a commit that referenced this pull request Oct 7, 2019
* 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>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants