Skip to content

ISO C++11 requires at least one argument for the "..." in a variadic macro #49

@jeremyfix

Description

@jeremyfix

Hi,

I'm trying to compile kobuki_core for ros2 humble.

I git cloned the package list

https://github.com/stonier/sophus <-  release/1.3.x
https://github.com/stonier/ecl_tools
https://github.com/stonier/ecl_lite
https://github.com/stonier/ecl_core
https://github.com/kobuki-base/cmd_vel_mux
https://github.com/kobuki-base/kobuki_core
https://github.com/kobuki-base/kobuki_ros
https://github.com/kobuki-base/kobuki_ros_interfaces

Then I issued colcon build and got an error when compiling kobuki_core

--- stderr: kobuki_core
In file included from /home/ubuntu/ros2_ws/install/sophus/include/sophus/types.hpp:7,
                 from /home/ubuntu/ros2_ws/install/sophus/include/sophus/rotation_matrix.hpp:9,
                 from /home/ubuntu/ros2_ws/install/sophus/include/sophus/so3.hpp:6,
                 from /home/ubuntu/ros2_ws/install/sophus/include/sophus/se3.hpp:6,
                 from /home/ubuntu/ros2_ws/install/ecl_linear_algebra/include/ecl/linear_algebra/sophus.hpp:15,
                 from /home/ubuntu/ros2_ws/install/ecl_linear_algebra/include/ecl/linear_algebra.hpp:25,
                 from /home/ubuntu/ros2_ws/install/ecl_geometry/include/ecl/geometry/pose2d.hpp:21,
                 from /home/ubuntu/ros2_ws/install/ecl_geometry/include/ecl/geometry.hpp:20,
                 from /home/ubuntu/ros2_ws/src/kobuki_core/src/driver/../../include/kobuki_core/modules/diff_drive.hpp:23,
                 from /home/ubuntu/ros2_ws/src/kobuki_core/src/driver/diff_drive.cpp:14:
/home/ubuntu/ros2_ws/install/sophus/include/sophus/common.hpp:206:45: error: ISO C++11 requires at least one argument for the "..." in a variadic macro [-Werror]
  206 |     SOPHUS_ENSURE(is_valid_, "must be valid");
      |                                             ^
/home/ubuntu/ros2_ws/install/sophus/include/sophus/common.hpp:139:69: error: ISO C++11 requires at least one argument for the "..." in a variadic macro [-Werror]
  139 |       SOPHUS_DEDAULT_ENSURE_FAILURE_IMPL(SOPHUS_FUNCTION, __FILE__, __LINE__, \
      |                                                                     ^~~~~~~~
/home/ubuntu/ros2_ws/install/sophus/include/sophus/common.hpp:139:69: note: in definition of macro ‘SOPHUS_ENSURE’
  139 |       SOPHUS_DEDAULT_ENSURE_FAILURE_IMPL(SOPHUS_FUNCTION, __FILE__, __LINE__, \
      |                                                                     ^~~~~~~~
/home/ubuntu/ros2_ws/install/sophus/include/sophus/common.hpp:211:45: error: ISO C++11 requires at least one argument for the "..." in a variadic macro [-Werror]
  211 |     SOPHUS_ENSURE(is_valid_, "must be valid");
      |                                             ^
/home/ubuntu/ros2_ws/install/sophus/include/sophus/common.hpp:139:69: error: ISO C++11 requires at least one argument for the "..." in a variadic macro [-Werror]
  139 |       SOPHUS_DEDAULT_ENSURE_FAILURE_IMPL(SOPHUS_FUNCTION, __FILE__, __LINE__, \
      |                                                                     ^~~~~~~~
/home/ubuntu/ros2_ws/install/sophus/include/sophus/common.hpp:139:69: note: in definition of macro ‘SOPHUS_ENSURE’
  139 |       SOPHUS_DEDAULT_ENSURE_FAILURE_IMPL(SOPHUS_FUNCTION, __FILE__, __LINE__, \
      |                                                                     ^~~~~~~~
/home/ubuntu/ros2_ws/install/sophus/include/sophus/common.hpp:216:45: error: ISO C++11 requires at least one argument for the "..." in a variadic macro [-Werror]
  216 |     SOPHUS_ENSURE(is_valid_, "must be valid");
      |                                             ^
/home/ubuntu/ros2_ws/install/sophus/include/sophus/common.hpp:139:69: error: ISO C++11 requires at least one argument for the "..." in a variadic macro [-Werror]
  139 |       SOPHUS_DEDAULT_ENSURE_FAILURE_IMPL(SOPHUS_FUNCTION, __FILE__, __LINE__, \
      |                                                                     ^~~~~~~~
/home/ubuntu/ros2_ws/install/sophus/include/sophus/common.hpp:139:69: note: in definition of macro ‘SOPHUS_ENSURE’
  139 |       SOPHUS_DEDAULT_ENSURE_FAILURE_IMPL(SOPHUS_FUNCTION, __FILE__, __LINE__, \
      |                                                                     ^~~~~~~~
/home/ubuntu/ros2_ws/install/sophus/include/sophus/common.hpp:221:45: error: ISO C++11 requires at least one argument for the "..." in a variadic macro [-Werror]
  221 |     SOPHUS_ENSURE(is_valid_, "must be valid");
      |                                             ^
/home/ubuntu/ros2_ws/install/sophus/include/sophus/common.hpp:139:69: error: ISO C++11 requires at least one argument for the "..." in a variadic macro [-Werror]
  139 |       SOPHUS_DEDAULT_ENSURE_FAILURE_IMPL(SOPHUS_FUNCTION, __FILE__, __LINE__, \
      |                                                                     ^~~~~~~~
/home/ubuntu/ros2_ws/install/sophus/include/sophus/common.hpp:139:69: note: in definition of macro ‘SOPHUS_ENSURE’
  139 |       SOPHUS_DEDAULT_ENSURE_FAILURE_IMPL(SOPHUS_FUNCTION, __FILE__, __LINE__, \
.............

If I'm not wrong, due to the ecl_enable_cxx14_compiler() , the CMAKE_CXX_STANDARD is set to C++14.

I do not know if this is the correct fix , but then I added set(CMAKE_CXX_STANDARD 20) just after the ecl_enable_xxxxx in the kobuki_core/CMakeLists.txt and then the compilation succeded.

It has something to do with variadic macros and I blindly applied this standard change by going through this gnu gcc doc page telling C++20 is less restrictive on variadic macros.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions