fix PR16923.c compilation on Darwin

Geoffrey Keating gkeating@apple.com
Fri Sep 1 19:40:00 GMT 2006


The regression tester was seeing

FAIL: PR16923.c compilation

due to

/usr/bin/ld: warning can't open dynamic library:
/Users/regress/tbox/objs/lib/libgcj.8.dylib referenced from:
../.libs/libjvm.dylib (checking for undefined symbols may be affected)
(No such file or directory, errno = 2)

and although this is just a warning, it does cause the build to fail.

Indeed there is no such library, because it hasn't been installed yet;
and as the comment above the line I changed says, we could use
-dylib_file to tell the linker where the library is at the moment but
it's much easier to just use -lgcj and have the linker search for it
in the -L options.

Tested by bootstrap & libjava dejagnu on powerpc-darwin8.

-- 
- Geoffrey Keating <geoffk@apple.com>

===File ~/patches/libjava-testsuite-jniexplgcj.patch========
2006-09-01  Geoffrey Keating  <geoffk@apple.com>

	* testsuite/libjava.jni/jni.exp (gcj_jni_invocation_test_one):
	Pass -lgcj to linker for C++ files on Darwin.

Index: libjava/testsuite/libjava.jni/jni.exp
===================================================================
--- libjava/testsuite/libjava.jni/jni.exp	(revision 116606)
+++ libjava/testsuite/libjava.jni/jni.exp	(working copy)
@@ -257,8 +257,9 @@
   # find the libgcc used by libffi.dylib.  We could pass the
   # -dylib_file option, but that's complicated, and it's much easier
   # to just make the linker find libgcc using -L options.
+  # Similar logic applies to libgcj.
   if { [istarget "*-*-darwin*"] } {
-      set cxxflags "-L../.libs -shared-libgcc -ljvm -liconv"
+      set cxxflags "-L../.libs -shared-libgcc -ljvm -lgcj -liconv"
   } else {
       global LIBJAVA
       if [info exists LIBJAVA] {
============================================================



More information about the Gcc-patches mailing list