hi!
I'm trying to build my own libnetsnmpj.so lib, working with makefiles I get a libnetsnmpj.so file, but when I try to run the examples from java, the JVM crashes, which make me think that maybe I'm compliling in a bad way....
I got some other libnetsnmpj.so files and they throws warnings, my file crashes!!!
here is the stact trace:
Stack: [0xbfa3b000,0xbfc3b000), sp=0xbfc34f14, free space=2023k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
C [libc.so.6+0x69e53] index+0x63
C [libnetsnmp.so.5+0x5a5bc] init_snmp_enum+0x7c
C [libnetsnmp.so.5+0x2d2fb] init_snmp+0x31e
C [libnetsnmpj.so+0xb2a5] JNI_OnLoad+0xfd
C [libjava.so+0xa79d] Java_java_lang_ClassLoader_00024NativeLibrary_load+0x1fd
j java.lang.ClassLoader$NativeLibrary.load(Ljava/lang/String
V+0
j java.lang.ClassLoader.loadLibrary0(Ljava/lang/Class;Ljava/io/File
Z+300
j java.lang.ClassLoader.loadLibrary(Ljava/lang/Class;Ljava/lang/String;Z)V+268
j java.lang.Runtime.loadLibrary0(Ljava/lang/Class;Ljava/lang/String
V+54
j java.lang.System.loadLibrary(Ljava/lang/String
V+7
j org.netsnmp.Warnings.loadNativeLibraryOrProvideWarning(Ljava/lang/String
V+1
j org.netsnmp.NetSNMPSession.<clinit>()V+44
v ~StubRoutines::call_stub
V [libjvm.so+0x174fec]
V [libjvm.so+0x2821f8]
V [libjvm.so+0x174e1f]
V [libjvm.so+0x1532b1]
V [libjvm.so+0x151dbf]
V [libjvm.so+0x150e67]
V [libjvm.so+0x166b16]
j org.netsnmp.examples.GetSysDescr.main([Ljava/lang/String
V+30
v ~StubRoutines::call_stub
V [libjvm.so+0x174fec]
V [libjvm.so+0x2821f8]
V [libjvm.so+0x174e1f]
V [libjvm.so+0x19f5c2]
V [libjvm.so+0x1907d2]
C [java+0x1803]
C [libc.so.6+0x14de6] __libc_start_main+0xc6
here is the compiling command:
g++ -g -shared -o linux-i386-dbg/libnetsnmpj.so -Xlinker -O -Xlinker 1 --startgroup linux-i386-dbg/NetSNMP.o linux-i386-dbg/nativeThread.o linux-i386-dbg/exception.o linux-i386-dbg/lock.o linux-i386-dbg/NetSNMPjClasses.o linux-i386-dbg/NetSNMPjSession_read.o linux-i386-dbg/NetSNMPjSession_send.o linux-i386-dbg/NetSNMPPDU.o linux-i386-dbg/NetSNMPjSession.o linux-i386-dbg/session_to_jobject.o linux-i386-dbg/agentX.o linux-i386-dbg/NetSNMPOID.o linux-i386-dbg/NetSNMPMIB.o \
-L/usr/lib -lnetsnmp -lcrypto -lrpm -lrpmio -lpopt -lz -lm -L/usr/lib/lib -lwrap -L/usr/lib -lnetsnmpagent -lnetsnmpmibs -lnetsnmphelpers -lnetsnmp -ldl -lcrypto -lrpm -lrpmio -lpopt -lz -lm -lsensors -L/usr/lib/lib -lwrap -lwrap -L/root/proyJava/JNISupport/linux-i386-dbg -ljnisupport -lpthread --endgroup
this did not show any errors, what could be wrong???
thanks.