buildd log scanner tag I-shlibs-useless-link
The build logs contains a line like
dpkg-shlibdeps: warning: dependency on LIBRARY could be avoided if "BINARY" were not uselessly linked...
This means a binary links to a library but dpkg-shlibs found no symbols used from it. Possible reasons:
- The library is linked in to have one of it's initializers run.
Removing the library might silently change the behaviour of the program.
- The build system links in all libraries to all its binaries though they
are only needed in some of them.
This slows down starting those programs a little bit. Unless some packages' dependencies change due to this, it's harmless.
- The program uses only functions of a library that are inlined.
(Note that some functions in math.h might be inlined for some architectures but not for others, causing warning about -lm on some while it cannot be removed on others.)
- A library is linked against but never used.
Just remove the linking, if you are sure it is this case and not one of the above.
- The build system links in all libraries needed when static linking.
even if using shared libraries. (As static libraries have no dependency
information, a program linking it needs to also link in all the dependencies).
This introduces the (theoretical) risk that when the depedency-only lib is changing sonames, this might cause both libraries to be pulled in.
This can be fixed by removing those libraries, after making sure it is really this case and not one of the previous ones.
- The program uses a set of libraries that ignore library boundaries (for example many libglib using libraries).
As headers might inline functions with calls to other libraries and this might change between versions, removing the -l is not possible. Here -Wl,--as-needed is the only solution.