Robotics StackExchange | Archived questions

Correct way to export external library .so with ros2 package

My ros2 package depends on an external .so file. What is the correct way to ship this package while also shipping the .so with the package. I am trying to avoid a system install of the .so file.

Following leads to link error (cannot find -lexternallib) when another package tries to depend on mypackage

install(FILES
  thirdparty/lib/libexternal_lib.so
  DESTINATION lib/
)

Appreciate any help.

If anyone else has this issue, got some pointers from link text. Following works

add_library(external_lib SHARED thirdparty/lib/libexternal_lib.so)
set_target_properties(external_lib PROPERTIES LINKER_LANGUAGE CXX)
ament_export_targets(external_libTargets HAS_LIBRARY_TARGET)

Asked by tdan on 2023-04-25 12:14:04 UTC

Comments

Answers