Occasionally package fails to find built dependency

asked 2021-02-05 02:11:12 -0500

Rufus gravatar image

For some reason, occasionally my build fails with the message

Project 'xxx' tried to find library 'yyy'. The library is neither a target nor built/installed properly.  Did you compile project 'yyy'?  Did you find_package() it before the subdirectory containing its code is included?

The strange thing is, package yyy was indeed built and completed before package xxx started building, as shown from the catkin build output. Furthermore, catkin list --deps correctly lists yyy as xxx's dependency.

And of course, I made sure all the answers to the error prompt is yes..

CMakeLists.txt for xxx:

find_package(catkin REQUIRED COMPONENTS
    yyy
    ...
)
...
add_dependencies(xxx ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS})
...

package.xml for xxx:

<depend>yyy</depend>

Unfortunately, this does not happen all the time so I can't create a minimally reproducible example. I also cannot understand why this problem only happens to this specific package yyy. I have other packages and dependencies that build fine.

The one interesting thing about yyy is it is a header and message only package, with no source.

CMakeLists.txt for yyy:

find_package(catkin REQUIRED COMPONENTS
  std_msgs
  geometry_msgs
  shape_msgs
  message_generation
  actionlib_msgs
)

add_service_file(FILES
....
)

add_message_file(FILES
...
)

add_action_file(FILES
...
)

generate_messages(
    DEPENDENCIES
    actionlib_msgs
    std_msgs
    geometry_msgs
    shape_msgs
)


catkin_package(
   INCLUDE_DIRS include
#  LIBRARIES yyy
   CATKIN_DEPENDS message_runtime std_msgs geometry_msgs shape_msgs
#  DEPENDS system_lib
)

include_directories(include)
add_library(yyy INTERFACE)
target_include_directories(yyy
    INTERFACE
    include
)
edit retag flag offensive close merge delete