Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from
Jan 26, 2019

Conversation

jspricke
Copy link
Member

@jspricke jspricke commented Dec 2, 2018

No description provided.

@dirk-thomas
Copy link
Member

This looks like a duplicate of #856.

@jspricke
Copy link
Member Author

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

@mathias-luedtke
Copy link
Contributor

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

@dirk-thomas
Copy link
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

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

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 join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants