GCJ adoption and improving our "PR"

Bryce McKinlay mckinlay@redhat.com
Wed Apr 14 21:33:00 GMT 2004


Erik Poupaert wrote:

>$ gcj -static Hello.java -o hello --main=Hello
>
>$ ls -lh hello
>
>-rwxr-xr-x    1 erik     users        4.2M Apr 14 20:19 hello
>
>That is: 4,376,645 bytes.
>That is: 4,274 KB.
>That is: 4.2 MB.
>
>It used to be better, I remember. 
>
>By the way, I've been treated to a whole new series of warnings en provenance from
>the linker underworld:
>
>/usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.2/libgcj.a(gc_dlopen.o)(.text+0xbc): In
>function `GC_dlopen':: warning: Using 'dlopen' in statically linked applications
>requires at runtime the shared libraries from the glibc version used for
>linking/usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.2/libgcj.a(natRuntime.o)(.text+0xcea):
>In function `java::lang::Runtime::insertSystemProperties(java::util::Properties*)'::
>warning: Using 'getpwuid_r' in statically linked applications requires at runtime the
>shared libraries from the glibc version used for
>  
>

I suggest linking glibc and others dynamically. Just link libgcj 
statically. glibc's ABI is stable enough these days that static linking 
just causes more problems than it solves. Your binary will be smaller too.

>Funny, isn't it? "Hello world" is dragging around -- kicking and screaming -- entire
>excerpts from java.net.InetAddress with related dependencies.
>  
>

Such is the nature of Java - it does not lend itself easily to static 
compilation. But there are ways to improve the situation.

Regards

Bryce



More information about the Java mailing list