Unable to link my package with user-defined libraries

asked 2023-05-18 23:35:20 -0500

Ibrahim_aerospace gravatar image

Hello all, I have a package that is dependent on two user defined libaries. When I try to compile the package it prints the error:

/usr/bin/ld: cannot find -lxform_utils
/usr/bin/ld: cannot find -lpcl_utils
collect2: error: ld returned 1 exit status

It seems like my libraries are not successfully installed? This is how I installed my libaries. Do I missed something?

add_library(pcl_utils src/pcl_utils.cpp)

target_link_libraries(pcl_utils ${catkin_LIBRARIES})

catkin_package(INCLUDE_DIRS include
               LIBRARIES pcl_utils)

install(
  TARGETS pcl_utils
  ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
  LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
  RUNTIME DESTINATION ${CATKIN_GLOBAL_BIN_DESTINATION}
)

install(
  DIRECTORY include/pcl_utils/
  DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION}
)

I followed the same method for both libaries. The CMakeLists.txt file of the package that I want to compile is:

cmake_minimum_required(VERSION 3.0.2)
project(object_finder)

## Find catkin macros and libraries
find_package(catkin REQUIRED COMPONENTS
  pcl_utils
  actionlib
  sensor_msgs
  geometry_msgs
  tf
  xform_utils
  message_generation
  actionlib_msgs
)

## System dependencies are found with CMake's conventions
find_package(Boost REQUIRED COMPONENTS system thread)



add_action_files(
   DIRECTORY action
   FILES objectFinder.action
 )

generate_messages(
   DEPENDENCIES roscpp sensor_msgs geometry_msgs actionlib
 )


catkin_package(
  CATKIN_DEPENDS roscpp sensor_msgs actionlib geometry_msgs xform_utils
  DEPENDS system_lib
)

include_directories(
# include
  ${catkin_INCLUDE_DIRS}
)

add_executable(object_finder_as src/object_finder_as.cpp)
add_executable(example_object_finder_action_client src/example_object_finder_action_client.cpp)


add_dependencies(object_finder_as ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS})
add_dependencies(example_object_finder_action_client ${catkin_EXPORTED_TARGETS})


target_link_libraries(object_finder_as 
                      ${catkin_LIBRARIES} 
                      xform_utils
                      pcl_utils )
target_link_libraries(example_object_finder_action_client 
                      ${catkin_LIBRARIES} 
                      xform_utils
                      pcl_utils )

Any help would be appreciated.

edit retag flag offensive close merge delete