OpenCV libraries missing or links are broken on a fresh install

Hello,

The following error crops up when Cmake executes on AGX Orin

find_package(OpenCV REQUIRED)

CMake Error at /usr/lib/cmake/opencv4/OpenCVModules.cmake:172 (message):
  The imported target "opencv_core" references the file

     "/usr/lib/libopencv_core.so.4.8.0"

The paths and files should all be set by libopencv-dev, which is installed from the L4T repo:

libopencv-dev:
  Installed: 4.8.0-1-g6371ee1
  Candidate: 4.8.0-1-g6371ee1
  Version table:
 *** 4.8.0-1-g6371ee1 600
        600 https://repo.download.nvidia.com/jetson/common r36.4/main arm64 Packages
        100 /var/lib/dpkg/status
     4.5.4+dfsg-9ubuntu4 500
        500 http://ports.ubuntu.com/ubuntu-ports jammy/universe arm64 Packages

There is a symlink from libopencv_core.so in /usr/lib:

neurofit@ubuntu:/usr/lib$ ls -l libopencv_core.so
lrwxrwxrwx 1 root root 21 Aug 28  2023 libopencv_core.so -> libopencv_core.so.408

however libopencv_core.so.408 is not installed


neurofit@ubuntu:/usr/lib$ ls libopencv_core.so.408
ls: cannot access 'libopencv_core.so.408': No such file or directory

This error is new, any help would be appreciated. Thanks!

Hi,

Is this error occurring on JetPack 6.0?

I’m not sure about the missing .so file, but I might be able to help you compile OpenCV with CUDA support directly on the board, that’s usually what I do.

Alternatively, you can try using this Debian package I compiled for Orin with JetPack 6.0. It includes all OpenCV components, has CUDA support enabled, and replaces the default installation.

To install it, copy it into the board and run:

sudo apt install ./libopencv-full_4.8.0-1_arm64.deb

Let me know it you need a different version, I can share the instructions and the debian folder used to generate the .deb.

Hi Miguel,

Thanks for your message.

It’s JetPack 6.2 with a stock NVIDIA apt package for libopencv-dev, so it seems like there might be an issue with the package itself which contains both the cmake setup files and the opencv libraries. I was hoping somebody from NVIDIA would comment on this, maybe push a fix to L4T if this assessment is correct.

I just checked the Debian packages from SDK Manager, and the binary you’re missing is definitely included.

SDK Manager installs OpenCV using the following packages:

OpenCV-4.8.0-1-g6371ee1-aarch64-dev.deb  
OpenCV-4.8.0-1-g6371ee1-aarch64-licenses.deb  
OpenCV-4.8.0-1-g6371ee1-aarch64-samples-data.deb  
OpenCV-4.8.0-1-g6371ee1-aarch64-libs.deb  
OpenCV-4.8.0-1-g6371ee1-aarch64-python.deb  
OpenCV-4.8.0-1-g6371ee1-aarch64-samples.deb  
  • libopencv_core.so (a symlink to libopencv_core.so.408) is included in …-dev.deb.

  • libopencv_core.so.408 and libopencv_core.so.4.8.0 are both provided by …-libs.deb.

It’s likely your installation didn’t complete correctly, since the -libs package is a dependency of -dev. I suggest reinstalling OpenCV-4.8.0-1-g6371ee1-aarch64-libs.deb manually or using SDK Manager.

sudo apt install --reinstall ./OpenCV-4.8.0-1-g6371ee1-aarch64-libs.deb  

Nope, did not work, but thank you for these suggestions. Tried installing your Debian package, tried libopencv-dev as I mentioned before. This should be simple to do using stock NVIDIA tools already compiled with CUDA acceleration.

If you have an AGX Orin, you flash JetPack 6.2 and run apt install libopencv-dev? These are all NVIDIA products, downloaded directly, and you will probably replicate the missing library error that I mentioned when find_package(OpenCV REQUIRED) is called.

Hi,

The file exists in our environment:

$ ll libopencv_core*
lrwxrwxrwx 1 root root      21 Aug 29  2023 libopencv_core.so -> libopencv_core.so.408
-rw-r--r-- 1 root root 3860392 Aug 29  2023 libopencv_core.so.4.8.0
lrwxrwxrwx 1 root root      23 Aug 29  2023 libopencv_core.so.408 -> libopencv_core.so.4.8.0

Could you try to re-install OpenCV to see if it can fix the issue?

$ sudo apt install nvidia-opencv*

Thanks.

1 Like

Tried installing your Debian package

My Debian package won’t work because it was compiled for JetPack 6.0, and you’re using 6.2, which includes a different CUDA version.

If the apt command fails, you can still find the Debian package in the SDK Manager downloads folder:

~/Downloads/nvidia/sdkm_downloads/OpenCV-4.8.0-1-g6371ee1-aarch64-libs.deb

I guarantee the file you’re missing is inside that package, I verified it using dpkg -X.

Yep, that was it! Thanks!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.