This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

A better solution for merging shared libs


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]