0
$\begingroup$

Rosanswers logo

I forked rclcpp crystal branch and made some modification in my colcon_ws, and then made changes to another package that depends on those modifications, but the includes still point to the opt version.

In file included from /opt/ros/crystal/include/rclcpp/executors/single_threaded_executor.hpp:28:0,
                 from /opt/ros/crystal/include/rclcpp/executors.hpp:22,
                 from /opt/ros/crystal/include/rclcpp/rclcpp.hpp:144,
                 from /home/lucasw/colcon_ws/src/ros2_cpp_py/src/node_init.cpp:35:

ros2 pkg list rclcpp shows the location of the modified version.

Removing the entirety of install and build didn't and rebuilding didn't help (in other cases such as changing a msg or srv deleting the install and build for the altered package seems to be necessary).

If I go into build/ros2_cpp_py and run make VERBOSE=1 I see the opt include is coming first, which corresponds to the order in CMakeFiles/node_init.dir/DependInfo.cmake. I can manually fix the order and build (editing that DependInfo.cmake didn't work, output from it must be cached somewhere) then:

/usr/bin/c++  -DPOCO_NO_AUTOMATIC_LIBS -I/home/lucasw/colcon_ws/src/ros2_cpp_py/include -I/home/lucasw/colcon_ws/install/rclcpp/include -I/opt/ros/crystal/include -Wall -Wextra -Wpedantic -std=gnu++14 -o CMakeFiles/node_init.dir/src/node_init.cpp.o -c /home/lucasw/colcon_ws/src/ros2_cpp_py/src/node_init.cpp
/usr/bin/c++     CMakeFiles/node_init.dir/src/node_init.cpp.o  -o node_init -Wl,-rpath,/home/lucasw/colcon_ws/install/rclcpp/lib:/opt/ros/crystal/lib: /opt/ros/crystal/lib/libament_index_cpp.so /usr/lib/libPocoFoundation.so.50 /opt/ros/crystal/lib/libconsole_bridge.so.0.4 /opt/ros/crystal/lib/libclass_loader.so /home/lucasw/colcon_ws/install/rclcpp/lib/librclcpp.so /opt/ros/crystal/lib/librcl.so /opt/ros/crystal/lib/librcl_interfaces__rosidl_typesupport_c.so /opt/ros/crystal/lib/librcl_interfaces__rosidl_typesupport_cpp.so /opt/ros/crystal/lib/librcl_interfaces__rosidl_generator_c.so /opt/ros/crystal/lib/librcl_interfaces__rosidl_typesupport_fastrtps_c.so /opt/ros/crystal/lib/librcl_interfaces__rosidl_typesupport_fastrtps_cpp.so /opt/ros/crystal/lib/librcl_interfaces__rosidl_typesupport_introspection_c.so /opt/ros/crystal/lib/librcl_interfaces__rosidl_typesupport_introspection_cpp.so /opt/ros/crystal/lib/librmw_implementation.so -lpthread /opt/ros/crystal/lib/librmw.so /opt/ros/crystal/lib/librcl_logging_noop.so /opt/ros/crystal/lib/libbuiltin_interfaces__rosidl_typesupport_c.so /opt/ros/crystal/lib/libbuiltin_interfaces__rosidl_typesupport_cpp.so /opt/ros/crystal/lib/libbuiltin_interfaces__rosidl_generator_c.so /opt/ros/crystal/lib/libbuiltin_interfaces__rosidl_typesupport_fastrtps_c.so /opt/ros/crystal/lib/libbuiltin_interfaces__rosidl_typesupport_fastrtps_cpp.so /opt/ros/crystal/lib/libbuiltin_interfaces__rosidl_typesupport_introspection_c.so /opt/ros/crystal/lib/libbuiltin_interfaces__rosidl_typesupport_introspection_cpp.so /opt/ros/crystal/lib/librosidl_typesupport_introspection_c.so /opt/ros/crystal/lib/librosidl_typesupport_introspection_cpp.so /opt/ros/crystal/lib/librosgraph_msgs__rosidl_generator_c.so /opt/ros/crystal/lib/librosgraph_msgs__rosidl_typesupport_c.so /opt/ros/crystal/lib/librosgraph_msgs__rosidl_typesupport_cpp.so /opt/ros/crystal/lib/librosgraph_msgs__rosidl_typesupport_introspection_c.so /opt/ros/crystal/lib/librosgraph_msgs__rosidl_typesupport_introspection_cpp.so /opt/ros/crystal/lib/librosgraph_msgs__rosidl_typesupport_fastrtps_c.so /opt/ros/crystal/lib/librosgraph_msgs__rosidl_typesupport_fastrtps_cpp.so /opt/ros/crystal/lib/librosidl_typesupport_cpp.so /opt/ros/crystal/lib/librosidl_typesupport_c.so /opt/ros/crystal/lib/librosidl_generator_c.so /opt/ros/crystal/lib/librcl_yaml_param_parser.so /opt/ros/crystal/lib/librcutils.so -lpthread -ldl -lrt /usr/lib/x86_64-linux-gnu/libpcre.so /usr/lib/x86_64-linux-gnu/libz.so

colcon will then be tricked into relinking the .o built from the right includes if I then go edit rclcpp sources without changing ros2_cpp_py.

In the past I've done the same for other packages and the expected precedence of colcon_ws works (TODO test that again), is there something special about rclcpp here? I wouldn't be surprised if this turns out badly for other reasons (and I should build from source https://index.ros.org/doc/ros2/Installation/Linux-Development-Setup/ and work with modified rclcpp inside that, and use nothing from opt debs at all?), but this particular failure was unexpected.

I realize this probably is the wrong development approach vs. what full time developers of core ros2 packages do, but I'd like to stay with crystal and released packages as much as possible, and I think other low frequency 'casual' contributors would be similar.

Reproduction

source /opt/ros/crystal/setup.bash
mkdir test_colcon_ws/src -p
cd test_colcon_ws/src
git clone -b node_init https://github.com/lucasw/rclcpp
git clone -b node_init https://github.com/lucasw/ros2_cpp_py
cd ..
colcon build

Originally posted by lucasw on ROS Answers with karma: 8729 on 2019-02-16

Post score: 0


Original comments

Comment by gvdhoorn on 2019-02-16:
Wouldn't changing a pkg as "far down" in the dependency trees as rclcpp have the potential to create ABI compatibility issues, leading to many pkgs needing to be recompiled anyway? That's not a reason for overlaying not working btw, just an observation/question prompted by your last comment.

Comment by lucasw on 2019-02-16:
That's the kind of issue I'm expecting, but so far the changes are additive and the only nodes I'm using here are ones that are getting recompiled anyhow. I think the compositional architecture of Node is going to help, the components I don't change are insulated from breaking.

Comment by gvdhoorn on 2019-02-17:\

but so far the changes are additive

that's not a guarantee that you won't break ABI (and is the reason patterns like PIMPL exist).

Comment by Dirk Thomas on 2019-02-19:
First of all colcon has nothing to do with this behavior. The include directories are exclusively defined in CMake.

Comment by Dirk Thomas on 2019-02-19:
Please share the CMake code of the package ros2_cpp_py which is using the wrong include directories.

Comment by lucasw on 2019-02-19:
https://github.com/lucasw/ros2_cpp_py/blob/node_init/CMakeLists.txt

Comment by lucasw on 2019-02-19:
Oh it's the order of the dependencies in ament_target_dependencies, rclcpp needs to be before any other packages outside of the current ws dependent on it.

Comment by Dirk Thomas on 2019-02-19:
Please provide steps to reproduce the above error. Just building the referenced repository doesn't fail for me.

Comment by lucasw on 2019-02-19:
Added reproduction steps above at the bottom of the post.

Comment by lucasw on 2019-02-21:
@gvdhoorn I have seen a few std::system_error exceptions thrown when I've changed rclcpp and then tried to load a node I've forgotten to rebuild with --packages-select.

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

I was able to reproduce the problem with the steps. While the function was supposed to order the include dirs automatically it fails to do so correctly on non-Windows platforms where the separator for the paths in AMENT_PREFIX_PATH is : (instead of ; as on Windows and in CMake).

Please see https://github.com/ament/ament_cmake/pull/157 for the proposed patch. You should be able to apply the same diff to the file installed in /opt/ros/crystal/share/ament_cmake_include_directories/cmake/ament_include_directories_order.cmake and your next build should succeed.


Originally posted by Dirk Thomas with karma: 16276 on 2019-02-19

This answer was ACCEPTED on the original site

Post score: 0

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.