Static Linking Problem

Andrew Haley aph@redhat.com
Sat Nov 17 17:03:00 GMT 2007


Alan Eliasen writes:

 >    So, my question is: is there something that can be done to allow
 > this statically-linked executable to work?  I'd hate to have to
 > list and dummy-load all possible date formats and currencies for
 > all locales in the world just to format dates for the user's
 > default locale.  (I'm not even using Currencies!)  Can this
 > situation be improved?
 > 
 >    It makes static linking near-impossible, and this makes
 > distribution of programs compiled with gcj unworkable.  (I don't
 > want to ship my particular libgcj.so with the executables!)

Personally speaking I wouldn't even attempt it, but you can perhaps
try using -whole-archive to link.  A good deal of the Classpath
library assumes that dynamic loading of Java classes will work.
  
We have mostly solved this problem for GNU/Linux sytems: link with
-findrect-dispatch and you won't need a specific version of libgcj.
Your program will use whatever version of libgcj happens to be
installed, and it is backwards compatible.  However, this will break
on old Linux systems that don't have libgcj_bc.so; it depends how far
back you want to go with supported systems.

> (I don't want to ship my particular libgcj.so with the executables!)

Why not?  Licensing issues, or... ?

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