This is the mail archive of the java@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Building shared objects with gcj on osx



I have a successful bootstrap build of 3.4.3 on os 10.2.8. When trying to build shared objects, I am receiving link errors:

bash-2.05a$ cat ./Test.java public class Test {

      public static void main (String [] argsv) {
              System.out.println ("Hello World");
      }

}
bash-2.05a$ gcj -o helloworld --main=Test Test.java
bash-2.05a$ ./helloworld
Hello World
bash-2.05a$ gcj -shared -o helloworld.so Test.java
/usr/bin/ld: Undefined symbols:
_main
___eprintf
collect2: ld returned 1 exit status
bash-2.05a$ The link error on "main" makes me suspicous - I presumed using -shared meant that no main was required?

I use both -shared -bundle and it seems to work for the python extension I'm building. I also used these flags at times:
-undefined suppress -flat_namespace -multiply_defined suppress


I am fully aware I may be missing something obvious, and welcome any (helpful :) critism on how to get this working.... is it possible that weirdness is happening as OSX's /usr/bin/ld is used?

There can be but so far I've been able to work around it.


I have seen many messages on problems building native SWT/SwingWT on OSX, which I am attempting - the Makefile in SwingWT for SWT uses the same flags I have (although also tries to link in various jnilibs, in error I think). This is what has led me to the problem of getting -shareds working on osx.... any ideas?

JNI libs built against the Apple JDK, ie with the Apple JDK jni.h, are not compatible with gcj's jni.h. Also, for what it's worth, the extension of JNI libs built with Apple's JDK are .jnilib and with gcj are .dylib. What that means I don't know but I've not been able to get libgcj's LoadLibrary API to work otherwise.


Andi..


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]