gcj with date manip. and french locale (intel AND linuxppc)
Bryce McKinlay
bryce@waitaki.otago.ac.nz
Wed Mar 7 17:42:00 GMT 2001
Mark Wielaard wrote:
> > gcj -O0 -g -static --main=Test -o test Test.java
> > ./test
>> I am not sure what goes wrong exactly. But it seems to work if you compile
> without -static. You will have define LD_LIBRARY_PATH:
> export LD_LIBRARY_PATH=/usr/local/pack/gcc-3.0-cvs-20010306/powerpc-linux/lib
Right. The problem is that the LocaleData resources are dynamically loaded via
ResourceBundle.getResource() mechanism. Normally this works because these
resouces are found in libgcj.so. But when static linking, GCJ does not know to
put them into the binary because it does not see a static dependency:
> Exception in thread "main" java.util.MissingResourceException: can't load
bundle
One workaround is to set your CLASSPATH to point to libgcj.jar. This way the
interpreter can load the resources.
Another would be to use the special linker command to force the class to be
included in the static binary.
Now, we could force dependencies on the LocaleData's so that they always get
linked in, like we do already for the protocol classes. I don't like that
solution though, since we'd end up having to do this for all Locales (although
currently we only have generic en and en_US), and each one adds to the size of
every static binary, even if they don't use most Locales. Better fix may be to
add a "--with-locale" option to the compiler, along with a "--with-class", that
makes it easy to say what dynamic resources you need included in the output.
regards
[ bryce ]
More information about the Java
mailing list