static linking

Jeff Sturm jeff.sturm@appnet.com
Tue Dec 5 16:18:00 GMT 2000


I think it was Tom who said static linking might be broken now.  Turns out he's
right. :\

I see two problems:

1) libsupc++ doesn't get linked by gcj

This seems like an oversight.  Since libgcj.so is linked against libsupc++,
normal (shared) linking just happens to work.  I "fixed" it by adding supc++ to
libgcj.spec.  I'll see if I can cobble together a patch.

2) classes loaded dynamically (via Class.forName) don't get linked

I don't see any good solution.  I got around it by linking the following dummy
class into my executable, but YMMV:

class Dummy {
        java.security.cert.Certificate dummy1;
        gnu.gcj.protocol.file.Handler dummy2;
        gnu.gcj.protocol.http.Handler dummy3;
        gnu.gcj.protocol.jar.Handler dummy4;
}

BTW I haven't noticed any ICEs yet with today's compiler.  Nice work!

--
Jeff Sturm
jeff.sturm@commerceone.com


More information about the Java mailing list