gij with gcc 2.95.2 (was: Re: internal error - SP mismatch)

Matt Welsh mdw@cs.berkeley.edu
Fri Mar 24 15:01:00 GMT 2000


> But now, I'm embarrased to say, I can't seem to figure out how to use the dar
> ned
> thing:
> 
> [jcej@node04 T3]$ gcj -shared -c -o HelloWorld.so HelloWorld.java

This is a problem with gcc and gcj. Use of "-c" actually causes gcj
to build a STATIC object file, even though you used "-shared". Try 
removing the "-c" and see if it works.

Arguably this is a bug, but it appears in much older versions of gcc
as well, so I don't know what the right fix is.

Also, I think you need to have the directory where 'HelloWorld.so' 
is located on your LD_LIBRARY_PATH. This is silly, of course, and we had
some discussion earlier on what the right mechanism should be.

I just tried this myself and it segfaults for some reason. 
Your example above will work if you just do:
	gcj -C Hello.java
	gij Hello

But, in this case gij will actually be interpreting the bytecodes for
Hello.class rather than loading the compiled Hello.so shared object. 
gij *does* support loading shared objects, but I don't know why it's
crashing here.

Also be sure you compiled libgcj with the --enable-interpreter=yes option
to "configure".

Matt 



More information about the Java mailing list