2017-05-20 1 views
1

JNI를 사용하여 간단한 hello world 응용 프로그램을 만들었습니다. 64 비트 용 dll도 만들어 지지만 모든 것을 실행할 수 있습니다.Cygwin 컴파일 오류 문제가있는 프레임 : # C [cygwin1.dll + 0xd6d47] JNI 사용

# 
# A fatal error has been detected by the Java Runtime Environment: 
# 
# EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x0000000180116d47, pid=2140, tid=0x0000000000001710 
# 
# JRE version: Java(TM) SE Runtime Environment (8.0_131-b11) (build 1.8.0_131-b11) 
# Java VM: Java HotSpot(TM) 64-Bit Server VM (25.131-b11 mixed mode windows-amd64 compressed oops) 
# Problematic frame: 
# C [cygwin1.dll+0xd6d47] 
# 
# Failed to write core dump. Minidumps are not enabled by default on client versions of Windows 
# 
# If you would like to submit a bug report, please visit: 
# http://bugreport.java.com/bugreport/crash.jsp 
# The crash happened outside the Java Virtual Machine in native code. 
# See problematic frame for where to report the bug. 
# 

--------------- T H R E A D --------------- 

Current thread (0x0000000002bd0800): JavaThread "main" [_thread_in_native, id=5904, stack(0x0000000002a10000,0x0000000002b10000)] 

siginfo: ExceptionCode=0xc0000005, writing address 0x0000000000000070 

Registers: 
RAX=0x0000000000000070, RBX=0x0000000017270278, RCX=0x00000004344a3030, RDX=0x0000000002b0f4f8 
RSP=0x0000000002b0f430, RBP=0x0000000002b0f460, RSI=0x0000000020000021, RDI=0x00000000ffffffff 
R8 =0x0000000000000004, R9 =0x0000000001217f70, R10=0x0000000002b10000, R11=0x00000004344a10ac 
R12=0x0000000000000000, R13=0x0000000017270278, R14=0x0000000002b0f4f8, R15=0x0000000002bd0800 
RIP=0x0000000180116d47, EFLAGS=0x0000000000010206 

Top of Stack: (sp=0x0000000002b0f430) 
0x0000000002b0f430: 000000018018c780 0000000180116d5b 
0x0000000002b0f440: 0000000002b0f700 0000000002bd0800 
0x0000000002b0f450: 0000000017270278 0000000020000021 
0x0000000002b0f460: 0000000002b0f4d8 0000000002ce7f74 
0x0000000002b0f470: 0000000002bd09f8 0000000002b0f4f8 
0x0000000002b0f480: 0000000020000021 0000000002bd0800 
0x0000000002b0f490: 0000000002ce7ca2 0000000002b0f498 
0x0000000002b0f4a0: 0000000017270278 0000000002b0f4f8 
0x0000000002b0f4b0: 0000000017270410 0000000000000000 
0x0000000002b0f4c0: 0000000017270278 0000000000000000 
0x0000000002b0f4d0: 0000000002b0f4f8 0000000002b0f540 
0x0000000002b0f4e0: 0000000002cd835d 0000000000000000 
0x0000000002b0f4f0: 0000000002ce19d8 00000000d5e6e2f0 
0x0000000002b0f500: 0000000002b0f500 0000000017270317 
0x0000000002b0f510: 0000000002b0f550 0000000017270410 
0x0000000002b0f520: 0000000000000000 0000000017270320 

Instructions: (pc=0x0000000180116d47) 
0x0000000180116d27: 04 f3 90 eb e3 48 c7 c0 08 00 00 00 49 0f c1 82 
0x0000000180116d37: 50 e4 ff ff 4c 8d 1d 19 00 00 00 4c 87 5c 24 08 
0x0000000180116d47: 4c 89 18 41 ff 82 44 e4 ff ff 41 ff 8a 4c e4 ff 
0x0000000180116d57: ff 58 ff e0 65 4c 8b 14 25 08 00 00 00 41 bb 01 


Register to memory mapping: 

