[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: Problems building JIGS on msys/mingw
From: |
Nicola Pero |
Subject: |
RE: Problems building JIGS on msys/mingw |
Date: |
Wed, 24 Nov 2010 11:34:25 +0100 (CET) |
> 3. It fails to link due to undefined references:
>
> Creating library file: ./obj/libgnustep-java.dll.a
> obj/libgnustep-java.obj/NSJavaVirtualMachine.m.o: In function
> `+[NSJavaVirtualMachine startVirtualMachineWithClassPath:libraryPath:]':
> C:\GNUstep\home\tkack\modules\dev-libs\java\Source/NSJavaVirtualMachine.m:132:
> undefined reference to `_imp__JNI_CreateJavaVM@12'
> collect2: ld returned 1 exit status
> make[4]: *** [obj/libgnustep-java.dll.a] Error 1
>
> [...]
>
> I checked jni.h and the function is exported properly:
>
> _JNI_IMPORT_OR_EXPORT_ jint JNICALL
> JNI_CreateJavaVM(JavaVM **pvm, void **penv, void *args);
>
> _JNI_IMPORT_OR_EXPORT_ jint JNICALL
> JNI_GetCreatedJavaVMs(JavaVM **, jsize, jsize *);
>
> What am I missing? Any help regarding this would be most appreciated.
I haven't tried on a Windows box, but at a quick look, the problem seems to be
that the various -ljava -ljvm etc. are not used when linking.
IIRC on GNU/linux, that is not a problem: if libgnustep-java.so is loaded in a
running Java environment (the most common usage case, ie, using Objective-C
libraries from Java), these libraries would already be linked in. So,
even though JNI_CreateJavaVM() is referenced in libgnustep-java.so but never
defined, and no library defining it is actually explicitly linked in, it is
actually found at runtime because libgnustep-java.so is loaded in a running
virtual machine where JNI_CreateJavaVM() is already available in the executable.
If libgnustep-java.so is used in Objective-C to start a JVM from Objective-C,
then the libraries do need to be linked in; this would be done using the stuff
in the Makefiles/ directory, ie, sourcing GNUstep-Java.sh then including
jigs.make in the GNUmakefile. This is unusual, but should work.
In the case of Windows, IIRC all libraries need to be linked in at
compile/link-time, so
the above does not work. You may want to try using GNUstep-Java.sh and
jigs.make
to see if you can get all the libraries linked at compile time:
* go into java/Makefiles; type 'make install' to install jigs.make and
GNUstep-Java.sh
* source GNUstep-Java.sh
* add "include jigs.make" just before including library.make in
Source/GNUmakefile
* try compiling again.
That may work ... if it doesn't, please let me know what error messages you get,
but the most likely problem is that GNUstep-Java.sh is not finding/linking the
correct DLLs; you could try solving that by editing GNUstep-Java.sh to match
the
type and locations of your jni libraries. It may all work in the end or you
may
end up hitting a harder, Windows problem where the JVM libraries were compiled
with a different compiler / different compiler settings, export symbols in a
different way, and the linking will simply fail. :-(
What JVM are you using ?
Thanks