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


On Fri, 11 Jan 2008, Matthijs van de Water wrote:

On Jan 10, 2008 9:14 AM, Marco Trudel <marco@mtsystems.ch> wrote:
Matthijs van de Water wrote:
The only down-side is that the resulting shared library is 24MB big
even after stripping and optimizing. I was expecting a lot less, is
there any chance the compiler is linking in stuff that is not actually
needed?

Yes. Use "-Wl,-Map,/tmp/linkmap.txt" to get the link map. For instance, you will always end up with the whole AWT (maybe even Swing) because the SecurityManager imports an AWT class. There are a lot of other such never needed imports. You can stub out certain objects. JNC (http://jnc.mtsystems.ch/) does this for instance for AWT/Swing or JCE. I explained a couple of times on the list how I do it. So, searching for my name in the archives should bring up something useful. Actually, I even created a project named GcjStubber about half a year ago that takes a statically compiled GCJ and creates a stub for all objects in libgcj.a. For compilation of applications, you can then add stubs for objects you don't need and therefore exclude the original objects. But so far, I didn't really finish it (it's about 90% done). But you're still invited to check it out in case you are interested: http://sourceforge.net/svn/?group_id=169793

This is very useful. I'm currently investigating this approach. I also like the micro-libgcj approach; as it turns out I'm only missing a hand full of methods in that, which should be not too hard to put back in.

Hi Matthijs. Please be aware that micro-libgcj is based on GCC 4.1.1, which means there is no support for Java 1.5 features such as generics, and it has not been tested on ARM, nor does it have the recent ARM patches in the GCC trunk.


I've spent some time trying to update micro-libgcj to work with a snapshot of the GCC trunk, but it was more work than I expected. Moreover, I decided that I'm not prepared to maintain such a large and invasive patch indefinitely. So micro-libgcj is dormant for now.

In your situation, I recommend using Marco's technique instead.

Thanks for the help Andrew, David and Marco! I'm sure I'll be back
with questions as soon as I need to get this ported to ARM ;)

Regards,

Matthijs


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