RAX=0x0000000000000070 is an unknown value 
RBX={method} {0x0000000017270280} 'print' '()V' in 'javatoc' 
RCX=0x00000004344a3030 is an unknown value 
RDX=0x0000000002b0f4f8 is pointing into the stack for thread: 0x0000000002bd0800 
RSP=0x0000000002b0f430 is pointing into the stack for thread: 0x0000000002bd0800 
RBP=0x0000000002b0f460 is pointing into the stack for thread: 0x0000000002bd0800 
RSI=0x0000000020000021 is an unknown value 
RDI=0x00000000ffffffff is an unallocated location in the heap 
R8 =0x0000000000000004 is an unknown value 
R9 =0x0000000001217f70 is an unknown value 
R10=0x0000000002b10000 is pointing into the stack for thread: 0x0000000002bd0800 
R11=0x00000004344a10ac is an unknown value 
R12=0x0000000000000000 is an unknown value 
R13={method} {0x0000000017270280} 'print' '()V' in 'javatoc' 
R14=0x0000000002b0f4f8 is pointing into the stack for thread: 0x0000000002bd0800 
R15=0x0000000002bd0800 is a thread 


Stack: [0x0000000002a10000,0x0000000002b10000], sp=0x0000000002b0f430, free space=1021k 
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code) 
C [cygwin1.dll+0xd6d47] 
C [cygwin1.dll+0x14c77f] 

