Very bad ideas about naming the opencv libraries

Jetpack 5 comes with some parts of OpenCV. However, they are incompatible with the Ubuntu-distributed OpenCV and damage the underlying Ubuntu system.

The main problem lies in library libopencv-dev which has the same name as the ubuntu-distributed one, but comes in version 4.5, while Ubuntu distributes 4.2.

So if you install e.g. libopencv-core4.2 from Ubuntu, you get a non-functional hybrid, because its corresponding devel files are overwritten by the NVidia libopencv-dev in version 4.5. Compiling anything on such system is almost impossible. You get funny errors like undefined reference to cv::Mat::Mat() even if you correctly link to libopencv_core.so and the library exists.

Overwriting files in OS-installed packages, e.g. /usr/lib/aarch64-linux-gnu/libopencv_core.so is just a way to hell.

It would be much better if the nvidia-distributed OpenCV would use packages whose names do not collide with the OS-provided ones (e.g. libopencv-dev4.5 or libopencv-dev-jetpack) and that would all get installed to a non-default directory (e.g. /opt/jetpack/lib/...). This way, users could easily decide which applications should be built against the OS-provided OpenCV and which should be built against the NVidia provided version.

FYI @rouceto1

Hi,
Would like to get more information. Jetpack 5.0.2 is on Ubuntu 20.04. Do you mean Ubuntu 20.04 has to use libopencv-core4.2?

Yes! Ubuntu – Details of package libopencv-dev in focal . That’s the reason why Linux has distros - the distro maintainers make sure that all programs work well in the distro, but only with the versions of libraries they chose.

Of course you can use custom versions of OpenCV, but these can’t be installed in the default system paths (/usr/lib/aarch64). If they are (as JetPack does), any program distributed in Ubuntu-built .deb files is linked against 4.2 but would find and load the custom version instead, which usually leads to crashes and build problems. Custom versions should be installed in directories which are not on the default library search path (e.g. /opt/opencv).

Hi,
Does libopencv-core4.2 enable gstreamer bydefault? We have sample applications requiring gstreamer, so the package in SDKManger has WITH_GSTREAMER=ON.

I don’t have a Jetson at hand now, but it should have GStreamer enabled: debian/rules · debian/4.2.0+dfsg-6 · Debian Science Team / opencv · GitLab .