Converting a JAR into a gcj-statically-linked SO

Andrew Haley aph@redhat.com
Wed Jan 9 14:09:00 GMT 2008


Andrew Haley writes:
 > Matthijs van de Water writes:
 >  > On Jan 8, 2008 8:04 PM, David Daney <ddaney@avtrex.com> wrote:
 >  > > > So this means that I cannot compile a shared library which does not
 >  > > > depend on libgcj?
 >  > > >
 >  > >
 >  > > It might work on some targets.  It would  not work on a mips target.
 >  > 
 >  > How about ARM?
 > 
 > No, for the same reason.  You'd need libgcj.a compiled PIC.
 > 
 >  > > > Any suggestions greatly appreciated.
 >  > > >
 >  > > Make sure it works with a shared libgcj before making large investments
 >  > > in linking statically.
 >  > 
 >  > As an alternative, I was thinking of stripping down libgcj unti its
 >  > size is acceptable. My Java language needs are pretty limited, so
 >  > an approach like micro-libgcj (although that seems to miss a few
 >  > classes I do need) seems feasible as well. It would just be nicer
 >  > if the compiler could do the stripping down, instead of me...
 >  > Would you recommend such an approach over the static linking?  Any
 >  > down-sides (speed)?
 > 
 > 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.

Andrew.

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



More information about the Java mailing list