[gdal-dev] building Java bindings on MinGW
Glenn Burkhardt
gbburkhardt at verizon.net
Sat Dec 11 18:20:27 EST 2010
I've been trying to build the Java bindings for GDAL 1.7.3 on MinGW. I
have a set of DLL's, and the 'gdal.jar' file, but the basic test is
failing in the GeneralCmdLineProcessor JNI code. I've traced it down to
this line in gdal_wrap.cpp:
for (jobject keys = jenv->CallObjectMethod(jarg1, elements); //
line 18529 in my copy
I try running:
java -cp "gdal.jar;build/apps" gdalinfo
and the code suffers an access violation:
# EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x6d8eea78, pid=672,
tid=956
I broke the expression "jobject keys = jenv->CallObjectMethod(jarg1,
elements)" out onto a separate line, and bracketed it with print
statements.
The JNI code itself is valid. I build a test application that passes
the argument list to a native method as a vector, and there's no problem
accessing any of the members of the vector, whether the vector is empty
or not.
Any ideas?? I just loaded a fresh copy of MinGW today, built 'swig'
Version 2.0.1, and I'm using g++ 4.5.0. I tried this on a different
machine yesterday with the g++ 3.4.5 compiler, with identical results.
Here's the java error log:
#
# A fatal error has been detected by the Java Runtime Environment:
#
# EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x6d8eea78, pid=672,
tid=956
#
# JRE version: 6.0_23-b05
# Java VM: Java HotSpot(TM) Client VM (19.0-b09 mixed mode, sharing
windows-x86 )
# Problematic frame:
# V [jvm.dll+0xfea78]
#
# If you would like to submit a bug report, please visit:
# http://java.sun.com/webapps/bugreport/crash.jsp
#
--------------- T H R E A D ---------------
Current thread (0x007b9000): JavaThread "main" [_thread_in_vm, id=956,
stack(0x00430000,0x00480000)]
siginfo: ExceptionCode=0xc0000005, reading address 0x00000024
Registers:
EAX=0x00000000, EBX=0x007b9118, ECX=0x38f88d50, EDX=0x00000000
ESP=0x0047fae8, EBP=0x0047fb30, ESI=0x007b9000, EDI=0x0068d3ac
EIP=0x6d8eea78, EFLAGS=0x00010246
Register to memory mapping:
EAX=0x00000000
0x00000000 is pointing to unknown location
EBX=0x007b9118
0x007b9118 is pointing to unknown location
ECX=0x38f88d50
{instance class}
- klass: {other class}
EDX=0x00000000
0x00000000 is pointing to unknown location
ESP=0x0047fae8
0x0047fae8 is pointing into the stack for thread: 0x007b9000
"main" prio=6 tid=0x007b9000 nid=0x3bc runnable [0x0047f000]
java.lang.Thread.State: RUNNABLE
EBP=0x0047fb30
0x0047fb30 is pointing into the stack for thread: 0x007b9000
"main" prio=6 tid=0x007b9000 nid=0x3bc runnable [0x0047f000]
java.lang.Thread.State: RUNNABLE
ESI=0x007b9000
"main" prio=6 tid=0x007b9000 nid=0x3bc runnable [0x0047f000]
java.lang.Thread.State: RUNNABLE
EDI=0x0068d3ac
0x0068d3ac is pointing to unknown location
Top of Stack: (sp=0x0047fae8)
0x0047fae8: 0068d3a8 00682490 007b9118 6d9f8ef0
0x0047faf8: 6d9fb300 ffffffff 0047fb10 6d7f10e0
0x0047fb08: 007b9000 0047fd7c 0000000c 6d8f68c9
0x0047fb18: 007b9000 00000006 007b9000 00000000
0x0047fb28: 0068d3ac 007b9118 0047fb50 6e99c865
0x0047fb38: 007b9118 007b9118 0068d3ac 0047fb64
0x0047fb48: 00682494 0068d3ac 0047fb58 6e99b36a
0x0047fb58: 007b9118 007b9118 0068d3ac 0047fb98
Instructions: (pc=0x6d8eea78)
0x6d8eea68: 45 e0 0c 00 00 00 8b 48 08 0f b7 51 2a 8b 40 0c
0x6d8eea78: 8b 4c 90 24 51 56 8d 4d c4 e8 aa a4 0b 00 8b 55
Stack: [0x00430000,0x00480000], sp=0x0047fae8, free space=318k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code,
C=native code)
V [jvm.dll+0xfea78]
C [gdaljni.dll+0x1c865]
C [gdaljni.dll+0x1b36a]
Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)
j
org.gdal.gdal.gdalJNI.GeneralCmdLineProcessor__SWIG_0(Ljava/util/Vector;I)Ljava/util/Vector;+0
j
org.gdal.gdal.gdal.GeneralCmdLineProcessor(Ljava/util/Vector;I)Ljava/util/Vector;+2
j
org.gdal.gdal.gdal.GeneralCmdLineProcessor([Ljava/lang/String;I)[Ljava/lang/String;+31
j
org.gdal.gdal.gdal.GeneralCmdLineProcessor([Ljava/lang/String;)[Ljava/lang/String;+2
j gdalinfo.main([Ljava/lang/String;)V+52
v ~StubRoutines::call_stub
--------------- P R O C E S S ---------------
Java Threads: ( => current thread )
0x006a2c00 JavaThread "Low Memory Detector" daemon [_thread_blocked,
id=792, stack(0x04930000,0x04980000)]
0x0069c800 JavaThread "CompilerThread0" daemon [_thread_blocked,
id=2704, stack(0x048a0000,0x048f0000)]
0x00699800 JavaThread "Attach Listener" daemon [_thread_blocked,
id=3944, stack(0x04810000,0x04860000)]
0x00695c00 JavaThread "Signal Dispatcher" daemon [_thread_blocked,
id=3292, stack(0x04780000,0x047d0000)]
0x0068f800 JavaThread "Finalizer" daemon [_thread_blocked, id=1268,
stack(0x046f0000,0x04740000)]
0x0068d800 JavaThread "Reference Handler" daemon [_thread_blocked,
id=4044, stack(0x04660000,0x046b0000)]
=>0x007b9000 JavaThread "main" [_thread_in_vm, id=956,
stack(0x00430000,0x00480000)]
Other Threads:
0x0068c400 VMThread [stack: 0x045d0000,0x04620000] [id=1380]
0x006aec00 WatcherThread [stack: 0x049c0000,0x04a10000] [id=1604]
VM state:not at safepoint (normal execution)
VM Mutex/Monitor currently owned by a thread: None
Heap
def new generation total 4928K, used 434K [0x24540000, 0x24a90000,
0x29a90000)
eden space 4416K, 9% used [0x24540000, 0x245ac860, 0x24990000)
from space 512K, 0% used [0x24990000, 0x24990000, 0x24a10000)
to space 512K, 0% used [0x24a10000, 0x24a10000, 0x24a90000)
tenured generation total 10944K, used 0K [0x29a90000, 0x2a540000,
0x34540000)
the space 10944K, 0% used [0x29a90000, 0x29a90000, 0x29a90200,
0x2a540000)
compacting perm gen total 12288K, used 174K [0x34540000, 0x35140000,
0x38540000)
the space 12288K, 1% used [0x34540000, 0x3456ba88, 0x3456bc00,
0x35140000)
ro space 10240K, 51% used [0x38540000, 0x38a6bd20, 0x38a6be00,
0x38f40000)
rw space 12288K, 54% used [0x38f40000, 0x395d7d58, 0x395d7e00,
0x39b40000)
Dynamic libraries:
0x00400000 - 0x00424000 c:\Windows\SysWOW64\java.exe
0x77de0000 - 0x77f60000 C:\Windows\SysWOW64\ntdll.dll
0x76420000 - 0x76520000 C:\Windows\syswow64\kernel32.dll
0x75c50000 - 0x75c96000 C:\Windows\syswow64\KERNELBASE.dll
0x76010000 - 0x760b0000 C:\Windows\syswow64\ADVAPI32.dll
0x760d0000 - 0x7617c000 C:\Windows\syswow64\msvcrt.dll
0x766f0000 - 0x76709000 C:\Windows\SysWOW64\sechost.dll
0x76710000 - 0x76800000 C:\Windows\syswow64\RPCRT4.dll
0x75950000 - 0x759b0000 C:\Windows\syswow64\SspiCli.dll
0x75940000 - 0x7594c000 C:\Windows\syswow64\CRYPTBASE.dll
0x7c340000 - 0x7c396000 C:\Program Files (x86)\Java\jre6\bin\msvcr71.dll
0x6d7f0000 - 0x6da9c000 C:\Program Files
(x86)\Java\jre6\bin\client\jvm.dll
0x759b0000 - 0x75ab0000 C:\Windows\syswow64\USER32.dll
0x76180000 - 0x76210000 C:\Windows\syswow64\GDI32.dll
0x76000000 - 0x7600a000 C:\Windows\syswow64\LPK.dll
0x76520000 - 0x765bd000 C:\Windows\syswow64\USP10.dll
0x735c0000 - 0x735f2000 c:\Windows\SysWOW64\WINMM.dll
0x765c0000 - 0x76620000 C:\Windows\system32\IMM32.DLL
0x76620000 - 0x766ec000 C:\Windows\syswow64\MSCTF.dll
0x73f20000 - 0x73f6b000 C:\Windows\system32\apphelp.dll
0x6d7a0000 - 0x6d7ac000 C:\Program Files (x86)\Java\jre6\bin\verify.dll
0x6d320000 - 0x6d33f000 C:\Program Files (x86)\Java\jre6\bin\java.dll
0x6d280000 - 0x6d288000 C:\Program Files (x86)\Java\jre6\bin\hpi.dll
0x77db0000 - 0x77db5000 C:\Windows\syswow64\PSAPI.DLL
0x6d7e0000 - 0x6d7ef000 C:\Program Files (x86)\Java\jre6\bin\zip.dll
0x6e980000 - 0x6ea4e000
C:\MinGW\msys\1.0\home\Glenn\gdal-1.7.3\swig\java\gdaljni.dll
0x6fc40000 - 0x6fd1e000 C:\MinGW\bin\libstdc++-6.dll
0x6e940000 - 0x6e961000 C:\MinGW\bin\libgcc_s_dw2-1.dll
0x04c10000 - 0x06740000
C:\MinGW\msys\1.0\home\Glenn\gdal-1.7.3\swig\java\libgdal-1.dll
VM Arguments:
java_command: gdalinfo
Launcher Type: SUN_STANDARD
Environment Variables:
PATH=.;C:\MinGW\msys\1.0\local\bin;C:\MinGW\bin;C:\MinGW\msys\1.0\bin;c:\msys\1.0\bin;C:\MinGW\bin;c:\Windows\system32;c:\Windows;c:\Windows\System32\Wbem;c:\Windows\System32\WindowsPowerShell\v1.0\;c:\Program
Files (x86)\emacs-23.2\bin;c:\Program Files (x86)\Java\jdk1.6.0_23\bin
USERNAME=Glenn
OS=Windows_NT
PROCESSOR_IDENTIFIER=AMD64 Family 16 Model 4 Stepping 3, AuthenticAMD
--------------- S Y S T E M ---------------
OS: Windows 7 Build 7600
CPU:total 4 (4 cores per cpu, 1 threads per core) family 16 model 4
stepping 3, cmov, cx8, fxsr, mmx, sse, sse2, sse3, popcnt, mmxext,
3dnow, 3dnowext, lzcnt, sse4a
Memory: 4k page, physical 3930292k(2555848k free), swap
7858684k(6328200k free)
vm_info: Java HotSpot(TM) Client VM (19.0-b09) for windows-x86 JRE
(1.6.0_23-b05), built on Nov 12 2010 15:00:43 by "java_re" with MS VC++
7.1 (VS2003)
time: Sat Dec 11 17:51:55 2010
elapsed time: 0 seconds
More information about the gdal-dev
mailing list