Closed matlabbe closed 3 months ago
The way we handled CMake dependencies may need to be revamped (which is a big project!). If we stop supporting old releases of TBB and other dependencies (as 18.04 is EOL) we might be able to let CMake handle all these itself...
For now I think I need a bit more information, but I guess it's a hard coded path somewhere...
I reproduced the issue with this Dockerfile:
FROM almalinux:latest
RUN dnf install langpacks-en glibc-langpack-en -y
ENV LANG=en_US.UTF-8
RUN dnf install 'dnf-command(config-manager)' epel-release -y && \
dnf config-manager --set-enabled crb
RUN curl --output /etc/yum.repos.d/ros2.repo http://packages.ros.org/ros2/rhel/ros2.repo && \
dnf makecache -y
RUN dnf install -y \
cmake \
gcc-c++ \
git \
make \
python3-colcon-common-extensions \
python3-mypy \
python3-pip \
python3-pydocstyle \
python3-pytest \
python3-pytest-repeat \
python3-pytest-rerunfailures \
python3-rosdep \
python3-setuptools \
python3-vcstool \
wget \
ros-jazzy-ros-base \
ros-jazzy-gtsam \
boost-devel
RUN source /opt/ros/jazzy/setup.bash && \
echo -e "#include <gtsam/base/types.h>\nint main(int argc, char * argv[]) {return 0;}" > main.cpp && \
echo -e "project(test)\nfind_package(GTSAM CONFIG REQUIRED)\nadd_executable(my_app main.cpp)\ntarget_link_libraries(my_app PRIVATE gtsam)" > CMakeLists.txt && \
cmake . && \
make VERBOSE=1
Output:
0.789 -- Build files have been written to: /
0.808 [ 50%] Building CXX object CMakeFiles/my_app.dir/main.o
0.967 In file included from /main.cpp:1:
0.967 /opt/ros/jazzy/include/gtsam/base/types.h:34:10: fatal error: tbb/scalable_allocator.h: No such file or directory
0.967 34 | #include <tbb/scalable_allocator.h>
0.967 | ^~~~~~~~~~~~~~~~~~~~~~~~~~
0.967 compilation terminated.
0.969 make[2]: *** [CMakeFiles/my_app.dir/build.make:76: CMakeFiles/my_app.dir/main.o] Error 1
0.969 make[1]: *** [CMakeFiles/Makefile2:83: CMakeFiles/my_app.dir/all] Error 2
0.969 make: *** [Makefile:91: all] Error 2
To fix the issue, we need to install manually tbb-devel
, add it to install command before making the script. Note that just by installing ros-jazzy-gtsam
, the boost libraries were also missing. I am not sure if boost and tbb dependencies in package.xml is written correctly:
https://github.com/borglab/gtsam/blob/a2a7a066464c4f147aad74bd98efccfe0f53baae/package.xml#L26-L28
Maybe the fix is just to change to the following so that boost and tbb are propagated downstream (not just for gtsam build):
<depend>boost</depend>
<depend>eigen</depend>
<depend>tbb</depend>
Yes these should be depend
not just build dependency.
@matlabbe Could you do a simple PR to main
? Thank you!
Description
When building our code with
ros-jazzy-gtsam
binaries on RHEL, it seems the include directory for TBB used by gtsam is not propagated downstream (well, it is missing), causing that error:Full log here: https://build.ros2.org/job/Jbin_rhel_el964__rtabmap__rhel_9_x86_64__binary/35/consoleFull
We don't see that error on Ubuntu Noble, only on RHEL.
Steps to reproduce
We include gtsam this way:
Minimal code example that would reproduce the issue:
Note however I don't know exactly the machine configuration used by the ros2 buildfarm for RHEL.
Expected behavior
Not having build error.
Environment
ROS2 Jazzy on RHEL. The error doesn't happen with ROS2 Jazzy on Ubuntu Noble.
Additional information
See https://github.com/introlab/rtabmap/issues/1306 for original issue.