I've encountered some build issues where my package used headers from the underlay instead of from my source workspace, and traced it back to colcon-ros.
The issue is happening in this function where the AMENT_PREFIX_PATH is added to the CMAKE_PREFIX_PATH.
|
def add_app_to_cpp(env): |
|
""" |
|
Add AMENT_PREFIX_PATH to CMAKE_PREFIX_PATH. |
|
|
|
Each ament prefix path is inserted before the first catkin prefix path or |
|
at the end if none of the CMake prefix paths has a '.catkin' marker file. |
The problem is that if you forget to include <export><build_type>ament_cmake</build_type></export> in the package XML of a package.
The build will add a .catkin marker file to the install location.
This causes the linked function to insert the AMENT_PREFIX_PATH with the underlying binary workspace in front of this source package, which may be very early in the list of source packages.
Subsequently, when building, it will now prioritize the underlay over the source workspace, which I don't think is intended behavior.
I don't really understand what the rationale was behind adding AMENT_PREFIX_PATH before the first .catkin marked directory, or why a .catkin marker file is placed when the build_type is not properly exported.
So, I can't propose a solution, but the combination creates some very hard-to-find weird behavior.
I've encountered some build issues where my package used headers from the underlay instead of from my source workspace, and traced it back to colcon-ros.
The issue is happening in this function where the
AMENT_PREFIX_PATHis added to theCMAKE_PREFIX_PATH.colcon-ros/colcon_ros/task/__init__.py
Lines 8 to 13 in 65ac2ec
The problem is that if you forget to include
<export><build_type>ament_cmake</build_type></export>in the package XML of a package.The build will add a
.catkinmarker file to the install location.This causes the linked function to insert the
AMENT_PREFIX_PATHwith the underlying binary workspace in front of this source package, which may be very early in the list of source packages.Subsequently, when building, it will now prioritize the underlay over the source workspace, which I don't think is intended behavior.
I don't really understand what the rationale was behind adding
AMENT_PREFIX_PATHbefore the first.catkinmarked directory, or why a.catkinmarker file is placed when thebuild_typeis not properly exported.So, I can't propose a solution, but the combination creates some very hard-to-find weird behavior.