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

Make thread_priority a shared library #91

Merged
merged 1 commit into from
Sep 3, 2022

Conversation

AndyZe
Copy link

@AndyZe AndyZe commented Aug 27, 2022

This library should be shared so other shared libraries can link it.

I discovered this during this PR: moveit/moveit2#1540

Note that the library I'm linking it to is another shared (aka dynamic) library.

Prior to this PR I get this error:

--- stderr: moveit_servo
/usr/bin/ld: /home/andy/ws_ros2/install/realtime_tools/lib/libthread_priority.a(thread_priority.cpp.o): warning: relocation against `_ZTVSt9basic_iosIcSt11char_traitsIcEE@@GLIBCXX_3.4' in read-only section `.text.unlikely'
/usr/bin/ld: /home/andy/ws_ros2/install/realtime_tools/lib/libthread_priority.a(thread_priority.cpp.o): relocation R_X86_64_PC32 against symbol `_ZTTSt14basic_ifstreamIcSt11char_traitsIcEE@@GLIBCXX_3.4' can not be used when making a shared object; recompile with -fPIC

If you don't like the idea of making the thread_priority library SHARED, then another way to fix it is to add this to CMakeLists:

set(CMAKE_CXX_FLAGS "-fPIC ${CMAKE_CXX_FLAGS}")

@codecov-commenter
Copy link

Codecov Report

❗ No coverage uploaded for pull request base (master@0dc0e5f). Click here to learn what that means.
The diff coverage is n/a.

@@            Coverage Diff            @@
##             master      #91   +/-   ##
=========================================
  Coverage          ?   46.57%           
=========================================
  Files             ?       11           
  Lines             ?      511           
  Branches          ?      263           
=========================================
  Hits              ?      238           
  Misses            ?       31           
  Partials          ?      242           
Flag Coverage Δ
unittests 46.57% <0.00%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

Copy link
Member

@destogl destogl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! Thanks!

@destogl destogl merged commit 9d67515 into ros-controls:master Sep 3, 2022
@AndyZe AndyZe deleted the andyz/static_lib_linking branch December 7, 2022 18:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants