I am using ROS Melodic (Ubuntu 18.04 LTS), so I used JetPack v4.6.3 to get started with the AGX Xavier device. While compiling a ROS package, I got the OpenCV mismatch error as shown below:
CMake Error at CMakeLists.txt:31 (find_package):
Could not find a configuration file for package "OpenCV" that is compatible
with requested version "3".
The following configuration files were considered but not accepted:
/usr/lib/aarch64-linux-gnu/cmake/opencv4/OpenCVConfig.cmake, version: 4.1.1
-- Configuring incomplete, errors occurred!
I looked at the OpenCV package installed on AGX Xavier and found two versions as shown below:
ravi@ubuntu:~/ros_ws$ dpkg -l | grep libopencv
ii libopencv 4.1.1-2-gd5a58aa75 arm64 Open Computer Vision Library
ii libopencv-calib3d3.2:arm64 3.2.0+dfsg-4ubuntu0.1 arm64 computer vision Camera Calibration library
ii libopencv-core3.2:arm64 3.2.0+dfsg-4ubuntu0.1 arm64 computer vision core library
ii libopencv-dev 4.1.1-2-gd5a58aa75 arm64 Development files for Open Source Computer Vision Library
ii libopencv-features2d3.2:arm64 3.2.0+dfsg-4ubuntu0.1 arm64 computer vision Feature Detection and Descriptor Extraction library
ii libopencv-flann3.2:arm64 3.2.0+dfsg-4ubuntu0.1 arm64 computer vision Clustering and Search in Multi-Dimensional spaces library
ii libopencv-highgui3.2:arm64 3.2.0+dfsg-4ubuntu0.1 arm64 computer vision High-level GUI and Media I/O library
ii libopencv-imgcodecs3.2:arm64 3.2.0+dfsg-4ubuntu0.1 arm64 computer vision Image Codecs library
ii libopencv-imgproc3.2:arm64 3.2.0+dfsg-4ubuntu0.1 arm64 computer vision Image Processing library
ii libopencv-ml3.2:arm64 3.2.0+dfsg-4ubuntu0.1 arm64 computer vision Machine Learning library
ii libopencv-python 4.1.1-2-gd5a58aa75 arm64 Python bindings for Open Source Computer Vision Library
ii libopencv-samples 4.1.1-2-gd5a58aa75 arm64 Samples for Open Source Computer Vision Library
ii libopencv-videoio3.2:arm64 3.2.0+dfsg-4ubuntu0.1 arm64 computer vision Video I/O library
You can see there are two versions, i.e., 3.2.0 installed by ROS, and 4.1.1 installed by JetPack. Therefore, in order to fix my issue, I tried installing OpenCV 3.2.0 from source. I quickly jumped into jetsonhacks/buildOpenCVXavier repository. I set the OPENCV_VERSION=3.2.0 and executed the script. Unfortunately, the compilation did not work. Below is the errors snippet:
CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake files:
CUDA_nppi_LIBRARY (ADVANCED)
linked by target "opencv_cudev" in directory /home/ravi/opencv/modules/cudev
linked by target "opencv_cudev" in directory /home/ravi/opencv/modules/cudev
linked by target "opencv_test_cudev" in directory /home/ravi/opencv/modules/cudev/test
linked by target "opencv_test_core" in directory /home/ravi/opencv/modules/core
linked by target "opencv_core" in directory /home/ravi/opencv/modules/core
linked by target "opencv_core" in directory /home/ravi/opencv/modules/core
linked by target "opencv_perf_core" in directory /home/ravi/opencv/modules/core
...
The logs are really long. So I posted them to Pastebin to keep this post shorter and cleaner.
Any workaround, please.
Thank you