Robotics StackExchange | Archived questions

ament_export_include_directoires() not working properly in ros2_humble

This is a mirror question of https://github.com/ament/ament_cmake/issues/419

Recently I upgraded the ROS2 version from galactic version to humble, I encountered a problem when compiling some packages of the previous version. After investigation, I think it is a problem with ament_export_include_directories and ament_export_libraries.

I wrote a short program to reproduce this bug, you can find it here. Simply put, I now have a caller that references the common library. In common, I export the library through ament_export_include_directories and ament_export_libraries, but I can’t reference his(common) header file in the caller. The error is as follows:

srFO9pxty3

But if I use INCLUDES DESTINATION include in install, the code can work properly. The working code you can find in the fixed branch. Only the CMakeLists of the common package are modified. bM5fRqsSKO

But according to the documentation, the two methods can be considered equivalent. And the code on master can be compiled pass in galactic version.

So this is confusing, and I found out that both methods are also used in nav2, but it doesn't report an error. I guess it might be because I both export the library and generate msgs in the common library, but I'm not sure, I don't see a description of this guideline in the documentation, so I think it's a bug of ament_cmake.

The code before and after modification is attached:

before:

https://github.com/zzsqwq/ament_cmake_bug_demo/blob/4a8cf8b3d734c7fa3735ab50e0958a80ee18df03/common/CMakeLists.txt#L24-L39

after:

https://github.com/zzsqwq/ament_cmake_bug_demo/blob/2566a0582f1c377f307bd05306e1fc66542d0be5/common/CMakeLists.txt#L24-L39

Asked by zzsqwq on 2022-12-20 22:17:49 UTC

Comments

Answers