fzi-forschungszentrum-informatik/cartesian_controllers

Problem with colcon build

student-0103 opened this issue · 7 comments

I want to build the cartesian_controller in my workspace in 'src' but when i do colcon build, a CMake Error hits.
I use ROS2 humble on ubuntu (22.04).

This is the error:

CMake Error at CMakeLists.txt:11 (if):
   if given arguments:

        "STREQUAL" "iron"
  
   Unkwown arguments specified.

Same problem when only "humble" in if statements in the CMakelist.txt

image

Someone who can help me :) ?

Hi @Daan0103

Thanks for reporting. I'm not completely sure. I'll add periodic testing later for humble and rolling. Maybe something changed with respect to the environment variable ROS_DISTRO.

Inside the shell that you use for colcon build, what's the output of echo $ROS_DISTRO?

I want to build the cartesian_controller in my workspace in 'src'

Don't do that. Build in the parent folder instead, i.e. on the level where you see build, install, and src.

Hi @stefanscherzinger,
Thanks for the comment!
My output for echo $ROS_DISTRO is humble

Is there another way to fix this, or can i do something else to implement this 'cartesian_controllers'?

I took over some work from someone else, and updated ros2 from foxy to humble. For the most packages you can just build them in your new workspace (humble) and do a colcon build. For this one it doesn't work because of this error.

@Daan0103

That is really weird. It looks like the error from this post, which is caused by an empty variable string if the ROS_DISTRO env variable is not set. But this does not seem to be your case..

I would delete the complete build folder from your workspace, open an new terminal there, then

source /opt/ros/humble/setup.bash
colcon build --packages-skip cartesian_controller_simulation cartesian_controller_tests --cmake-args -DCMAKE_BUILD_TYPE=Release

and see if the error is the same.

@stefanscherzinger

Hmm, unfortunately still the same error...

@stefanscherzinger: not a real solution (as in: it doesn't explain why the current implementation is failing), but you could probably avoid the CMake-trickery and use something like RCLCPP_VERSION_MAJOR (defined in rclcpp/version.h). That's already a #define, so no need to do something like that yourself.

That file is generated at build time (here for rclcpp) by ament_generate_version_header(..) which takes its data from the package's manifest.

For Iron fi, RCLCPP_VERSION_MAJOR is 21 (from here), while for Humble, it's set to 16 (from here).

There's even a RCLCPP_VERSION_GTE(..) macro which should make comparing versions a little easier.


Edit: just remembered: it's probably only available starting from Humble. So perhaps a combination of __has_include(..) and checking the version using the macro should be used.

Hi,
I 'played' something with my 'old' workspace. This was build in a previous project (which I have to finish on another PC).
My PC runs on Ubuntu 22.04 LTS and ROS2 Humble, the previous PC on 20.04 and Foxy.
I split the packages to all different test-workspaces to see in which package the problem was, here the cartesian_controller build successfully. The problem is in another package in combination with newer packages/updates like this.

So, the cartesian controller is built successfully and now I have to solve the problem by other packages ;)
Anyway, thanks for the help I appreciate it!