Robotics StackExchange | Archived questions

catkin_make isolated cannot find the a library file

hello, The problem is related to catkin_make_isolated. I am using cartographer_ROS. After I installed it using this link I am trying to build two more packages that were earlier built using catkin_make in another workspace. Now, one of the packages is used as a library for the other package. CMakeLists.txt of the second package that has a dependency on the first package can be found below.

. Meanwhile, motion_planning_functions, geometry_functions,motionplanningdatatypesare the source files fromcommonfunctionspackage. When I build the workspace usingcatkinmakeisolated`, I find the following error.

CMake Error at /home/anindya/motion_planning_ws/install_isolated/share/common_functions/cmake/common_functionsConfig.cmake:150 (message):
      Project 'dovs_rnd_project' tried to find library 'geometry_functions'.  The library is neither a target nor built/installed properly.  Did you compile project 'common_functions'? Did you find_package() it before the subdirectory containing its code is included?

Here common_functions is the first package and dovs_rnd_project is the second project.

cmake_minimum_required(VERSION 2.8.3)
project(dovs_rnd_project)
add_compile_options(-std=c++11)

find_package(Eigen3 REQUIRED)
include_directories("${EIGEN3_INCLUDE_DIR}")

find_package(catkin REQUIRED COMPONENTS
  roscpp
  rospy
  std_msgs
  common_functions
  message_generation
)

find_package(ompl REQUIRED)

set(OMPL_INCLUDE_DIR /home/trishant/OMPL)
include_directories("${OMPL_INCLUDE_DIR}")

find_package(Boost REQUIRED COMPONENTS program_options)
include_directories("${Boost_INCLUDE_DIR}")

find_package(OpenMP)
if (OPENMP_FOUND)
    set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
    set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
    set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${OpenMP_EXE_LINKER_FLAGS}")
endif()

 add_message_files(
   FILES
   planning_checks.msg
 )

 generate_messages(
   DEPENDENCIES
   std_msgs
 )

catkin_package(
  INCLUDE_DIRS include
  LIBRARIES dovs_useful_functions
  CATKIN_DEPENDS roscpp rospy std_msgs message_runtime
  DEPENDS Boost Eigen3
)

include_directories(
 include
  ${catkin_INCLUDE_DIRS}
  /usr/local/MATLAB/R2018b/extern/include/
)
${catkin_EXPORTED_TARGETS})


${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS})

 catkin_install_python(PROGRAMS
   scripts/controller_follow_path.py
   DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
 )
 install(DIRECTORY include/${PROJECT_NAME}/
   DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION}
   FILES_MATCHING PATTERN "*.h"
 )

add_library(dovs_useful_functions src/dovs_useful_functions.cpp)
target_link_libraries(dovs_useful_functions geometry_functions motion_planning_data_types ${catkin_LIBRARIES})

add_library(common_variables src/common_variables.cpp)
target_link_libraries(common_variables ${catkin_LIBRARIES})

add_executable(plot_dovs src/plot_dovs.cpp)
target_link_libraries(plot_dovs dovs_useful_functions motion_planning_functions common_variables ${catkin_LIBRARIES})
add_dependencies(plot_dovs dovs_rnd_project_generate_messages_cpp)

add_executable(obstacle_control src/obstacle_control.cpp)
target_link_libraries(obstacle_control common_variables ${catkin_LIBRARIES})
add_dependencies(obstacle_control dovs_rnd_project_generate_messages_cpp)

add_executable(test_codes src/test_codes.cpp)
target_link_libraries(test_codes ${catkin_LIBRARIES})
add_dependencies(test_codes dovs_rnd_project_generate_messages_cpp)

add_executable(optimal_planning src/optimal_planning.cpp)
target_link_libraries(optimal_planning ${Boost_LIBRARIES} ${OMPL_LIBRARIES} ${catkin_LIBRARIES})
add_dependencies(optimal_planning dovs_rnd_project_generate_messages_cpp)

add_executable(optimal_planning_parallel src/optimal_planning_parallel.cpp)
target_link_libraries(optimal_planning_parallel ${Boost_LIBRARIES} ${OMPL_LIBRARIES} ${catkin_LIBRARIES})
add_dependencies(optimal_planning_parallel dovs_rnd_project_generate_messages_cpp)

add_executable(optimal_planning_parallel_2 src/optimal_planning_parallel.cpp)
target_link_libraries(optimal_planning_parallel_2 ${Boost_LIBRARIES} ${OMPL_LIBRARIES} ${catkin_LIBRARIES})
add_dependencies(optimal_planning_parallel_2 dovs_rnd_project_generate_messages_cpp)

add_executable(extend_obstacles src/extend_obstacles.cpp)
target_link_libraries(extend_obstacles ${catkin_LIBRARIES})
add_dependencies(extend_obstacles dovs_rnd_project_generate_messages_cpp)

add_executable(bitstar_modified src/bitstar_modified.cpp)
target_link_libraries(bitstar_modified motion_planning_functions ${catkin_LIBRARIES})
add_dependencies(bitstar_modified dovs_rnd_project_generate_messages_cpp)

add_executable(bitstar_modified_improvised src/bitstar_modified_improvised.cpp)
target_link_libraries(bitstar_modified_improvised motion_planning_functions ${catkin_LIBRARIES})
add_dependencies(bitstar_modified_improvised dovs_rnd_project_generate_messages_cpp)

add_executable(only_move_smm src/only_move_smm.cpp)
target_link_libraries(only_move_smm ${catkin_LIBRARIES})
add_dependencies(only_move_smm dovs_rnd_project_generate_messages_cpp)

add_executable(start_motion_planning src/start_motion_planning.cpp)
target_link_libraries(start_motion_planning ${catkin_LIBRARIES})
add_dependencies(start_motion_planning dovs_rnd_project_generate_messages_cpp)

add_executable(csv_writer src/csv_writer.cpp)
target_link_libraries(csv_writer ${catkin_LIBRARIES})
add_dependencies(csv_writer dovs_rnd_project_generate_messages_cpp)

/usr/local/MATLAB/R2018b/extern/bin/glnxa64/libMatlabDataArray.so /usr/local/MATLAB/R2018b/extern/bin/glnxa64/libMatlabEngine.so ${catkin_LIBRARIES})

The CMakeLists.txt of common_functionsis given below.

cmake_minimum_required(VERSION 2.8.3)
project(common_functions)
add_compile_options(-std=c++11)

find_package(catkin REQUIRED COMPONENTS
  roscpp
  rospy
  std_msgs
)
catkin_package(
  INCLUDE_DIRS include
  LIBRARIES math_functions data_types pid rviz_functions geometry_functions logging_functions motion_planning_data_types
  CATKIN_DEPENDS roscpp rospy std_msgs
)
include_directories(
  include
  ${catkin_INCLUDE_DIRS}
)

 install(DIRECTORY include/${PROJECT_NAME}/
   DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION}
   FILES_MATCHING PATTERN "*.h"
 )

add_library(math_functions src/math_functions.cpp)
target_link_libraries(math_functions ${catkin_LIBRARIES})

add_library(data_types src/data_types.cpp)
target_link_libraries(data_types boost_python python2.7 ${catkin_LIBRARIES})

add_library(pid src/pid.cpp)
target_link_libraries(pid ${catkin_LIBRARIES})

add_library(rviz_functions src/rviz_functions.cpp)
target_link_libraries(rviz_functions ${catkin_LIBRARIES})

add_library(geometry_functions src/geometry_functions.cpp)
target_link_libraries(geometry_functions math_functions ${catkin_LIBRARIES})
target_compile_options(geometry_functions PUBLIC "-fPIC")

add_library(logging_functions src/logging_functions.cpp)
target_link_libraries(logging_functions ${catkin_LIBRARIES})

add_library(motion_planning_data_types src/motion_planning_data_types.cpp)
target_link_libraries(motion_planning_data_types ${catkin_LIBRARIES})

add_library(motion_planning_functions src/motion_planning_functions.cpp)
target_link_libraries(motion_planning_functions ${catkin_LIBRARIES})

Basically it is an error to link library. catkin_make_isolated is somehow unable to find the right path. For instance, while using catkin_make the library is in devel/lib. Now, it is in devel_isolated. There is no sub-directory lib. There was no such error when I compiled the same packages in another workspace using catkin_make. Would anybody help, please?

regards,

Asked by Spartan_007 on 2019-12-23 15:50:21 UTC

Comments

Please copy-paste the relevant CMakeLists.txt files here into your question. Remove all the boilerplate comments from them first.

Rationale: you will remove the files from your google drive in the (near) future, which reduces the value of this question (and any potential answers) significantly.

Asked by gvdhoorn on 2019-12-24 04:30:58 UTC

An observation:

The problem is related to catkin_make_isolated.

Actually, the problem is most likely in your CMakeLists.txt, and use of CMI has brought it to light. catkin_make is much more "lenient" in that it will work with broken build scripts.

Does common_functions (which is not a very good name for a ROS package btw, see REP-144) have a line like this in its CMakeLists.txt:

catkin_package(
  ...
  LIBRARIES ... geometry_functions ...
  ...
)

It would be good to include the CMakeLis.txt of common_functions here as well. As that is most likely where the problem is.

Asked by gvdhoorn on 2019-12-24 04:52:04 UTC

Answers