Java frames: (J=compiled Java code, j=interpreted, Vv=VM code) 
j javatoc.print()V+0 
j javatoc.main([Ljava/lang/String;)V+7 
v ~StubRoutines::call_stub 

--------------- P R O C E S S --------------- 

Java Threads: (=> current thread) 
    0x0000000019428800 JavaThread "Service Thread" daemon [_thread_blocked, id=1096, stack(0x0000000019800000,0x0000000019900000)] 
    0x000000001781f000 JavaThread "C1 CompilerThread2" daemon [_thread_blocked, id=4500, stack(0x0000000019300000,0x0000000019400000)] 
    0x000000001781a000 JavaThread "C2 CompilerThread1" daemon [_thread_blocked, id=5164, stack(0x0000000019200000,0x0000000019300000)] 
    0x0000000017816800 JavaThread "C2 CompilerThread0" daemon [_thread_blocked, id=3924, stack(0x0000000019100000,0x0000000019200000)] 
    0x0000000017815000 JavaThread "Attach Listener" daemon [_thread_blocked, id=1188, stack(0x0000000019000000,0x0000000019100000)] 
    0x0000000017812000 JavaThread "Signal Dispatcher" daemon [_thread_blocked, id=3188, stack(0x0000000018f00000,0x0000000019000000)] 
    0x0000000002cca800 JavaThread "Finalizer" daemon [_thread_blocked, id=3732, stack(0x0000000018a60000,0x0000000018b60000)] 
    0x0000000002cbf800 JavaThread "Reference Handler" daemon [_thread_blocked, id=192, stack(0x0000000018960000,0x0000000018a60000)] 
=>0x0000000002bd0800 JavaThread "main" [_thread_in_native, id=5904, stack(0x0000000002a10000,0x0000000002b10000)] 

Other Threads: 
    0x00000000177d8000 VMThread [stack: 0x0000000018860000,0x0000000018960000] [id=5348] 
    0x0000000019452800 WatcherThread [stack: 0x0000000019900000,0x0000000019a00000] [id=5728] 

VM state:not at safepoint (normal execution) 

VM Mutex/Monitor currently owned by a thread: None 

Heap: 
PSYoungGen  total 38400K, used 1331K [0x00000000d5e00000, 0x00000000d8880000, 0x0000000100000000) 
    eden space 33280K, 4% used [0x00000000d5e00000,0x00000000d5f4cce8,0x00000000d7e80000) 
    from space 5120K, 0% used [0x00000000d8380000,0x00000000d8380000,0x00000000d8880000) 
    to space 5120K, 0% used [0x00000000d7e80000,0x00000000d7e80000,0x00000000d8380000) 
ParOldGen  total 87552K, used 0K [0x0000000081a00000, 0x0000000086f80000, 0x00000000d5e00000) 
    object space 87552K, 0% used [0x0000000081a00000,0x0000000081a00000,0x0000000086f80000) 
Metaspace  used 2598K, capacity 4486K, committed 4864K, reserved 1056768K 
    class space used 283K, capacity 386K, committed 512K, reserved 1048576K 

Card table byte_map: [0x0000000012090000,0x0000000012490000] byte_map_base: 0x0000000011c83000 

Marking Bits: (ParMarkBitMap*) 0x0000000060a0c720 
Begin Bits: [0x0000000012b40000, 0x0000000014ad8000) 
End Bits: [0x0000000014ad8000, 0x0000000016a70000) 

Polling page: 0x0000000001040000 

CodeCache: size=245760Kb used=1106Kb max_used=1115Kb free=244653Kb 
bounds [0x0000000002cd0000, 0x0000000002f40000, 0x0000000011cd0000] 
total_blobs=257 nmethods=26 adapters=145 
compilation: enabled 

Compilation events (10 events): 
Event: 0.059 Thread 0x000000001781f000 21  3  java.io.WinNTFileSystem::isSlash (18 bytes) 
Event: 0.059 Thread 0x000000001781f000 nmethod 21 0x0000000002de2910 code [0x0000000002de2a60, 0x0000000002de2c50] 
Event: 0.059 Thread 0x000000001781f000 23  3  java.lang.AbstractStringBuilder::append (50 bytes) 
Event: 0.059 Thread 0x000000001781a000 24  4  java.lang.String::charAt (29 bytes) 
Event: 0.060 Thread 0x000000001781f000 nmethod 23 0x0000000002de2cd0 code [0x0000000002de2ea0, 0x0000000002de35f8] 
Event: 0.060 Thread 0x000000001781f000 25  3  java.lang.String::indexOf (7 bytes) 
Event: 0.060 Thread 0x000000001781f000 nmethod 25 0x0000000002de3910 code [0x0000000002de3a80, 0x0000000002de3c88] 
Event: 0.060 Thread 0x000000001781a000 nmethod 24 0x0000000002de69d0 code [0x0000000002de6b20, 0x0000000002de6bd8] 
Event: 0.063 Thread 0x000000001781f000 26  3  java.lang.StringBuilder::append (8 bytes) 
Event: 0.063 Thread 0x000000001781f000 nmethod 26 0x0000000002de5e50 code [0x0000000002de5fc0, 0x0000000002de6148] 

GC Heap History (0 events): 
No events 

Deoptimization events (0 events): 
No events 

Internal exceptions (2 events): 
Event: 0.023 Thread 0x0000000002bd0800 Exception <a 'java/lang/NoSuchMethodError': Method sun.misc.Unsafe.defineClass(Ljava/lang/String;[BII)Ljava/lang/Class; name or signature does not match> (0x00000000d5e07ca8) thrown at [C:\re\workspace\8-2-build-windows-amd64-cygwin\jdk8u131\8869\hotspot\ 
Event: 0.023 Thread 0x0000000002bd0800 Exception <a 'java/lang/NoSuchMethodError': Method sun.misc.Unsafe.prefetchRead(Ljava/lang/Object;J)V name or signature does not match> (0x00000000d5e07f90) thrown at [C:\re\workspace\8-2-build-windows-amd64-cygwin\jdk8u131\8869\hotspot\src\share\vm\prims 

Events (10 events): 
Event: 0.063 loading class java/security/BasicPermissionCollection 
Event: 0.063 loading class java/security/BasicPermissionCollection done 
Event: 0.063 loading class sun/launcher/LauncherHelper$FXHelper 
Event: 0.063 loading class sun/launcher/LauncherHelper$FXHelper done 
Event: 0.063 loading class java/lang/Class$MethodArray 
Event: 0.063 loading class java/lang/Class$MethodArray done 
Event: 0.064 loading class java/lang/Void 
Event: 0.064 loading class java/lang/Void done 
Event: 0.064 loading class java/lang/ClassLoaderHelper 
Event: 0.064 loading class java/lang/ClassLoaderHelper done 


Dynamic libraries: 
0x00007ff690580000 - 0x00007ff6905b7000  C:\Program Files\Java\jdk1.8.0_131\bin\java.exe 
0x00007ffc37930000 - 0x00007ffc37ada000  C:\WINDOWS\SYSTEM32\ntdll.dll 
0x00007ffc37230000 - 0x00007ffc3736a000  C:\WINDOWS\system32\KERNEL32.DLL 
0x00007ffc350a0000 - 0x00007ffc351af000  C:\WINDOWS\system32\KERNELBASE.dll 
0x00007ffc33620000 - 0x00007ffc336a8000  C:\WINDOWS\system32\apphelp.dll 
0x00007ffc1cea0000 - 0x00007ffc1ceef000  C:\WINDOWS\AppPatch\AppPatch64\AcGenral.DLL 
0x00007ffc35280000 - 0x00007ffc35327000  C:\WINDOWS\system32\msvcrt.dll 
0x00007ffc34a70000 - 0x00007ffc34a9b000  C:\WINDOWS\SYSTEM32\SspiCli.dll 
0x00007ffc376c0000 - 0x00007ffc37711000  C:\WINDOWS\system32\SHLWAPI.dll 
0x00007ffc37540000 - 0x00007ffc376b1000  C:\WINDOWS\system32\USER32.dll 
0x00007ffc35a90000 - 0x00007ffc35c08000  C:\WINDOWS\system32\ole32.dll 
0x00007ffc35e10000 - 0x00007ffc37227000  C:\WINDOWS\system32\SHELL32.dll 
0x00007ffc342b0000 - 0x00007ffc342ce000  C:\WINDOWS\SYSTEM32\USERENV.dll 
0x00007ffc351b0000 - 0x00007ffc35255000  C:\WINDOWS\system32\ADVAPI32.dll 
0x00007ffc2f320000 - 0x00007ffc2f33b000  C:\WINDOWS\SYSTEM32\MPR.dll 
0x00007ffc35760000 - 0x00007ffc35896000  C:\WINDOWS\system32\RPCRT4.dll 
0x00007ffc35db0000 - 0x00007ffc35e07000  C:\WINDOWS\SYSTEM32\sechost.dll 
0x00007ffc35520000 - 0x00007ffc356f6000  C:\WINDOWS\SYSTEM32\combase.dll 
0x00007ffc37370000 - 0x00007ffc374b5000  C:\WINDOWS\system32\GDI32.dll 
0x00007ffc34ca0000 - 0x00007ffc34cb4000  C:\WINDOWS\SYSTEM32\profapi.dll 
0x00007ffc33140000 - 0x00007ffc331df000  C:\WINDOWS\SYSTEM32\SHCORE.dll 
0x00007ffc378e0000 - 0x00007ffc37914000  C:\WINDOWS\system32\IMM32.DLL 
0x00007ffc35950000 - 0x00007ffc35a89000  C:\WINDOWS\system32\MSCTF.dll 
0x00007ffc32350000 - 0x00007ffc325aa000  C:\WINDOWS\WinSxS\amd64_microsoft.windows.common-controls_6595b64144ccf1df_6.0.9600.17031_none_6242a4b3ecbb55a1\COMCTL32.dll 
0x0000000060a90000 - 0x0000000060b62000  C:\Program Files\Java\jdk1.8.0_131\jre\bin\msvcr100.dll 
0x00000000601f0000 - 0x0000000060a8c000  C:\Program Files\Java\jdk1.8.0_131\jre\bin\server\jvm.dll 
0x00007ffc32070000 - 0x00007ffc32079000  C:\WINDOWS\SYSTEM32\WSOCK32.dll 
0x00007ffc22da0000 - 0x00007ffc22dbf000  C:\WINDOWS\SYSTEM32\WINMM.dll 
0x00007ffc2e7c0000 - 0x00007ffc2e7ca000  C:\WINDOWS\SYSTEM32\VERSION.dll 
0x00007ffc374d0000 - 0x00007ffc374d7000  C:\WINDOWS\system32\PSAPI.DLL 
0x00007ffc35700000 - 0x00007ffc35758000  C:\WINDOWS\system32\WS2_32.dll 
0x00007ffc22d70000 - 0x00007ffc22d9a000  C:\WINDOWS\SYSTEM32\WINMMBASE.dll 
0x00007ffc35330000 - 0x00007ffc35339000  C:\WINDOWS\system32\NSI.dll 
0x00007ffc34d70000 - 0x00007ffc34dba000  C:\WINDOWS\SYSTEM32\cfgmgr32.dll 
0x00007ffc33b30000 - 0x00007ffc33b56000  C:\WINDOWS\SYSTEM32\DEVOBJ.dll 
0x00000000601e0000 - 0x00000000601ef000  C:\Program Files\Java\jdk1.8.0_131\jre\bin\verify.dll 
0x00000000601b0000 - 0x00000000601d9000  C:\Program Files\Java\jdk1.8.0_131\jre\bin\java.dll 
0x0000000060190000 - 0x00000000601a6000  C:\Program Files\Java\jdk1.8.0_131\jre\bin\zip.dll 
0x00000004344a0000 - 0x00000004344b8000  C:\Program Files\Java\jdk1.8.0_131\bin\javatoc.dll 
0x0000000180040000 - 0x0000000180610000  C:\cygwin64\bin\cygwin1.dll 
0x00007ffc0b5a0000 - 0x00007ffc0b728000  C:\WINDOWS\SYSTEM32\dbghelp.dll 

VM Arguments: 
java_command: javatoc 
java_class_path (initial): . 
Launcher Type: SUN_STANDARD 

Environment Variables: 
JAVA_HOME=C:\Program Files\Java\jdk1.8.0_131\bin; 
PATH=C:\ProgramData\Oracle\Java\javapath;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Windows Kits\8.1\Windows Performance Toolkit\;C:\Program Files\Microsoft SQL Server\110\Tools\Binn\;C:\Program Files\Microsoft SQL Server\120\DTS\Binn\;C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\110\Tools\Binn\;C:\Program Files (x86)\Microsoft SQL Server\120\Tools\Binn\;C:\Program Files\Microsoft SQL Server\120\Tools\Binn\;C:\Program Files (x86)\Microsoft SQL Server\120\Tools\Binn\ManagementStudio\;C:\Program Files (x86)\Microsoft SQL Server\120\DTS\Binn\;C:\Program Files\nodejs\;C:\Program Files\Java\jre7\bin;C:\swigwin-3.0.12;C:\Program Files\Java\jdk1.8.0_131\bin;;C:\Program Files\Java\jdk1.8.0_131\lib;C:\Program Files\Java\jdk1.8.0_131\include\win32;C:\Program Files\Java\jdk1.8.0_131\include;;C:\Python27;;C:\Program Files\Java\jdk1.8.0_131\bin;C:\cygwin64\bin;C:\Users\User\AppData\Roaming\npm;C:\Users\User\AppData\Local\atom\bin 
USERNAME=User 
OS=Windows_NT 
PROCESSOR_IDENTIFIER=Intel64 Family 6 Model 58 Stepping 9, GenuineIntel 



--------------- S Y S T E M --------------- 

OS: Windows 8.1 , 64 bit Build 9600 (6.3.9600.17056) 

CPU:total 4 (initial active 4) (4 cores per cpu, 1 threads per core) family 6 model 58 stepping 9, cmov, cx8, fxsr, mmx, sse, sse2, sse3, ssse3, sse4.1, sse4.2, popcnt, avx, aes, clmul, erms, tsc, tscinvbit, tscinv 

Memory: 4k page, physical 8279416k(5777792k free), swap 9655672k(6364908k free) 

vm_info: Java HotSpot(TM) 64-Bit Server VM (25.131-b11) for windows-amd64 JRE (1.8.0_131-b11), built on Mar 15 2017 01:23:53 by "java_re" with MS VC++ 10.0 (VS2010) 

time: Sat May 20 16:25:17 2017 
elapsed time: 0 seconds (0d 0h 0m 0s) 

내가 Cygwin에서 64 비트 버전을 사용하지만, 정확한 오류가 무엇인지 얻을 수 없습니다 해요 : 여기

# 
# A fatal error has been detected by the Java Runtime Environment: 
# 
# EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x0000000180116d47, pid=2140, tid=0x0000000000001710 
# 
# JRE version: Java(TM) SE Runtime Environment (8.0_131-b11) (build 1.8.0_131-b11) 
# Java VM: Java HotSpot(TM) 64-Bit Server VM (25.131-b11 mixed mode windows-amd64 compressed oops) 
# Problematic frame: 
# C [cygwin1.dll+0xd6d47] 
# 
# Failed to write core dump. Minidumps are not enabled by default on client versions of Windows 
# 
# If you would like to submit a bug report, please visit: 
# http://bugreport.java.com/bugreport/crash.jsp 
# The crash happened outside the Java Virtual Machine in native code. 
# See problematic frame for where to report the bug. 
# 

전체 오류 보고서입니다 : 다음과 같은 오류가 표시됩니다.

javac javatoc.java 

javah -jni javatoc 

gcc -I"C:/Program Files/Java/jdk1.8.0_131/include" -I"C:/Program Files/Java/jdk1.8.0_131/include/win32" -Wall -D_JNI_IMPLEMENTATION_ -Wl,--kill-at -shared javatoc.c -o javatoc.dll 

사람이 좀 도와 주시겠습니까 : 은 다음 실행을 위해 사용되는 javatoc.c 파일 코드

#include "jni.h" 
#include <stdio.h> 

JNIEXPORT void JNICALL Java_javatoc_print 
    (JNIEnv *evn, jobject obj) 
    { 
    printf("Hello World"); 
    } 

명령어 javatoc.java 파일 코드 여기

import java.io.*; 
public class javatoc 
{ 
    public native void print(); 

    static{ 
     System.loadLibrary("javatoc"); 
    } 

    public static void main(String args[]) 
    { 
     new javatoc().print(); 
    } 
} 

입니다 이 오류에 대해 알려주십시오.

답변

0

Cygwin의 g++ - JNI 메커니즘과 충돌하여 충돌을 일으키는 cygwin1.dll에 대한 의존성을 유발하는 JNI를 얻을 수 없습니다. 하지만 /bin/x86_64-w64-mingw32-g++.exe을 사용하면 문제가 해결되었습니다.