Ask Your Question
0

failed to build Ubuntu .deb file for OpenCV

asked 2019-05-14 07:58:02 -0500

I need to install OpenCV 4.1.0 on many Ubunu 18.04 computers, and would like to do so by installing the necessary .deb files. Ubuntu's 18.04 repo only has OpenCV v3.x, so I'm trying to create my own .deb file from some tutorials.

Steps so far which seems to work correctly:

wget https://github.com/opencv/opencv/archive/4.1.0.zip         --output-file=opencv-4.1.0.zip
wget https://github.com/opencv/opencv_contrib/archive/4.1.0.zip --output-file=opencv_contrib-4.1.0.zip
unzip opencv-4.1.0.zip
unzip opencv_contrib-4.1.0.zip
cd opencv-4.1.0
mkdir build
cd build
cmake \
  -DCPACK_BINARY_DEB=ON \
  -DCMAKE_BUILD_TYPE=Release \
  -DCMAKE_INSTALL_PREFIX=/usr/local \
  -DOPENCV_GENERATE_PKGCONFIG=ON \
  -DOPENCV_EXTRA_MODULES_PATH=../../opencv_contrib-4.1.0/modules \
  -DEXTRA_MODULES_VCSVERSION=4.1.0 \
  -DOPENCV_VCSVERSION=4.1.0 \
  -DWITH_TBB=ON \
  -DWITH_IPP=ON \
  -DWITH_CUDA=ON \
  -DWITH_OPENCL=ON \
  -DWITH_LIBV4L=ON \
  -DWITH_OPENMP=ON \
  -DWITH_NVCUVID=ON \
  -DWITH_CSTRIPES=ON \
  -DWITH_GSTREAMER=ON \
  -DBUILD_opencv_python2=ON \
  -DBUILD_opencv_python3=ON \
  -DBUILD_PERF_TESTS=OFF \
  -DBUILD_EXAMPLES=OFF \
  -DBUILD_TESTS=OFF \
  -DBUILD_DOCS=ON \
  ..
make -j4

Up to here is good. The part that does not work is the next command:

cpack -G DEB

(Or, make package, depending on the tutorial.)

It starts building the .deb packages, then outputs the following errors:

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_highgui.so.4.1 needed by ./usr/bin/opencv_visualisation (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_visualisation (ELF format: 'elf64-x86-64' abi: '0201003e00000000'; RPATH: '/usr/local/lib')
  dpkg-shlibdeps: error: cannot find library libopencv_imgcodecs.so.4.1 needed by ./usr/bin/opencv_visualisation (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_visualisation (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_visualisation (ELF format: 'elf64-x86-64' abi: '0201003e00000000'; RPATH: '/usr/local/lib')
  ...cut many 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';
  ...
CPack Error: Error while execution CPackDeb.cmake
CPack Error: Problem compressing the directory
CPack Error: Error when generating package: OpenCV
edit retag flag offensive close merge delete

1 answer

Sort by » oldest newest most voted
0

answered 2019-05-19 06:57:02 -0500

supra56 gravatar image

updated 2019-05-19 21:43:41 -0500

Try this:

override_dh_shlibdeps:
    dh_shlibdeps --dpkg-shlibdeps-params=--ignore-missing-info
edit flag offensive delete link more

Comments

And where would I do that? The .deb is created with CPack.

Stéphane Charette gravatar imageStéphane Charette ( 2019-05-19 11:14:57 -0500 )edit

I forgot one thing. Did you install dpkg-shlibdeps?

supra56 gravatar imagesupra56 ( 2019-05-19 21:43:02 -0500 )edit
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2019-05-14 07:58:02 -0500

Seen: 23 times

Last updated: 18 mins ago