How to deal with undefined-non-weak-symbol

Ville Skyttä ville.skytta at iki.fi
Sat Jul 15 12:36:33 UTC 2006


On Sat, 2006-07-15 at 01:17 -0500, Jason L Tibbitts III wrote:

> I've found that running rpmlint on an installed package can turn up
> the undefined-non-weak-symbol warning while running it on the binary
> package doesn't

This is because checking them makes sense only when all dependencies of
that package are installed, and that can be "guaranteed" only when the
package itself is installed, not when invoking rpmlint on a random
uninstalled one.  Doing it to the latter would result in a lot of false
positives.

>   Unfortunately I have absolutely no idea what to do
> about it, or how to tell if it's actually a problem.

If I understand correctly, undefined non-weak symbols *in shared
libraries* are generally frowned upon because it causes the need to take
care of satisfying them in things that use those libs, which is
particularly bad when dlopening them.

It's kind of similar to the situation where one ships foo-config, *.la
or *.pc files in a -devel package, but fails to add appropriate Requires
corresponding to the -lfoo things emitted by those when used.

On the other hand, sometimes, but I think pretty rarely, undefined
non-weak symbols in shared libraries are desired.  This is why it's a
warning, not an error from rpmlint.  One (only?) example is when there
are multiple alternative things available on the target system that
provide those symbols and it adds value to leave the choice between them
open due to implementation differences.

Note that the above applies mostly to shared libs only; with other
shared objects which are installed somewhere else than in the dynamic
linker's default search path and are intended to be loaded under known
circumstances and by specific apps only which satisfy the dependencies
for their modules, things are different.  This is why rpmlint tries to
restrict this check only to shared libs installed in system lib paths.

> Is there any general technique for making them go away?

In general, link the shared library with all its non-weak dependencies,
ie. libraries providing those symbols.  "ldd -d -r" can be used to show
undefined non-weak symbols, and "nm -D" to list the symbols from others
when looking for candidates.  Hm, I guess I could add some of this to
rpmlint's explanation of the message.

Some pointers to further info and example cases:
http://www.google.com/search?q=undefined+non-weak
http://sources.redhat.com/ml/libc-alpha/2003-05/msg00034.html
http://sources.redhat.com/ml/libc-alpha/2003-05/msg00164.html




More information about the fedora-extras-list mailing list