Hatred's Log Place

DON'T PANIC!

Sep 4, 2014 - 2 minute read -

Проблема с внутренними зависимостями при отстройке deb пакетов

Не знал как лучше сформулировать тему.

Суть: есть source-пакет из которого строится несколько бинарных deb-пакетов.

Допустим:

  • Библиотека: libfoo
  • Бинарник, зависящий от этой библиотеки: foo
  • Пакет для разработчика: libfoo-dev

При отстройке имеем примерно такую проблему:

dpkg-shlibdeps: error: couldn't find library libopencv_core.so.2.4 needed by debian/libopencv-ffmpeg-dev/opt/opencv/bin/opencv_traincascade (ELF format: 'elf64-x86-64'; RPATH: '')
dpkg-shlibdeps: error: couldn't find library libopencv_ml.so.2.4 needed by debian/libopencv-ffmpeg-dev/opt/opencv/bin/opencv_traincascade (ELF format: 'elf64-x86-64'; RPATH: '')
dpkg-shlibdeps: error: couldn't find library libopencv_imgproc.so.2.4 needed by debian/libopencv-ffmpeg-dev/opt/opencv/bin/opencv_traincascade (ELF format: 'elf64-x86-64'; RPATH: '')
dpkg-shlibdeps: error: couldn't find library libopencv_highgui.so.2.4 needed by debian/libopencv-ffmpeg-dev/opt/opencv/bin/opencv_traincascade (ELF format: 'elf64-x86-64'; RPATH: '')
dpkg-shlibdeps: error: couldn't find library libopencv_objdetect.so.2.4 needed by debian/libopencv-ffmpeg-dev/opt/opencv/bin/opencv_haartraining (ELF format: 'elf64-x86-64'; RPATH: '')
dpkg-shlibdeps: error: couldn't find library libopencv_calib3d.so.2.4 needed by debian/libopencv-ffmpeg-dev/opt/opencv/bin/opencv_haartraining (ELF format: 'elf64-x86-64'; RPATH: '')
dpkg-shlibdeps: error: couldn't find library libopencv_highgui.so.2.4 needed by debian/libopencv-ffmpeg-dev/opt/opencv/bin/opencv_haartraining (ELF format: 'elf64-x86-64'; RPATH: '')
dpkg-shlibdeps: error: couldn't find library libopencv_imgproc.so.2.4 needed by debian/libopencv-ffmpeg-dev/opt/opencv/bin/opencv_haartraining (ELF format: 'elf64-x86-64'; RPATH: '')
dpkg-shlibdeps: error: couldn't find library libopencv_core.so.2.4 needed by debian/libopencv-ffmpeg-dev/opt/opencv/bin/opencv_haartraining (ELF format: 'elf64-x86-64'; RPATH: '')
dpkg-shlibdeps: error: couldn't find library libopencv_core.so.2.4 needed by debian/libopencv-ffmpeg-dev/opt/opencv/bin/opencv_performance (ELF format: 'elf64-x86-64'; RPATH: '')
dpkg-shlibdeps: error: couldn't find library libopencv_highgui.so.2.4 needed by debian/libopencv-ffmpeg-dev/opt/opencv/bin/opencv_performance (ELF format: 'elf64-x86-64'; RPATH: '')
dpkg-shlibdeps: error: couldn't find library libopencv_objdetect.so.2.4 needed by debian/libopencv-ffmpeg-dev/opt/opencv/bin/opencv_performance (ELF format: 'elf64-x86-64'; RPATH: '')
dpkg-shlibdeps: error: couldn't find library libopencv_objdetect.so.2.4 needed by debian/libopencv-ffmpeg-dev/opt/opencv/bin/opencv_createsamples (ELF format: 'elf64-x86-64'; RPATH: '')
dpkg-shlibdeps: error: couldn't find library libopencv_calib3d.so.2.4 needed by debian/libopencv-ffmpeg-dev/opt/opencv/bin/opencv_createsamples (ELF format: 'elf64-x86-64'; RPATH: '')
dpkg-shlibdeps: error: couldn't find library libopencv_highgui.so.2.4 needed by debian/libopencv-ffmpeg-dev/opt/opencv/bin/opencv_createsamples (ELF format: 'elf64-x86-64'; RPATH: '')
dpkg-shlibdeps: error: couldn't find library libopencv_imgproc.so.2.4 needed by debian/libopencv-ffmpeg-dev/opt/opencv/bin/opencv_createsamples (ELF format: 'elf64-x86-64'; RPATH: '')
dpkg-shlibdeps: error: couldn't find library libopencv_core.so.2.4 needed by debian/libopencv-ffmpeg-dev/opt/opencv/bin/opencv_createsamples (ELF format: 'elf64-x86-64'; RPATH: '')
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 set LD_LIBRARY_PATH.

При этом библиотеки отстроены и с ними всё в порядке.

Лечится добавлением в debian/rules примерно такого:

override_dh_shlibdeps:
        LD_LIBRARY_PATH=$(LD_LIBRARY_PATH):debian/tmp/PATH_TO_LIB_DIR dh_shlibdeps

Главное, замените PATH_TO_LIB_DIR на своё, обычно это PREFIX/lib или PREFIX/lib/$(DEB_HOST_MULTIARCH)