linking to a specific version of library (libssl) in CmakeLists.txt

asked 2015-06-29 05:22:22 -0500

altella gravatar image

Hello all;

I am trying to link MvTec Halcon libraries in my ROS indigo node this way:

cmake_minimum_required(VERSION 2.8.3)

find_package(catkin REQUIRED COMPONENTS

find_package(PCL REQUIRED)

  INCLUDE_DIRS include



add_library(halcon_3d_lib src/halcon_3d_lib.cpp)
add_executable(ensenso_driver_node src/ensenso_driver_node.cpp)
add_executable(halcon3D_test_node src/halcon3D_test_node.cpp)

target_link_libraries(ensenso_driver_node ${catkin_LIBRARIES} ${PCL_LIBRARIES} halconcpp)
target_link_libraries(halcon_3d_lib ${catkin_LIBRARIES} ${PCL_LIBRARIES} halconcpp)
target_link_libraries(halcon3D_test_node ${catkin_LIBRARIES} ${PCL_LIBRARIES})

The problem I have is that when I use pcl:io module, the node links against libpq, and libpq to libssl. When I do not include link_directories(/opt/halcon/lib/x64-linux/) libssl is taken from /lib/x86_64-linux-gnu/ and everything works ok.

However, if add link_directories(/opt/halcon/lib/x64-linux/) the library is taken from /opt/halcon/lib/x64-linux.

Is there a way to specify in the CMakeLists.txt that PCL links against libssl in /lib/x86_64-linux-gnu/ and Halcon libraries against libssl in /opt/halcon/lib/x64-linux ?

How can I check differences between the two versions of libssl?

Thank you very much in advance.

edit retag flag offensive close merge delete


Are you aiming for one binary with two different libssl versions?

dornhege gravatar image dornhege  ( 2015-06-29 05:55:27 -0500 )edit

So just to clarify: you don't actually need your binaries to link against the SSL provided by Halcon?

gvdhoorn gravatar image gvdhoorn  ( 2015-06-29 05:59:42 -0500 )edit

It would be good to link Halcon with its own version of libssl to assess correct functionality, but I need the other libssl for, maybe yes, two versions of libssl in the same binary... could be possible?

altella gravatar image altella  ( 2015-06-29 07:12:15 -0500 )edit

Maybe this is possible somehow, but my intuition says, you're gonna get linker errors, because the same symbols will be there multiple times.

dornhege gravatar image dornhege  ( 2015-06-29 07:42:40 -0500 )edit

that's it...i think there is not a clean way to use both libraries in the same binary...

altella gravatar image altella  ( 2015-06-29 07:53:44 -0500 )edit

I have to agree with @dornhege: all my experience says this cannot be (cleanly) done. If it can be done, I'd expect segfaults as well once you get past any linker errors.

gvdhoorn gravatar image gvdhoorn  ( 2015-06-29 07:59:53 -0500 )edit