Ask Your Question

patrick's profile - activity

2020-11-11 08:11:13 -0600 received badge  Famous Question (source)
2020-09-02 09:52:54 -0600 received badge  Notable Question (source)
2020-07-31 17:48:47 -0600 commented answer Colcon build include path from overlay workspace

Thank you!

2020-07-31 17:47:41 -0600 marked best answer Colcon build include path from overlay workspace

How can I control which include paths will be used when colcon builds a package? I would like to use the includes form a package in my current workspace instead of the ones of the same package in the ros2 underlay workspace. It seems to look in both places, but unfortunately the underlay workspace has priority.

As a concrete example, I'm trying to build the master branch of rosbag2. I am using the latest foxy (patch1) binary release. The build currently fails because it is trying to use the rosbag2_cpp include files from the foxy release when building the rosbag_transport package. Instead it should be looking for the rosbag2_cpp includes in the current workspace. (the max_bagfile_size has been added in rosbag2_cpp/storage_options.hpp on master (current workspace) but it is not present in the foxy release, see error below) I solved the build errors by simply deleting the rosbag2 library out of the ros2 binary installation so that the includes from the current workspace are used. However I am thinking there must be a better way to do this.

Sourcing ros2 environment, then creating a workspace and cloning rosbag2 into it, running colcon build:

--- stderr: rosbag2_transport
/home/pi/ws/src/rosbag2/rosbag2_transport/src/rosbag2_transport/rosbag2_transport_python.cpp: In function ‘PyObject* rosbag2_transport_record(PyObject*, PyObject*, PyObject*)’:
/home/pi/ws/src/rosbag2/rosbag2_transport/src/rosbag2_transport/rosbag2_transport_python.cpp:149:19: error: ‘using StorageOptions = struct rosbag2_cpp::StorageOptions’ {aka ‘struct rosbag2_cpp::StorageOptions’} has no member named ‘max_bagfile_duration’; did you mean ‘max_bagfile_size’?
  149 |   storage_options.max_bagfile_duration = static_cast<uint64_t>(max_bagfile_duration);
      |                   ^~~~~~~~~~~~~~~~~~~~
      |                   max_bagfile_size
make[2]: *** [CMakeFiles/rosbag2_transport_py.dir/build.make:66: CMakeFiles/rosbag2_transport_py.dir/src/rosbag2_transport/rosbag2_transport_python.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:83: CMakeFiles/rosbag2_transport_py.dir/all] Error 2
make: *** [Makefile:144: all] Error 2
---
Failed   <<< rosbag2_transport [32.6s, exited with code 2]

Edit: These are the compiler calls without --merge-install:

/usr/bin/c++  -DDEFAULT_RMW_IMPLEMENTATION=rmw_fastrtps_cpp -DPLUGINLIB__DISABLE_BOOST_FUNCTIONS -DROS_PACKAGE_NAME=\"rosbag2_transport\" -DSPDLOG_COMPILED_LIB -Drosbag2_transport_py_EXPORTS -I/usr/include/python3.8 -I/home/pi/ws/src/rosbag2/rosbag2_transport/include -isystem /home/pi/ws/install/rosbag2_compression/include -isystem /home/pi/ros2/opt/yaml_cpp_vendor/include -isystem /home/pi/ros2/include -isystem /home/pi/ws/install/rosbag2_storage/include -isystem /home/pi/ws/install/zstd_vendor/include -isystem /home/pi/ws/install/rosbag2_cpp/include -isystem /home/pi/ws/install/shared_queues_vendor/include/moodycamel -isystem /home/pi/ws/install/shared_queues_vendor/include  -fPIC   -Wall -Wextra -Wpedantic -Werror -std=gnu++14 -o CMakeFiles/rosbag2_transport_py.dir/src/rosbag2_transport/rosbag2_transport_python.cpp.o -c /home/pi/ws/src/rosbag2/rosbag2_transport/src/rosbag2_transport/rosbag2_transport_python.cpp

and with --merge-install:

/usr/bin/c++  -DDEFAULT_RMW_IMPLEMENTATION=rmw_fastrtps_cpp -DPLUGINLIB__DISABLE_BOOST_FUNCTIONS -DROS_PACKAGE_NAME=\"rosbag2_transport\" -DSPDLOG_COMPILED_LIB -Drosbag2_transport_py_EXPORTS -I/usr/include/python3.8 -I/home/pi/ws/src/rosbag2/rosbag2_transport/include -isystem /home/pi/ws/install/include -isystem /home/pi/ros2/opt/yaml_cpp_vendor/include -isystem /home/pi/ros2/include -isystem /home/pi/ws/install/include/moodycamel  -fPIC   -Wall -Wextra -Wpedantic -Werror -std=gnu++14 -o CMakeFiles/rosbag2_transport_py.dir/src/rosbag2_transport/rosbag2_transport_python.cpp.o -c /home/pi/ws/src/rosbag2/rosbag2_transport/src/rosbag2_transport/rosbag2_transport_python.cpp
2020-07-31 17:47:41 -0600 received badge  Scholar (source)
2020-07-31 17:39:08 -0600 received badge  Popular Question (source)
2020-07-31 13:16:36 -0600 commented question Colcon build include path from overlay workspace

I posted the compiler calls, I don't see how the include sequence is generated from the CMakeLists.txt. I'm not familiar

2020-07-31 13:13:33 -0600 edited question Colcon build include path from overlay workspace

Colcon build include path from overlay workspace How can I control which include paths will be used when colcon builds a

2020-07-31 13:08:36 -0600 commented question Colcon build include path from overlay workspace

I can confirm that with --merge-install it compiles fine for me too.

2020-07-29 18:21:00 -0600 asked a question Colcon build include path from overlay workspace

Colcon build include path from overlay workspace How can I control which include paths will be used when colcon builds a