2

Attempting to follow some tutorials on building a .deb package for a newer version of OpenCV in Ubuntu 18.04. Here are my steps:

wget https://github.com/opencv/opencv/archive/4.1.0.zip
unzip 4.1.0.zip
cd opencv-4.1.0
mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=Release -DOPENCV_GENERATE_PKGCONFIG=ON -DCMAKE_INSTALL_PREFIX=/usr/local ..

At this point I edit the CMakeCache.txt file, and modify this line from OFF to ON:

CPACK_BINARY_DEB:BOOL=ON

This next step compiles everything successfully, but then fails during the creation of the .deb package:

make -j4 package

This is the tail end of the output it produces with the error messages:

Run CPack packaging tool...
CPack: Create package using DEB
CPack: Install projects
CPack: - Run preinstall target for: OpenCV
CPack: - Install project: OpenCV
CPack: -   Install component: dev
CPack: -   Install component: java
CPack: -   Install component: libs
CPack: -   Install component: licenses
CPack: -   Install component: python
CPack: -   Install component: scripts
CPack: Create package
CPackDeb: - Generating dependency list
CMake Error at /usr/share/cmake-3.10/Modules/CPackDeb.cmake:709 (message):
  CPackDeb: dpkg-shlibdeps: '
  dpkg-shlibdeps: error: cannot find library libopencv_calib3d.so.4.1 needed by ./usr/bin/opencv_interactive-calibration (ELF format: 'elf64-x86-64' abi: '0201003e00000000'; RPATH: '/usr/local/lib')
  dpkg-shlibdeps: error: cannot find library libopencv_features2d.so.4.1 needed by ./usr/bin/opencv_interactive-calibration (ELF format: 'elf64-x86-64' abi: '0201003e00000000'; RPATH: '/usr/local/lib')
  dpkg-shlibdeps: error: cannot find library libopencv_highgui.so.4.1 needed by ./usr/bin/opencv_interactive-calibration (ELF format: 'elf64-x86-64' abi: '0201003e00000000'; RPATH: '/usr/local/lib')
  dpkg-shlibdeps: error: cannot find library libopencv_videoio.so.4.1 needed by ./usr/bin/opencv_interactive-calibration (ELF format: 'elf64-x86-64' abi: '0201003e00000000'; RPATH: '/usr/local/lib')
  dpkg-shlibdeps: error: cannot find library libopencv_imgproc.so.4.1 needed by ./usr/bin/opencv_interactive-calibration (ELF format: 'elf64-x86-64' abi: '0201003e00000000'; RPATH: '/usr/local/lib')
  dpkg-shlibdeps: error: cannot find library libopencv_core.so.4.1 needed by ./usr/bin/opencv_interactive-calibration (ELF format: 'elf64-x86-64' abi: '0201003e00000000'; RPATH: '/usr/local/lib')
...cut lots more...
  dpkg-shlibdeps: error: cannot continue due to the errors listed above
  Note: libraries are not searched in other binary packages that do not have any shlibs or symbols file.
  To help dpkg-shlibdeps find private libraries, you might need to use -l.
  ';
  executed command: '/usr/bin/dpkg-shlibdeps --ignore-missing-info -O ./usr/bin/opencv_annotation;./usr/bin/opencv_interactive-calibration;./usr/bin/opencv_version;./usr/bin/opencv_visualisation';

Can anyone shed light on what I must do to create the OpenCV .deb file?

0

A little late in answering, but I landed here because I was looking for answers to the same problem on nVidia Jetson Nano. Eventually, I dug a little bit to solve it. Here is what I did to successfully build a .deb package.

After "cmake"ing and turning the flag CPACK_BINARY_DEB:BOOL on,

  1. make first.

  2. Edit the CPackConfig.cmake file in your build directory

    1. to comment out the line set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS "TRUE") -- borrowed from this Mozilla Services lua_sandbox resolved issue.
    2. to replace all occurrences of unknown (version) to 4.1.0.
  3. Edit the CPackSourceConfig.cmake to replace all occurrences of unknown (version) to 4.1.0.

  4. make package

Step 1 allows the package tool to find the missing library dependencies that need to be built first. The first edit in step 2 allowed building the deb package, and other edits allowed building packages with numeric version number (correct thing to do for future upgrades), without which dpkg complains.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.