ros-simulation/stage_ros

stage_ros needs -ldl to be built but it's a order problem

lepalom opened this issue · 1 comments

Hi,

building stage_ros in a Debian Wheezy/Jessie/Unstable we have found that it fails because the -ldl of a link to libdl is missed. After dig a bit on the net and test it, I found that it's a problem with the order of the link procedure.

So, in stage_ros/CMakeLists.txt instead of add set(${PROJECT_NAME}_extra_libs dl) just change the order of:

target_link_libraries(stageros
  ${catkin_LIBRARIES}
  ${Boost_LIBRARIES}
  ${FLTK_LIBRARIES}
  ${Stage_LIBRARIES}
  ${${PROJECT_NAME}_extra_libs}
)

by:

target_link_libraries(stageros 
  ${catkin_LIBRARIES} 
  ${Boost_LIBRARIES}
  ${Stage_LIBRARIES} 
  ${FLTK_LIBRARIES}
)

and it compiles without problem.

Thanks for the report. Other systems like OS X have a similar issue, but I think the right thing to do is to conditionally not add dl as is done for OS X here:

https://github.com/ros-simulation/stage_ros/blob/master/CMakeLists.txt#L45-L47

The additional dl flag there not only compiles for Ubuntu, but it is required if I remember correctly.

Please consider opening a pull request with your proposed changes.