![如何向 debian/control 添加共享库依赖项?](https://linux22.com/image/100095/%E5%A6%82%E4%BD%95%E5%90%91%20debian%2Fcontrol%20%E6%B7%BB%E5%8A%A0%E5%85%B1%E4%BA%AB%E5%BA%93%E4%BE%9D%E8%B5%96%E9%A1%B9%EF%BC%9F.png)
我正在尝试从依赖 OpenCV 的 Qt 应用程序制作 debian 包。
到目前为止我做了什么:
- 我在 Virtualbox 中设置了 Ubuntu
- 我安装了编译和运行应用程序所需的软件(Qt 相关的东西、
ffmpeg
编解码器、OpenCV 等) - 我成功编译并运行了该应用程序
- 我创建了一个 GPG 密钥
- 使用 dh_make 我在项目目录中创建了 debian 目录
- 我将包添加到 debian/control->Build Depends 我通过执行获得的内容
dpkg-depcheck -d qmake
- 我还向 Depends 添加了 dpkg-depcheck -d SampleApp 得到的内容
- 我编辑了版权和变更日志文件
- 我试着跑
dpkg-buildpackage -b
此时我收到错误消息:
dpkg-shlibdeps: error: no dependency information found for /usr/local/lib/libopencv_imgcodecs.so.3.1 (used by debian/sampleapp/opt/SampleApp/bin/SampleApp)
dh_shlibdeps: dpkg-shlibdeps -Tdebian/sampleapp.substvars debian/sampleapp/opt/SampleApp/bin/SampleApp returned exit code 2
make: *** [binary] Error 2
dpkg-buildpackage: error: debian/rules binary gave error exit status 2
所有这些文件都可以在 下找到/usr/local/lib/
。我读过这个:https://www.debian.org/doc/debian-policy/ch-sharedlibs.html但我找不到解决方案。如何将这些依赖项添加到包中?
编辑:
Build-Depends field:
Build-Depends: debhelper (>= 8.0.0), libpopt0:i386, libqt5core5a:i386, qtdeclarative5-dev, libglib2.0-0:i386, qtchooser, pkg-config, qt5-qmake:i386, locales
Depends field:
Depends: ${shlibs:Depends}, ${misc:Depends}, udev, libxext6:i386, libxcomposite1:i386, libopencore-amrwb0:i386, libglib2.0-0:i386, libpangocairo-1.0-0:i386, libva-drm1:i386, libxinerama1:i386, libmp3lame0:i386, libnih1:i386, libx11-6:i386, libxcb-render0:i386, libffi6:i386, libgdk-pixbuf2.0-0:i386, libdrm2:i386, libvorbis0a:i386, libfontconfig1:i386, libxrender1:i386, libpango-1.0-0:i386, libdbus-1-3:i386, libpixman-1-0:i386, libopenexr6:i386, libxvidcore4:i386, libjpeg-turbo8:i386, libcgmanager0:i386, libcairo2:i386, libjasper1:i386, libxfixes3:i386, libilmbase6:i386, libtiff5:i386, libusb-1.0-0:i386, libdc1394-22:i386, libxi6:i386, libfreetype6:i386, libxrandr2:i386, libqt5network5:i386, libpng12-0:i386, libthai0:i386, libxcb-shm0:i386, libva1:i386, libvorbisenc2:i386, libtheora0:i386, libharfbuzz0b:i386, libicu52:i386, libjbig0:i386, libopencore-amrnb0:i386, libogg0:i386, libxcursor1:i386, libxcb1:i386, libraw1394-11:i386, libudev1:i386, libnih-dbus1:i386, libqt5core5a:i386, libgraphite2-3:i386, libva-x11-1:i386, libatk1.0-0:i386, libexpat1:i386, libgtk2.0-0:i386, libpangoft2-1.0-0:i386, libdatrie1:i386, libxdmcp6:i386, libvdpau1:i386, libxdamage1:i386, libxau6:i386
答案1
如果您依赖的共享库安装在/usr/local/lib
而不是/usr/lib
(或类似的)中,那么我怀疑它不是dpkg
包管理器管理的任何包的一部分。dh_shlibdeps
想要构建新包必须依赖的所有内容的完整列表,但在这种情况下,其中一个内容似乎存在于任何包之外,因此无法列出。
您应该从 Debian 软件包(加上其相应的-dev
软件包,以便您可以针对它进行构建)安装 OpenCV,而不是从本地安装。