Zed_ros2_wrapper build error

Hello.
I use zed2. I want to build zed_ros2_wrapper.
I successly build zed_ros2_wrapper in jetson_xavier(jetpack5.1 → ubuntu 20.04)

I’m using dual boot. Windows and Ubuntu20.04
If I create Ubuntu on a Windows virtual machine and build the same environment, it succeeded again

But When I build zed_ros2_wrapper in ubuntu 20.04 my dual boot desktop, I failed…
I don’t know why it’s failed.

Any other program( ex) PX4 )using ros2 foxy can build!
But zed-ros2-wrapper only can’t build…

I use GitHub - stereolabs/zed-ros2-wrapper: ROS 2 wrapper for the ZED SDK ← this link
and I use that code

mkdir -p ~/ros2_ws/src/ # create your workspace if it does not exist
cd ~/ros2_ws/src/ #use your current ros2 workspace folder
git clone  --recursive https://github.com/stereolabs/zed-ros2-wrapper.git
cd ..
sudo apt update
rosdep install --from-paths src --ignore-src -r -y # install dependencies
colcon build --symlink-install --cmake-args=-DCMAKE_BUILD_TYPE=Release --parallel-workers $(nproc) # build the workspace
echo source $(pwd)/install/local_setup.bash >> ~/.bashrc # automatically source the installation in every new bash (optional)
source ~/.bashrc

It’s part of my error log

/home/ros2/workspace/src/zed-ros2-wrapper/zed_components/src/zed_camera/src/zed_camera_component.cpp:9557:7: note: in expansion of macro ‘DEBUG_SIM’
 9557 |       DEBUG_SIM("Received a NOT updated '/clock' message.");
      |       ^~~~~~~~~
In file included from /opt/ros/foxy/include/rclcpp/logging.hpp:23,
                 from /opt/ros/foxy/include/rclcpp/service.hpp:34,
                 from /opt/ros/foxy/include/rclcpp/callback_group.hpp:25,
                 from /opt/ros/foxy/include/rclcpp/any_executable.hpp:20,
                 from /opt/ros/foxy/include/rclcpp/memory_strategy.hpp:24,
                 from /opt/ros/foxy/include/rclcpp/memory_strategies.hpp:18,
                 from /opt/ros/foxy/include/rclcpp/executor_options.hpp:20,
                 from /opt/ros/foxy/include/rclcpp/executor.hpp:33,
                 from /opt/ros/foxy/include/rclcpp/executors/multi_threaded_executor.hpp:26,
                 from /opt/ros/foxy/include/rclcpp/executors.hpp:21,
                 from /opt/ros/foxy/include/rclcpp/rclcpp.hpp:146,
                 from /opt/ros/foxy/include/tf2_ros/buffer_interface.h:35,
                 from /opt/ros/foxy/include/tf2_ros/buffer.h:40,
                 from /home/ros2/workspace/src/zed-ros2-wrapper/zed_components/src/zed_camera/include/sl_types.hpp:18,
                 from /home/ros2/workspace/src/zed-ros2-wrapper/zed_components/src/zed_camera/include/zed_camera_component.hpp:22,
                 from /home/ros2/workspace/src/zed-ros2-wrapper/zed_components/src/zed_camera/src/zed_camera_component.cpp:22:
/opt/ros/foxy/include/rclcpp/logger.hpp:80:17: note: ‘rclcpp::get_logger’ declared here
   80 |   friend Logger rclcpp::get_logger(const std::string & name);
      |                 ^~~~~~
In file included from /opt/ros/foxy/include/rclcpp/service.hpp:34,
                 from /opt/ros/foxy/include/rclcpp/callback_group.hpp:25,
                 from /opt/ros/foxy/include/rclcpp/any_executable.hpp:20,
                 from /opt/ros/foxy/include/rclcpp/memory_strategy.hpp:24,
                 from /opt/ros/foxy/include/rclcpp/memory_strategies.hpp:18,
                 from /opt/ros/foxy/include/rclcpp/executor_options.hpp:20,
                 from /opt/ros/foxy/include/rclcpp/executor.hpp:33,
                 from /opt/ros/foxy/include/rclcpp/executors/multi_threaded_executor.hpp:26,
                 from /opt/ros/foxy/include/rclcpp/executors.hpp:21,
                 from /opt/ros/foxy/include/rclcpp/rclcpp.hpp:146,
                 from /opt/ros/foxy/include/tf2_ros/buffer_interface.h:35,
                 from /opt/ros/foxy/include/tf2_ros/buffer.h:40,
                 from /home/ros2/workspace/src/zed-ros2-wrapper/zed_components/src/zed_camera/include/sl_types.hpp:18,
                 from /home/ros2/workspace/src/zed-ros2-wrapper/zed_components/src/zed_camera/include/zed_camera_component.hpp:22,
                 from /home/ros2/workspace/src/zed-ros2-wrapper/zed_components/src/zed_camera/src/zed_camera_component.cpp:22:
