2

I'm trying to create a .deb package of my Qt application with dpkg-buildpackage. I compiled a third party (snmp) to use in my application. It runs successfully. But when generating an .deb app a got the error:

dpkg-shlibdeps: error: no dependency information found for /usr/local/lib/libnetsnmp.so.30

I've been looking for the solution in this link:

dpkg-shlibdeps: error: no dependency information found for

and also on other pages, but didn't find the solution.

I tried editing the /etc/ld.so.conf to add the libnetsnmp.so.30 path, but it didn't work.

I just realized when run the command:

ldconfig -p | grep libnetsnmp.so.30

that I got two libnetsnmp.so.30 libs in ldconfig, and also that they differ each other.

libnetsnmp.so.30 (libc6,x86-64) => /usr/local/lib/libnetsnmp.so.30
libnetsnmp.so.30 (libc6,x86-64) => /usr/lib/x86_64-linux-gnu/libnetsnmp.so.30

I also tried making available only one of them. But it didn't work.

Is there any way of generating the .deb package with or without this lib?

Obs.: I don't intend to edit the /usr/bin/dpkg-shlibdeps to $ignore_missing_info = 1 as a workaround.

Thanks

Community
  • 1
  • 1
user1589169
  • 15
  • 1
  • 6

1 Answers1

9

dpkg-shlibdeps is a tool intended to figure out all the packages that your new package depends on by way of dynamic linking. It does this by checking all your new binaries to see what libs they are linked to, and what symbols from those libs are used, and then checking the dpkg database to see what packages own those libs and find the lowest package version necessary to provide the necessary symbols.

In your case, it sees that your application links with that libnetsnmp.so.30, so it checks to see what package owns that library. Oops, no package does. That's where the error comes from--maybe you already know all that, but I thought I'd include it for context.

The right solution, now, depends on how you want to treat your custom-compiled snmp library. Basically the choices are (a) ship your custom libnetsnmp with your package, (b) package your custom libnetsnmp separately, or (c) don't use a custom libnetsnmp at all; use whatever libsnmp* package your OS provides instead.

(a): To ship libnetsnmp with your package, you need to be careful to make sure it doesn't provide the same SONAME as the standard libsnmp package, so they don't interfere with each other. The easiest way to do that is probably just to link against it statically (link against the .a or .o files instead of the .so dynamic library). This might be frowned on if your package is intended for Debian or Ubuntu proper, but if you demonstrate that choices (b) and (c) aren't workable for you, it'll probably be fine.

(b): Packaging libraries correctly is a fairly in-depth topic; too much for a StackOverflow answer. But documentation is out there. Depending on how much your libnetsnmp is changed from the upstream version, you may want to change the name of the library (and SONAME) to avoid any confusion. If your libnetsnmp is just a backport of the newer libsnmp packages in Debian sid or Ubuntu, then the right thing might be to ship a copy of the "official" libsnmp30 deb in your PPA or arrange for libsnmp30 to be shipped in a -backports repository. Then you would just need to add a Build-Depends: on libsnmp-dev (>= whatever) to your package, and build against that (instead of a manually-installed .so file in /usr/local).

(c): If you didn't actually need to do a custom compilation of snmp, and the version available in your OS/distro is good enough, then just Build-Depends: on that, and remove the manually installed .so file in /usr/local.

the paul
  • 8,972
  • 1
  • 36
  • 53