This is the mail archive of the java@gcc.gnu.org mailing list for the Java 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]

Re: Converting a JAR into a gcj-statically-linked SO


Matthijs van de Water writes:
 > On Jan 9, 2008 1:17 PM, Andrew Haley <aph@redhat.com> wrote:
 > >  > It's really hard to do.  A hell of a lot harder than just recompiling
 > >  > libgcj.a PIC, which is pretty easy.
 > >
 > > Actually, you don't even need to recompile it: just find all the .o
 > > files that were used to build libgcj.so and put them into a .a file.
 > 
 > OK, that sounds easy but I'm not really sure how to do it... I'm
 > looking at the Makefile in libjava and the output of doing a "make
 > libgcj.la", which looks like it should contain the information I need.
 > But frankly I'm not really sure which of the huge amount of .o files
 > should be AR-ed together in the .a file.
 > 
 > Can I somehow edit the libjava/Makefile to convince libtool to do the
 > dirty job for me?

At the thought of anything to do with libtool I begin to panic.  :-)

You don't have to do anything like that.  For every file that is
compiled by libtool, two objects are created: one called foo.o and one
called ./libs/foo.o.  The non-PIC one is foo.o.

So, to get an archive with just the PIC libs it's

  find . -name .libs | while read i; do ls -1 $i/*.o ; done | xargs ar q foo.a

Pretty hacky but good enough for an experiment.

Andrew.

-- 
Red Hat UK Ltd, Amberley Place, 107-111 Peascod Street, Windsor, Berkshire, SL4 1TE, UK
Registered in England and Wales No. 3798903


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