Installation Issues with zed-ros2-examples: rosdep Error and Build Conflicts with OpenCV

Hello,

I am facing issues while trying to install the zed-ros2-examples on my Jetson device following the official instructions. After cloning the repository and updating the dependencies, I encounter the following errors during the process:

  1. rosdep Error: When running rosdep install --from-paths src --ignore-src -r -y, I receive the following error:
ERROR: the following packages/stacks could not have their rosdep keys resolved
to system dependencies:
zed_robot_integration: Cannot locate rosdep definition for [scout_description]
Continuing to install resolvable dependencies...

Despite this error, rosdep continues and claims that all required rosdeps were installed successfully.

Build Errors: During the build process with colcon build --symlink-install --cmake-args=-DCMAKE_BUILD_TYPE=Release,

I encounter the following errors:

In file included from /home/jetson/ros2_ws/src/zed-ros2-examples/examples/zed_aruco_localization/src/component/src/zed_aruco_localization_component.cpp:24:
/home/jetson/ros2_ws/src/zed-ros2-examples/examples/zed_aruco_localization/src/component/include/aruco.hpp:87:18: error: redefinition of ‘class cv::aruco::Dictionary’
...
In file included from /usr/include/opencv4/opencv2/objdetect/aruco_dictionary.hpp:25:27: note: previous definition of ‘class cv::aruco::Dictionary’

The errors seem to be related to conflicts between the aruco.hpp file included in the zed_aruco_localization package and the existing OpenCV4 aruco headers. This leads to redefinition errors for classes like cv::aruco::Dictionary, cv::aruco::DetectorParameters, and others.

I have tried updating all dependencies and rebuilding the workspace, but the issue persists. Unfortunately, as a new user, I am unable to attach the error.txt file with the full error log. Could anyone provide guidance on how to resolve these conflicts and the rosdep error?

Thank you in advance for your help!

When I attempted to bypass it by using the following command:

colcon build --symlink-install --cmake-args=-DCMAKE_BUILD_TYPE=Release --packages-skip zed_aruco_localization

this resulted in another error with the zed_rgb_convert package:

/usr/bin/ld: libzed_rgb_convert_component.so: undefined reference to `cv::cvtColor(cv::_InputArray const&, cv::_OutputArray const&, int, int)'
collect2: error: ld returned 1 exit status
gmake[2]: *** [CMakeFiles/zed_rgb_convert.dir/build.make:483: zed_rgb_convert] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:192: CMakeFiles/zed_rgb_convert.dir/all] Error 2
gmake: *** [Makefile:146: all] Error 2

The build fails with this error, and the zed_rgb_convert package does not compile successfully. Additionally, I am also getting warnings related to missing paths in the environment variables like AMENT_PREFIX_PATH and CMAKE_PREFIX_PATH.

I have tried updating all dependencies and rebuilding the workspace, but the issue persists. Unfortunately, as a new user, I am unable to attach the error.txt file with the full error log. Could anyone provide guidance on how to resolve these issues?

Thank you in advance for your help!

Hi @ErayBe
Welcome to the Stereolabs community

Concerning zed_robot_integration you can ignore the ERROR if you are not using the scout_description package.

Concerning the issues you are experiencing with OpenCV, it seems that your configuration is incorrect.
How did you install OpenCV?

As for the issues with OpenCV, I followed the instructions from this guide to install OpenCV on my Jetson device. After the installation, when I run the command:

jetson@ubuntu:~$ pkg-config --modversion opencv4

I get the following version:

4.10.0

Are you using a Jetson Nano? What Jetpack/L4T version?

I use the Jetson Orin 16GB with Jetpack 6.0/ L4T 36.3.0

In my opinion, you broke the OpenCV configuration, so the libraries are not correctly detected.

I recommend you uninstall OpenCV, both the versions you installed (Jetpack and sources).
Then you should uninstall ROS2.
Now you can install OpenCV with the method you prefer and then install ROS 2 again which will detect the installed OpenCV libraries and adapt to the active configuration.

Unfortunately the instructions didn’t work. I encountered the same error

Hi @ErayBe
unfortunately, this is a custom configuration of the Jetson, and finding a fix is out of the scope of our support. You can try to search and eventually open a thread on the NVIDIA Developer forum.

In any case, I recommend you reflash your Jetson with the SDK Manager application, being careful to not install OpenCV (you can unselect it from the list of the installed packages).
Then you can install the CUDA version you prefer and then ROS 2.

I recommend following this reliable guide:

I was able to resolve the issue by reflashing my Jetson device and selecting all the tools during the installation process (choosing all the available radiobuttons).

Thank you again for your support!

1 Like