This is the mail archive of the
libc-alpha@sources.redhat.com
mailing list for the glibc project.
Re: undefined non-weak symbols
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Jack Howarth <howarth at bromo dot med dot uc dot edu>
- Cc: libc-alpha at sources dot redhat dot com
- Date: Sun, 4 May 2003 01:53:00 +0200
- Subject: Re: undefined non-weak symbols
- References: <200305032335.TAA36470@bromo.msbb.uc.edu>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
On Sat, May 03, 2003 at 07:35:38PM -0400, Jack Howarth wrote:
> Jakub,
> I've asked you this a couple times before but I don't think
> I ever got a response (unless I missed it) and know some other
> debian folks are interested in the answer as well. Awhile back
> you told me that the warning issued from prelink of...
>
> prelink: Warning: /usr/lib/libpstoedit.so.0 has undefined non-weak symbols
>
> ...indicates that these libs would be prelinkable
Yes.
> (but that the not in the most optimal fashion).
Right.
> I am wondering if these undefined non-weak
> can be avoided by following any specific rules in how shared libs are
> compiled and linked? Or is this more of a random occurance due to how
> binutils decides to do the linking internally? Thanks in advance for
> any information.
E.g. on my box I get among other things:
prelink: Warning: /usr/lib/libgtk-1.2.so.0 has undefined non-weak symbols
Now, if you want to investigate this, you can do:
ldd /usr/lib/libgtk-1.2.so.0
It will print normal ldd output plus tons of warnings like:
undefined symbol: gdk_root_window (/usr/lib/libgtk-1.2.so.0)
undefined symbol: gdk_threads_mutex (/usr/lib/libgtk-1.2.so.0)
undefined symbol: gdk_display (/usr/lib/libgtk-1.2.so.0)
undefined symbol: gdk_font_equal (/usr/lib/libgtk-1.2.so.0)
undefined symbol: gdk_selection_property (/usr/lib/libgtk-1.2.so.0)
...
Now, one has to decide whether these are undefined on purpose (such as
in some modules which use some symbols exported from binaries,
or if those symbols can be picked up from different libraries which
implement the same functions differently, etc.),
or if this is just ommision of a some library which is always needed
for it to work in its DT_NEEDED.
In the case of libgtk-1.2.so.0 this looks obvious - the library
clearly cannot work without libgdk-1.2.so.0 loaded as well, so the fix
should be just make sure gcc -shared ... -o libgtk-1.2.so.0 is passed
-lgdk-1.2 on its command line. How to do that is application specific
obviously. And ideally, once a fix exists, it should of course be merged
to upstream maintainers of the project.
If this is not done, all these undefined symbols mean prelink conflicts
in all binaries which use these libraries.
E.g. on my box, there are 211 such undefined symbols in libgtk-1.2.so.0
(all of them because of missing libgdk-1.2.so.0 in DT_NEEDED), and every
program which links against libgtk-1.2.so.0 whether directly or indirectly
has those 211 completely unnecessary conflicts (e.g. gnome-terminal
has 479 of them, while if libgtk-1.2.so.0 link command was fixed,
it would already have just 268).
Hope this helps...
Jakub