ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | Q&A
Ask Your Question

Compilation Error on latest version of RCLCPP

asked 2019-04-04 11:52:19 -0500

jhassold gravatar image

updated 2019-04-04 11:53:03 -0500

When I try to build the latest version of RCLCPP using Colcon, I get an error saying that a function was not declared in this scope:

~/ros2_ws$ colcon build --symlink-install --merge-install --packages-select rclcpp --cmake-args -DCMAKE_BUILD_TYPE=RelWithDebInfo
Starting >>> rclcpp  
--- stderr: rclcpp                               
/home/jhassold/ros2_ws/src/ros2/rclcpp/rclcpp/src/rclcpp/publisher.cpp: In member function ‘rmw_qos_profile_t rclcpp::PublisherBase::get_actual_qos() const’:
/home/jhassold/ros2_ws/src/ros2/rclcpp/rclcpp/src/rclcpp/publisher.cpp:202:35: error: ‘rcl_publisher_get_actual_qos’ was not declared in this scope
   const rmw_qos_profile_t * qos = rcl_publisher_get_actual_qos(&publisher_handle_);
/home/jhassold/ros2_ws/src/ros2/rclcpp/rclcpp/src/rclcpp/publisher.cpp:202:35: note: suggested alternative: ‘rcl_publisher_get_options’
   const rmw_qos_profile_t * qos = rcl_publisher_get_actual_qos(&publisher_handle_);
make[2]: *** [CMakeFiles/rclcpp.dir/src/rclcpp/publisher.cpp.o] Error 1
make[2]: *** Waiting for unfinished jobs....
make[1]: *** [CMakeFiles/rclcpp.dir/all] Error 2
make: *** [all] Error 2
Failed   <<< rclcpp [ Exited with code 2 ]

Summary: 0 packages finished [21.2s]
  1 package failed: rclcpp
  1 package had stderr output: rclcpp

I have tried backing up through the master branch, and the error consistently occurs at this commit: . Any commits before that on the master branch will build just fine, whereas that one and all future ones will fail (always with the exact same error). The error continues to occur even if I delete my build and install folders, and try to have colcon reconstruct everything.

HOWEVER I'm not sure that it's actually that commit's fault - my colleague is able to build rclcpp just fine. Which leads me to think that something got messed up in my environment. However, I don't really know where to start looking.

Has anyone else run into this sort of an issue before? Was it an environment error? And if so, what should I do to make sure that this doesn't happen in future? I'm hoping that I can fix this without having to completely reinstall ROS2...

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted

answered 2019-04-04 12:27:16 -0500

marguedas gravatar image

It looks like you have the latest changes of rclcpp but not of the other packages, e.g. this rcl function was added in .

You need to update all your sources (pull the latest changes of all the repositories). To do so you can refer to Maintaining a Source Checkout

And then rebuild your workspace

edit flag offensive delete link more


This seems to mostly work, but during the rebuild workspace step I'm getting an error in the compilation of logging_demo. Specifically that CMake can't find a package configuration file provided by rclcpp_components.

I will triple check and make sure it's been installed...

EDIT It wasn't. Apparently it wasn't fond of my forked repository, and refused to download the files from the main repo. I'm going to have to figure out a better way of handling this...

jhassold gravatar image jhassold  ( 2019-04-04 12:57:54 -0500 )edit

Building ros2 from source is not a great solution.

Boston Cleek gravatar image Boston Cleek  ( 2021-01-28 13:28:13 -0500 )edit

It looks like this question/answer is about building the very latest rclcpp, so building all the rest of ROS 2 from source is the only solution.

It is also possible to build just rclcpp and use the rest of the packages from the ROS distro, but you must use the right branch. This person could have checked out the crystal branch of rclcpp and built that instead of the latest sources on master.

sloretz gravatar image sloretz  ( 2021-01-28 14:20:34 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2019-04-04 11:52:19 -0500

Seen: 1,544 times

Last updated: Apr 04 '19