/home/ros2/workspace/src/zed-ros2-wrapper/zed_components/src/tools/include/sl_logging.hpp:27:39: error: template argument 1 is invalid
   27 | #define DEBUG_SIM(...) if (mDebugSim) RCLCPP_DEBUG(get_logger(), __VA_ARGS__)
      |                                       ^~~~~~~~~~~~
/home/ros2/workspace/src/zed-ros2-wrapper/zed_components/src/zed_camera/src/zed_camera_component.cpp:9557:7: note: in expansion of macro ‘DEBUG_SIM’
 9557 |       DEBUG_SIM("Received a NOT updated '/clock' message.");
      |       ^~~~~~~~~
/home/ros2/workspace/src/zed-ros2-wrapper/zed_components/src/tools/include/sl_logging.hpp:27:39: error: template argument 1 is invalid
   27 | #define DEBUG_SIM(...) if (mDebugSim) RCLCPP_DEBUG(get_logger(), __VA_ARGS__)
      |                                       ^~~~~~~~~~~~
/home/ros2/workspace/src/zed-ros2-wrapper/zed_components/src/zed_camera/src/zed_camera_component.cpp:9557:7: note: in expansion of macro ‘DEBUG_SIM’
 9557 |       DEBUG_SIM("Received a NOT updated '/clock' message.");
      |       ^~~~~~~~~
/home/ros2/workspace/src/zed-ros2-wrapper/zed_components/src/tools/include/sl_logging.hpp:27:39: error: template argument 1 is invalid
   27 | #define DEBUG_SIM(...) if (mDebugSim) RCLCPP_DEBUG(get_logger(), __VA_ARGS__)
      |                                       ^~~~~~~~~~~~
/home/ros2/workspace/src/zed-ros2-wrapper/zed_components/src/zed_camera/src/zed_camera_component.cpp:9557:7: note: in expansion of macro ‘DEBUG_SIM’
 9557 |       DEBUG_SIM("Received a NOT updated '/clock' message.");
      |       ^~~~~~~~~
/home/ros2/workspace/src/zed-ros2-wrapper/zed_components/src/zed_camera/src/zed_camera_component.cpp:9559:5: error: ‘mLastClock’ was not declared in this scope
 9559 |     mLastClock = msg_time;
      |     ^~~~~~~~~~
In file included from /opt/ros/foxy/include/rclcpp/service.hpp:34,
                 from /opt/ros/foxy/include/rclcpp/callback_group.hpp:25,
                 from /opt/ros/foxy/include/rclcpp/any_executable.hpp:20,
                 from /opt/ros/foxy/include/rclcpp/memory_strategy.hpp:24,
                 from /opt/ros/foxy/include/rclcpp/memory_strategies.hpp:18,
                 from /opt/ros/foxy/include/rclcpp/executor_options.hpp:20,
                 from /opt/ros/foxy/include/rclcpp/executor.hpp:33,
                 from /opt/ros/foxy/include/rclcpp/executors/multi_threaded_executor.hpp:26,
                 from /opt/ros/foxy/include/rclcpp/executors.hpp:21,
                 from /opt/ros/foxy/include/rclcpp/rclcpp.hpp:146,
                 from /opt/ros/foxy/include/tf2_ros/buffer_interface.h:35,
                 from /opt/ros/foxy/include/tf2_ros/buffer.h:40,
                 from /home/ros2/workspace/src/zed-ros2-wrapper/zed_components/src/zed_camera/include/sl_types.hpp:18,
                 from /home/ros2/workspace/src/zed-ros2-wrapper/zed_components/src/zed_camera/include/zed_camera_component.hpp:22,
                 from /home/ros2/workspace/src/zed-ros2-wrapper/zed_components/src/zed_camera/src/zed_camera_component.cpp:22:
/home/ros2/workspace/src/zed-ros2-wrapper/zed_components/src/zed_camera/src/zed_camera_component.cpp:9562:7: error: ‘get_logger’ was not declared in this scope; did you mean ‘rclcpp::get_logger’?
 9562 |       get_logger(), "Error comparing clock messages: " <<
      |       ^~~~~~~~~~
