Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
jeremyfix opened this issue Jun 19, 2023 · 1 comment

Comments

@jeremyfix
Copy link

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.

@clalancette
Copy link
Collaborator

There's a fix in stonier/sophus#23, I'm just waiting for it to be merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants