Hello Im trying to write a client node using ros2 humble hawksbill distribution. For the node Im using a shared library for my depth camera. I have linked the .so file as I would normally do in my CMakelists.txt. The .so file is placed in a folder in my package called /thirdparty. This is how I have linked the .so file in the CMakelists.txt file:
if (CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL "aarch64")
find_library(libCubeEye NAMES libCubeEye.so HINTS ${PROJECT_SOURCE_DIR}/thirdparty/aarch64/libcubeeye/lib/)
elseif(CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL "x86_64")
if(UNIX)
find_library(libCubeEye NAMES libCubeEye.so HINTS ${PROJECT_SOURCE_DIR}/thirdparty/x86_64/libcubeeye/lib)
endif(UNIX)
endif()
if (NOT libCubeEye)
message(FATAL_ERROR "libCubeEye library not found")
endif()
#ament_export_targets(libCubeEye HAS_LIBRARY_TARGET)
include_directories(
${OpenCV_INCLUDE_DIRS}
thirdparty/${CMAKE_HOST_SYSTEM_PROCESSOR}/libcubeeye/include
thirdparty/${CMAKE_HOST_SYSTEM_PROCESSOR}/onnxruntime-linux-x64-1.15.1/include
)
It builds without issues but as soon as I run my node, I get the following error:
/home/victor/ros2_ws/install/cpp_inference_client/lib/cpp_inference_client/infernce_client: error while loading shared libraries: libCubeEye.so: cannot open shared object file: No such file or directory [ros2run]: Process exited with failure 127