0

I'm building a runtime-shared-library package libfoo0.deb where 0 here is a major package version and adhering to the naming conventions specified in the Debian policy.

The problem is I want to build another shared library libbar depending on the runtime shared library package libfoo0. So I'm considering adding a depends stanza, but I'm not sure if it is necessary to specify a version, like

Depends: libfoo0 (= 0.0.4)

The 0.0.4 here is the version of libfoo0-dev.deb (package containing development files/necessary symlinks in /usr/lib/) with which the libbar was built. The problem I see is that would prohibit users from updating libfoo0.

Question: As long as libfoo0 is binary backward compatible across major library version isn't it required to specify a dependency on the exact version of libfoo0 a library/binary was built with?

2

If your build includes dh_shlibdeps or dpkg-shlibdeps (if you’re using dh, this will be taken care of), you should add

Depends: ${shlibs:Depends}

to libbar’s control file, and the appropriate dependencies will be added for you.

You shouldn’t hard-code a specific version, unless libraries need to be upgraded in lockstep. The idea is that libraries with the same major version are supposed to be backwards-compatible, so as long as you have a version greater than or equal to the one you need, you should be OK. The tools will also take care of this for you; you might need to manually add a shlibs or symbols file to libfoo; IIRC the build will tell you when you need to deal with that.

  • This is not directly to the question, but I'd like to ask about best practices of packaging development files. Currently my libfoo0 and libfoo0-dev are independent and libfoo0-dev contains all the files libfoo0 does and headers needed to compile binaries. So when libfoo0 is installed attempting to install libfoo0-dev fails because of it contains the files of libfoo0. Would not it be better to make libfoo0-dev depending on libfoo0 of the same version. – Some Name May 25 at 13:47
  • 1
    Yes, your -dev package should depend on the library package with the same version. You probably should name it libfoo-dev, not libfoo0-dev. – Stephen Kitt May 25 at 14:10
  • The reason I added major version to the development package name was to support multiple development versions. Does not it make any sense? – Some Name May 25 at 14:56
  • 1
    It does make sense in some circumstances but IME it causes more problems than it solves. Obviously if you know you need to be able to install multiple development versions in parallel, go for it; but be aware that it complicates migrations an awful lot. – Stephen Kitt May 25 at 15:01
  • And if you provide multiple development packages, those should carry the API version in their names. (I think this mostly makes sense if they're co-installable.) On the other hand the library packages carry the SO version (derived from the ABI version) in their names. So the numbers in libfooX and libfooY-dev are unrelated. – Ferenc Wágner May 25 at 18:04

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.