linking a .so with libgcj.a ?

Andrew Haley aph@redhat.com
Wed Dec 15 19:04:00 GMT 2004


Andi Vajda writes:
 > 
 > 
 > On Wed, 15 Dec 2004, Andrew Haley wrote:
 > 
 > > Basically.  But the capabilities of linkers varies widely between
 > > systems, even when the linkers are all variants of GNU ld.
 > >
 > > > Or did the person behind the Mingw tool chain
 > > > do something special ? If it is smart enough to produce something
 > > > that works on Windows, wouldn't the same apply on Linux ?
 > >
 > > Probably.  But to be sure I'd have to try it.
 > 
 > I'm willing to give it a try myself, is it enough to just force CCFLAGS to 
 > contain -fPIC when building libgcj.a ?

I think so.

 > > It may well be that your problem has nothing to do with PIC, but it's
 > > worth fixing that first.  As has been pointed out in this thread,
 > > there are other potential problems.
 > 
 > Yes, dynamically loading classes was mentionned. I don't do that, neither does 
 > the Java Lucene codebase which I'm compiling in.

OK.

 > Libgcj may do this too but I haven't hit a class load error on Windows yet 
 > where the python extension DLL is statically linked with libgcj.a and about 
 > 6 Mb in size. The project is a year old now, so I guess/hope dynamically 
 > loading classes is not a required feature in this case.

Probably not, no.  What you're trying to do should work on all systems
which gcj supports with shared libraries.  I don't know why you are
getting the segfault: to know for sure I'd have to attach gdb.

Andrew.



More information about the Java mailing list