Package already built in underlay workspace is the current workspace

asked 2023-04-26 12:42:19 -0500

teddybouch gravatar image

I'm trying to build a library with parsing functions for an interface project, but somehow in the process I seem to have created an underlay workspace and I can't figure out how I did so or how to resolve it. Most confusingly, what I've tried to read on the subject seems to suggest that this issue arises when two packages with the same name are built in separate workspaces, but the warning points to the same workspace I'm trying to build in. Here's the build output:

dev@boucharda-l1d:~/workspace/workspace_catl$ colcon build --packages-select catl_dccl2json
[0.162s] WARNING:colcon.colcon_core.verb:Some selected packages are already built in one or more underlay workspaces:
    'catl_dccl2json' is in: /home/dev/workspace/workspace_catl/install/catl_dccl2json
If a package in a merged underlay workspace is overridden and it installs headers, then all packages in the overlay must sort their include directories by workspace order. Failure to do so may result in build failures or undefined behavior at run time.
If the overridden package is used by another package in any underlay, then the overriding package in the overlay must be API and ABI compatible or undefined behavior at run time may occur.

If you understand the risks and want to override a package anyways, add the following to the command line:
    --allow-overriding catl_dccl2json

This may be promoted to an error in a future release of colcon-core.
Starting >>> catl_dccl2json
Finished <<< catl_dccl2json [0.87s]

I'm running this from /home/dev/workspace/workspace_catl, so the build location where the package is already built is the same location and package that I'm currently trying to re-build over it. I've stripped EVERYTHING out of the header and source files (I have a long history of struggling with build environments and dependencies), so I'm assuming that this has to do with my CMakeLists configuration. So here's that:

################################################################################
#                   CMake commands for the CATL DCCL 2 JSON                    #
#                                  Library                                     #
################################################################################

cmake_minimum_required(VERSION 3.5)
project(catl_dccl2json)

# Default to C99
if(NOT CMAKE_C_STANDARD)
  set(CMAKE_C_STANDARD 99)
endif()

# Default to C++14
if(NOT CMAKE_CXX_STANDARD)
  set(CMAKE_CXX_STANDARD 14)
endif()

if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
  add_compile_options(-Wall -Wextra -Wpedantic)
endif()

################################################################################
# Find dependencies and libraries                                              #
################################################################################

find_package(ament_cmake REQUIRED)
find_package(rclcpp REQUIRED)

################################################################################
# Export target                                                                #
################################################################################

ament_export_targets( export_${PROJECT_NAME} HAS_LIBRARY_TARGET )

################################################################################
# Create library                                                               #
################################################################################

add_library( ${PROJECT_NAME} SHARED src/catl_dccl2json.cpp )

################################################################################
# Install library                                                              #
################################################################################
target_include_directories( ${PROJECT_NAME}
PUBLIC
  $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
  $<INSTALL_INTERFACE:include>
)

install(
  DIRECTORY include/
  DESTINATION include
)

install(
  TARGETS ${PROJECT_NAME}
  EXPORT export_${PROJECT_NAME}
  ARCHIVE DESTINATION lib
  LIBRARY DESTINATION lib
  RUNTIME DESTINATION bin
  INCLUDES DESTINATION include
)

################################################################################
# Export the library for ROS usage                                             #
################################################################################

ament_target_dependencies( ${PROJECT_NAME} rclcpp )
ament_export_include_directories( include )
ament_export_libraries( ${PROJECT_NAME} )

ament_package()

I'll put the header and cpp below just in case, but I'm fairly certain at this point that it's an issue with my build configuration. If anyone can help me identify what I've done wrong and how to resolve it, I would really appreciate it. Oh, and I'm running ROS2 Galactic on Ubuntu 20.04 in a Docker container ... (more)

edit retag flag offensive close merge delete

Comments

i seem to remember having this issue in Galactic but its been a while and I don't fully recall the root cause. It is a warning, not an error, and in my experience it was safe to ignore as I knew the underlay was the current workspace and I didn't expect any strange results from linking to a different version of the package.

I'm curious - do you still get the warning when trying to build the workspace in a fresh terminal (i.e. prior to sourcing the workspace's setup.bash; if you have your .bashrc setup to source your workspace, you may want to remove that to test)?

You may find these interesting: https://github.com/colcon/colcon-core...https://answers.ros.org/question/4040...

shonigmann gravatar image shonigmann  ( 2023-04-27 14:46:06 -0500 )edit