On x86_64-apple-darwin9/10, the PR16923 libjava testcase, when linked to the proper libiconv, fails with... Assertion failed: (class_id), function main, file /sw/src/fink.build/gcc44-4.4.2-1000/gcc-4.4.2/libjava/testsuite/libjava.jni/invocation/PR16923.c, line 35. Abort A build of gcc-4.4.2 with the libgcc built with -O0 shows a backtrace of this failure as... #0 _Jv_AllocPtrFreeObj [inlined] () at java-gc.h:55 #1 _Jv_AllocString (len=Cannot access memory at address 0xf ) at ../../../gcc-4.4.2/libjava/prims.cc:627 Cannot access memory at address 0xf
Created attachment 19883 [details] gdb walk for PR16923 failure
When I run it by hand, I get: $ /Users/mrs/net/gcc-java/gcc/xgcc -B/Users/mrs/net/gcc-java/gcc/ /Users/mrs/net/gcc/libjava/testsuite/libjava.jni/invocation/PR16923.c -bind_at_load -multiply_defined suppress -I. -I.. -I/Users/mrs/net/gcc/libjava/testsuite/libjava.jni -I/Users/mrs/net/gcc/libjava/testsuite/../include -I/Users/mrs/net/gcc/libjava/testsuite/../classpath/include -fdollars-in-identifiers -L/Users/mrs/net/gcc-java/x86_64-apple-darwin10/./libjava/.libs -ljvm -shared-libgcc -ldl -lgcj -L/opt/local/lib -liconv -lm -o PR16923 $ export CLASSPATH=~/net/gcc/libjava/testsuite/libjava.jni/invocation/PR16923.jar $ DYLD_LIBRARY_PATH=../.libs:../../libgcc:/opt/local/lib ./PR16923 optionReceived on x86_64-apple-darwin10 so this would be just a simple matter of ensuring the setting of DYLD_LIBRARY_PATH, CLASSPATH and compiling with -L/opt/local/lib. I suspect DYLD_LIBRARY_PATH and CLASSPATH are already correct. I'm hoping you can confirm this incantation works for you. I've filed PR43839 that covers getting -L added, which I hope resolves this issue.
I've been able to confirm that with the hack patch in PR43839, this testcase works on x86_64-apple-darwin10. *** This bug has been marked as a duplicate of 43839 ***
Mike, The suggestion in Comment 2 works fine with my gcc trunk build on x86_64-apple-darwin10 (assuming one fixes the-liconv linkage manually)... bash-3.2# /sw/src/fink.build/gcc46-4.5.999-20100418/darwin_objdir/gcc/xgcc -B/sw/src/fink.build/gcc46-4.5.999-20100418/darwin_objdir/gcc/ /sw/src/fink.build/gcc46-4.5.999-20100418/gcc-4.6-20100418/libjava/testsuite/libjava.jni/invocation/PR16923.c -bind_at_load -multiply_defined suppress -I. -I.. -I/sw/src/fink.build/gcc46-4.5.999-20100418/gcc-4.6-20100418/libjava/testsuite/libjava.jni -I/sw/src/fink.build/gcc46-4.5.999-20100418/gcc-4.6-20100418/libjava/testsuite/../include -I/sw/src/fink.build/gcc46-4.5.999-20100418/gcc-4.6-20100418/libjava/testsuite/../classpath/include -fdollars-in-identifiers -L/sw/src/fink.build/gcc46-4.5.999-20100418/darwin_objdir/x86_64-apple-darwin10.3.0/./libjava/.libs -ljvm -shared-libgcc -lgcj -L/sw/lib -liconv -lm -o PR16923 bash-3.2# export CLASSPATH=/sw/src/fink.build/gcc46-4.5.999-20100418/gcc-4.6-20100418/libjava/testsuite/libjava.jni/invocation/PR16923.jar bash-3.2# DYLD_LIBRARY_PATH=../.libs:../../libgcc:/opt/local/lib ./PR16923 optionReceived