Mixing BC and CNI in the same executable

Stephen Kell srk31@srcf.ucam.org
Tue Jan 26 17:07:00 GMT 2010


> It's a combination of bugs. Firstly, there's a bug in libgcj when a
> needed class is not found in an executable: it causes a crash when
> trying to report the problem. Fixed thusly:

Thanks very much for this! My program does indeed now run as it's
supposed to (i.e. back to coding...).
> Thirdly, you aren't linking in inner classes. This works for me:
>> gcj -fno-eliminate-unused-debug-symbols
> -fno-eliminate-unused-debug-types -findirect-dispatch
> -fno-indirect-classes -fpic -g3
> --classpath=./java:./antlr-runtime-3.1.3.jar:: -Wall -Wl,-R.
> cake.o main.o parser/parser.a antlr-runtime.jar.so
> stringtemplate.jar.so -lstdc++ -o "cake" -Wl,-Map,map
> java/cake/TreewalkError.o java/cake/InternalError.o
> java/cake/CloneableTree.o
> java/cake/SemanticError.o ./parser/cake/cakeJavaParser\$DFA*.o ./parser/cake/cakeJavaLexer\$DFA*.o ./parser/cake/cakeJavaParser\$*_return.o 
>> It would be better to compile from .java -> .o, and then you would not
> have to worry about all the inner classes.

Aha... I had been stuffing all the .o files (including inner classes)
into parser.a, hoping it would be sufficient to link with that, but
clearly this was a bad plan. (I guess only symbols with link-time
references get linked... meanwhile --whole-archive fails because of
multiple definitions of others.)
Thanks again,
Stephen.


More information about the Java mailing list

AltStyle によって変換されたページ (->オリジナル) /