In file included from /opt/ros/foxy/include/rclcpp/logging.hpp:23,
                 from /opt/ros/foxy/include/rclcpp/service.hpp:34,
                 from /opt/ros/foxy/include/rclcpp/callback_group.hpp:25,
                 from /opt/ros/foxy/include/rclcpp/any_executable.hpp:20,
                 from /opt/ros/foxy/include/rclcpp/memory_strategy.hpp:24,
                 from /opt/ros/foxy/include/rclcpp/memory_strategies.hpp:18,
                 from /opt/ros/foxy/include/rclcpp/executor_options.hpp:20,
                 from /opt/ros/foxy/include/rclcpp/executor.hpp:33,
                 from /opt/ros/foxy/include/rclcpp/executors/multi_threaded_executor.hpp:26,
                 from /opt/ros/foxy/include/rclcpp/executors.hpp:21,
                 from /opt/ros/foxy/include/rclcpp/rclcpp.hpp:146,
                 from /opt/ros/foxy/include/tf2_ros/buffer_interface.h:35,
                 from /opt/ros/foxy/include/tf2_ros/buffer.h:40,
                 from /home/ros2/workspace/src/zed-ros2-wrapper/zed_components/src/zed_camera/include/sl_types.hpp:18,
                 from /home/ros2/workspace/src/zed-ros2-wrapper/zed_components/src/zed_camera/include/zed_camera_component.hpp:22,
                 from /home/ros2/workspace/src/zed-ros2-wrapper/zed_components/src/zed_camera/src/zed_camera_component.cpp:22:
/opt/ros/foxy/include/rclcpp/logger.hpp:80:17: note: ‘rclcpp::get_logger’ declared here
   80 |   friend Logger rclcpp::get_logger(const std::string & name);
      |                 ^~~~~~
In file included from /opt/ros/foxy/include/rclcpp/service.hpp:34,
                 from /opt/ros/foxy/include/rclcpp/callback_group.hpp:25,
                 from /opt/ros/foxy/include/rclcpp/any_executable.hpp:20,
                 from /opt/ros/foxy/include/rclcpp/memory_strategy.hpp:24,
                 from /opt/ros/foxy/include/rclcpp/memory_strategies.hpp:18,
                 from /opt/ros/foxy/include/rclcpp/executor_options.hpp:20,
                 from /opt/ros/foxy/include/rclcpp/executor.hpp:33,
                 from /opt/ros/foxy/include/rclcpp/executors/multi_threaded_executor.hpp:26,
                 from /opt/ros/foxy/include/rclcpp/executors.hpp:21,
                 from /opt/ros/foxy/include/rclcpp/rclcpp.hpp:146,
                 from /opt/ros/foxy/include/tf2_ros/buffer_interface.h:35,
                 from /opt/ros/foxy/include/tf2_ros/buffer.h:40,
                 from /home/ros2/workspace/src/zed-ros2-wrapper/zed_components/src/zed_camera/include/sl_types.hpp:18,
                 from /home/ros2/workspace/src/zed-ros2-wrapper/zed_components/src/zed_camera/include/zed_camera_component.hpp:22,
                 from /home/ros2/workspace/src/zed-ros2-wrapper/zed_components/src/zed_camera/src/zed_camera_component.cpp:22:
/home/ros2/workspace/src/zed-ros2-wrapper/zed_components/src/zed_camera/src/zed_camera_component.cpp:9561:5: error: template argument 1 is invalid
 9561 |     RCLCPP_WARN_STREAM(
      |     ^~~~~~~~~~~~~~~~~~
/home/ros2/workspace/src/zed-ros2-wrapper/zed_components/src/zed_camera/src/zed_camera_component.cpp:9561:5: error: template argument 1 is invalid
 9561 |     RCLCPP_WARN_STREAM(
      |     ^~~~~~~~~~~~~~~~~~
/home/ros2/workspace/src/zed-ros2-wrapper/zed_components/src/zed_camera/src/zed_camera_component.cpp:9561:5: error: template argument 1 is invalid
 9561 |     RCLCPP_WARN_STREAM(
      |     ^~~~~~~~~~~~~~~~~~
/home/ros2/workspace/src/zed-ros2-wrapper/zed_components/src/zed_camera/src/zed_camera_component.cpp:9564:26: error: ‘mLastClock’ was not declared in this scope
 9564 |         static_cast<int>(mLastClock.get_clock_type()));
      |                          ^~~~~~~~~~
/home/ros2/workspace/src/zed-ros2-wrapper/zed_components/src/zed_camera/src/zed_camera_component.cpp:9566:5: error: ‘mClockAvailable’ was not declared in this scope
 9566 |     mClockAvailable = false;
      |     ^~~~~~~~~~~~~~~
/home/ros2/workspace/src/zed-ros2-wrapper/zed_components/src/zed_camera/src/zed_camera_component.cpp: At global scope:
/home/ros2/workspace/src/zed-ros2-wrapper/zed_components/src/zed_camera/src/zed_camera_component.cpp:9571:1: error: expected declaration before ‘}’ token
 9571 | }  // namespace stereolabs
      | ^
make[2]: *** [CMakeFiles/zed_camera_component.dir/build.make:89: CMakeFiles/zed_camera_component.dir/src/zed_camera/src/zed_camera_component.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:79: CMakeFiles/zed_camera_component.dir/all] Error 2

Hi @Leejh0426
Welcome to the Stereolabs community.

It seems that you did not have correctly installed the repository.
Can you please post the full build log?

Thank you for your response.
I actually solve my problem to change zed sdk version!
Thankyou

1 Like