Robotics StackExchange | Archived questions

How do I remove rdynamic from link options?

I've determined that a certain library I am using is not working properly because CMake is appending -rdynamic to the c++ compiler options for my node's object file. In other words, if I copy and paste the /usr/bin/c++ command generated when using VERBOSE=true catkin_make, and I run that command manually, the node works correctly only if I remove the -rdynamic flag.

How can I edit CMakeLists.txt to remove the -rdynamic flag, and will this cause ROS to break in unexpected ways?

Asked by duffany1 on 2016-04-07 16:12:42 UTC

Comments

Answers

Figured it out:

SET(CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS "")

Asked by duffany1 on 2016-04-07 16:39:19 UTC

Comments

If it is really necessary, I'd recommend doing it just for the target that needs it, instead of resetting linking flags for the entire project. CMake supports configuring flags on a per target basis, see target_compile_options.

Asked by gvdhoorn on 2016-04-08 02:39:27 UTC

I found that I can do the same with:

set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--no-export-dynamic")

Which I think is a bit more self documenting

Asked by dheater on 2018-11-01 19:20:10 UTC