public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* A better solution for merging shared libs
@ 2007-02-20 14:50 Lucio Biondi
  0 siblings, 0 replies; only message in thread
From: Lucio Biondi @ 2007-02-20 14:50 UTC (permalink / raw)
  To: gcc-help

After a lot of work I have at least realized how merging in one
only big ball (libvlc.so... 50MB unstripped ;-) all Videolan's
shared libs (I need this for a java project).

Nevertheless my current solution is not handy and I guess it
could give me much trouble in the future.

So my question is... Is there a better approach than mine ?

At present I do compile the library for an Athlon 64 with :

    gcc -shared -Wl,-soname,libvlc -o libvlc.so -Wl,--allow-multiple-definition \
        vlc/src/input/.libs/libvlc_la-item.o \
        vlc/src/input/.libs/libvlc_la-access.o \
        ... \
        -Wl,--whole-archive \
                (other libs to include) \
        -Wl,--no-whole-archive \
        -L/lib64 \
                -lc \
                ...
        -L/usr/lib64 \
                -lX11 \
                ...

but, as I said, it's not handy (indeed), since you need to list each
vlc objects (and they are a lot...) depending on the order of symbols
definition.

I can't copy all objects in a separate directory to do :

        gcc -shared -Wl,-soname,libvlc -o libvlc.so -Wl,--allow-multiple-definition \
                objs/*.o

as only the first symbol definition will be inserted by the linker in the final lib,
and this could be just a symbol declaration or a use of it, not the real symbol
definition, leading at run-time to "libvlc.so: undefined symbol".

Probably I missed or misunderstood something...

Thanks in advance for any hints...

Lucio

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2007-02-20 11:01 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-02-20 14:50 A better solution for merging shared libs Lucio Biondi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).