Error in C++ program called from Java using JNI. Getting SEGV_ACCERR

1

Having trouble calling C++ code from JNI. The code runs in normal C++, but seems to have errors when I try to call it from Java and I think I'm compiling/linking things incorrectly. Can anyone spot what is wrong?

I'm cross compiling using the arm-marvell-linux-gnueabi toolkit to run the code on Beaglebone Black.

This is my Makefile for the C++ code:

PORT = arm12
CFLAGS = -D__cplusplus -Wall -O
CPP=/opt/arm-marvell-linux-gnueabi/bin/arm-marvell-linux-gnueabi-g++ -fPIC
CC=/opt/arm-marvell-linux-gnueabi/bin/arm-marvell-linux-gnueabi-gcc
INCPATH = -I./ -I../include -I./ -I../include -I/usr/lib/jvm/java-7-openjdk-amd64/include/ -I/usr/lib/jvm/java-7-openjdk-amd64/include/linux
LIBS =  -L../lib/$(PORT)

OBJS=   FingerVerification.o

SRCS=   FingerVerification.cpp

FDU03_TARGET = ../bin/$(PORT)/sgfplibtest_fdu03
FDU04_TARGET = ../bin/$(PORT)/sgfplibtest_fdu04
FDU05_TARGET = ../bin/$(PORT)/sgfplibtest_fdu05

all : $(FDU05_TARGET) $(FDU04_TARGET) $(FDU03_TARGET)

$(FDU05_TARGET) : $(OBJS)
    $(CPP) /opt/arm-marvell-linux-gnueabi/arm-marvell-linux-gnueabi/libc/usr/lib/libusb.so -lpthread -lsgfpamx -lsgfdu05 -lsgfplib -o $@ $(OBJS) $(LIBS)

$(FDU04_TARGET) : $(OBJS)
    $(CPP) /opt/arm-marvell-linux-gnueabi/arm-marvell-linux-gnueabi/libc/usr/lib/libusb.so -lpthread -lsgfpamx -lsgfdu04 -lsgfplib -o $@ $(OBJS) $(LIBS)

$(FDU03_TARGET) : $(OBJS)
    $(CPP) /opt/arm-marvell-linux-gnueabi/arm-marvell-linux-gnueabi/libc/usr/lib/libusb.so  -lpthread -lsgfpamx -lsgfdu03 -lsgfplib -o $@ $(OBJS) $(LIBS)

.cc.o :
    $(CPP) $(FLAGS) $(INCPATH) -c $<

.c.o :
    $(CPP) $(FLAGS) $(INCPATH) -c $<

.cpp.o :
    $(CPP) $(FLAGS) $(INCPATH) -c $<

dep :
    gccmakedep $(INCPATH) $(SRCS)

clean :
    rm -rf *.raw *.min $(OBJS) $(TARGET) core
    rm -rf $(PORT)
    mkdir $(PORT)

This is how the compilation for the C++ looks like:

/opt/arm-marvell-linux-gnueabi/bin/arm-marvell-linux-gnueabi-g++ -fPIC  -I./ -I../include -I./ -I../include -I/usr/lib/jvm/java-7-openjdk-amd64/include/ -I/usr/lib/jvm/java-7-openjdk-amd64/include/linux -c FingerVerification.cpp
/opt/arm-marvell-linux-gnueabi/bin/arm-marvell-linux-gnueabi-g++ -fPIC /opt/arm-marvell-linux-gnueabi/arm-marvell-linux-gnueabi/libc/usr/lib/libusb.so -lpthread -lsgfpamx -lsgfdu05 -lsgfplib -o ../bin/arm12/sgfplibtest_fdu05 FingerVerification.o -L../lib/arm12
/opt/arm-marvell-linux-gnueabi/bin/arm-marvell-linux-gnueabi-g++ -fPIC /opt/arm-marvell-linux-gnueabi/arm-marvell-linux-gnueabi/libc/usr/lib/libusb.so -lpthread -lsgfpamx -lsgfdu04 -lsgfplib -o ../bin/arm12/sgfplibtest_fdu04 FingerVerification.o -L../lib/arm12
/opt/arm-marvell-linux-gnueabi/bin/arm-marvell-linux-gnueabi-g++ -fPIC /opt/arm-marvell-linux-gnueabi/arm-marvell-linux-gnueabi/libc/usr/lib/libusb.so  -lpthread -lsgfpamx -lsgfdu03 -lsgfplib -o ../bin/arm12/sgfplibtest_fdu03 FingerVerification.o -L../lib/arm12

It outputs the FingerVerification.o along with executables that I won't be using with JNI (they are to run the original C++ code, but shouldn't be effecting the result).

After compiling the code and getting the .o file, I want to get the .so file (dynamic library) so I convert it like this:

/opt/arm-marvell-linux-gnueabi/bin/arm-marvell-linux-gnueabi-g++ /opt/arm-marvell-linux-gnueabi/arm-marvell-linux-gnueabi/libc/usr/lib/libusb.so -lpthread -lsgfpamx -lsgfdu03 -lsgfplib FingerVerification.o -shared -o libFingerVerification.so -L../lib/arm12 -lc

When attempting to execute my Java program, I get an error midway in the execution of the C++ program (when it attempts to use a resource from the SDK). Here is the snippet:

Call CreateSGFPMObject()
#
# A fatal error has been detected by the Java Runtime Environment:
#
#  SIGSEGV (0xb) at pc=0xb6302d3c, pid=1007, tid=3057566832
#
# JRE version: Java(TM) SE Runtime Environment (7.0_51-b13) (build 1.7.0_51-b13)
# Java VM: Java HotSpot(TM) Client VM (24.51-b03 mixed mode linux-arm )
# Problematic frame:
# C  [libFingerVerification.so+0xd3c]  initializeResources()+0x74

Here is my Java code:

public class FingerVerification
{
    static
    {
        System.loadLibrary("FingerVerification");
    }
    public static native BiometricResult verifyUser(String filePathTemplate1,
        String filePathTemplate2);
    public static native void registerUser();

    public static void main(String[] args)
    {       
        registerUser();
        BiometricResult fingerResult = verifyUser("finger1.min", "finger2.min");
        //According to research, device resolution effects results by 20%, weight is 2
        //According to research, image quality based on acquisition area effects results by 73%, weight is 7.3
        double weight = fingerResult.getImgQuality() * 7.3 + fingerResult.getResolution() * 2;
        System.out.println("The weight is " + weight);
    }
}

My java code is successfully able to call a C++ native JNI method:

JNIEXPORT void JNICALL Java_FingerVerification_registerUser
  (JNIEnv *env, jclass thisClass)

This method quickly calls initializeResources(), which results in a crash

Here is the section of the C++ code it is crashing in:

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "sgfplib.h"
#include <sys/stat.h>
#include "FingerVerification.h"

LPSGFPM sgfplib = NULL;
SGDeviceInfoParam deviceInfo;
SGFingerInfo fingerInfo;
long err;
char function[100];
FILE *fp = NULL;

DWORD maxTemplateSize;
DWORD templateSize;
BYTE *templateToVerify;
BYTE *imgBuffer;

int initializeResources(void);
int main(int argc, char **argv) 
{
}

int initializeResources()
{
    //Creating the handle
    strcpy(function,"CreateSGFPMObject()");
    printf("\nCall %s\n",function);
    err = CreateSGFPMObject(&sgfplib);
    if (!sgfplib)
    {
        printf("ERROR - Unable to instantiate FPM object.\n\n");
        return false;
    }
    printf("%s returned: %ld\n",function,err);

    // Init()
    strcpy(function,"Init(SG_DEV_FDU03)");
    printf("\nCall %s\n",function);
    err = sgfplib->Init(SG_DEV_FDU03);
    printf("%s returned: %ld\n",function,err);
    if (err != SGFDX_ERROR_NONE)
    {
       printf("ERROR - Unable to initialize device.\n\n");
       return 0;
    }

    // OpenDevice()
    strcpy(function,"OpenDevice(0)");
    printf("\nCall %s\n",function);
    err = sgfplib->OpenDevice(0);
    printf("%s returned: %ld\n",function,err);

    // getDeviceInfo()
    deviceInfo.DeviceID = 0;
    strcpy(function,"GetDeviceInfo()");
    printf("\nCall %s\n",function);
    err = sgfplib->GetDeviceInfo(&deviceInfo);
    printf("%s returned: %ld\n",function,err);
    if (err == SGFDX_ERROR_NONE)
    {
      printf("\tdeviceInfo.DeviceID   : %ld\n", deviceInfo.DeviceID);
      printf("\tdeviceInfo.DeviceSN   : %s\n",  deviceInfo.DeviceSN);
      printf("\tdeviceInfo.ComPort    : %ld\n", deviceInfo.ComPort);
      printf("\tdeviceInfo.ComSpeed   : %ld\n", deviceInfo.ComSpeed);
      printf("\tdeviceInfo.ImageWidth : %ld\n", deviceInfo.ImageWidth);
      printf("\tdeviceInfo.ImageHeight: %ld\n", deviceInfo.ImageHeight);
      printf("\tdeviceInfo.Contrast   : %ld\n", deviceInfo.Contrast);
      printf("\tdeviceInfo.Brightness : %ld\n", deviceInfo.Brightness);
      printf("\tdeviceInfo.Gain       : %ld\n", deviceInfo.Gain);
      printf("\tdeviceInfo.ImageDPI   : %ld\n", deviceInfo.ImageDPI);
      printf("\tdeviceInfo.FWVersion  : %04X\n", (unsigned int) deviceInfo.FWVersion);
    }
    printf("\n");
}

Note that it is doing the print statement correctly when it prints

Call CreateSGFPMObject()

So it defiantely is executing the method up to the point when it needs to use a resource from the SecuGen SDK. This makes me think that I generated the libFingerVerification.so file incorrectly from the FingerVerification.o object file. Can anyone look over my work and see if there are any glaring issues?

Here is the complete stack trace

#
# A fatal error has been detected by the Java Runtime Environment:
#
#  SIGSEGV (0xb) at pc=0xa8005d3c, pid=1104, tid=3057882224
#
# JRE version: Java(TM) SE Runtime Environment (7.0_51-b13) (build 1.7.0_51-b13)
# Java VM: Java HotSpot(TM) Client VM (24.51-b03 mixed mode linux-arm )
# Problematic frame:
# C  [libFingerVerification.so+0xd3c]  initializeResources()+0x74
#
# Failed to write core dump. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again
#
# If you would like to submit a bug report, please visit:
#   http://bugreport.sun.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 (0xb6205428):  JavaThread "main" [_thread_in_native, id=1105, stack(0xb63ea000,0xb643a000)]

siginfo:si_signo=SIGSEGV: si_errno=0, si_code=2 (SEGV_ACCERR), si_addr=0xb6f10a8c

Registers:
  r0  = 0x00000000
  r1  = 0x0000012c
  r2  = 0x00000000
  r3  = 0xb6f10a8c
  r4  = 0xa8010340
  r5  = 0xa8006d58
  r6  = 0x00000000
  r7  = 0x00000000
  r8  = 0xb6438a94
  r9  = 0xb02fd0f8
  r10 = 0xb6205428
  fp  = 0xb6438a1c
  r12 = 0x00000000
  sp  = 0xb6438a10
  lr  = 0xa8005d2c
  pc  = 0xa8005d3c
  cpsr = 0xa00f0010

Top of Stack: (sp=0xb6438a10)
0xb6438a10:   a8010340 b6438a54 a8006d80 a8006d80
0xb6438a20:   b6205428 b02fd0f8 b6438a94 b6205550
0xb6438a30:   b6438b84 b6205668 b02fd0f8 b6718ecc
0xb6438a40:   b6205428 002fd3c8 b423cc80 b6438a8c
0xb6438a50:   b420c030 b420bf54 b6438a60 b42001e0
0xb6438a60:   b6438af4 b6438bd0 b6205428 b6438a6c
0xb6438a70:   00000000 b6438a94 b02fd3c8 00000000
0xb6438a80:   b02fd0f8 00000000 b6438a98 b6438ab8 

Instructions: (pc=0xa8005d3c)
0xa8005d1c:   e59f345c e7943003 e1a00003 ebffff78
0xa8005d2c:   e1a03000 e1a02003 e59f3448 e7943003
0xa8005d3c:   e5832000 e59f3438 e7943003 e5933000
0xa8005d4c:   e3530000 1a000005 e59f342c e0843003 

Register to memory mapping:

  r0  = 0x00000000
0x00000000 is an unknown value

  r1  = 0x0000012c
0x0000012c is an unknown value

  r2  = 0x00000000
0x00000000 is an unknown value

  r3  = 0xb6f10a8c
0xb6f10a8c: err+0 in /lib/libc.so.6 at 0xb6e47000

  r4  = 0xa8010340
0xa8010340: <offset 0xb340> in /home/root/Desktop/BioFlip/fdx_sdk_pro_linux_arm_3_7_1_rev570/JNI/libFingerVerification.so at 0xa8005000

  r5  = 0xa8006d58
0xa8006d58: Java_FingerVerification_registerUser+0 in /home/root/Desktop/BioFlip/fdx_sdk_pro_linux_arm_3_7_1_rev570/JNI/libFingerVerification.so at 0xa8005000

  r6  = 0x00000000
0x00000000 is an unknown value

  r7  = 0x00000000
0x00000000 is an unknown value

  r8  = 0xb6438a94
0xb6438a94 is pointing into the stack for thread: 0xb6205428

  r9  = 0xb02fd0f8
0xb02fd0f8 is an oop
{method} 
 - klass: {other class}

  r10 = 0xb6205428
0xb6205428 is a thread

  fp  = 0xb6438a1c
0xb6438a1c is pointing into the stack for thread: 0xb6205428

  r12 = 0x00000000
0x00000000 is an unknown value

  sp  = 0xb6438a10
0xb6438a10 is pointing into the stack for thread: 0xb6205428

  lr  = 0xa8005d2c
0xa8005d2c: _Z19initializeResourcesv+0x64 in /home/root/Desktop/BioFlip/fdx_sdk_pro_linux_arm_3_7_1_rev570/JNI/libFingerVerification.so at 0xa8005000

  pc  = 0xa8005d3c
0xa8005d3c: _Z19initializeResourcesv+0x74 in /home/root/Desktop/BioFlip/fdx_sdk_pro_linux_arm_3_7_1_rev570/JNI/libFingerVerification.so at 0xa8005000



Stack: [0xb63ea000,0xb643a000],  sp=0xb6438a10,  free space=314k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
C  [libFingerVerification.so+0xd3c]  initializeResources()+0x74

[error occurred during error reporting (printing native stack), id 0xb]

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

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

Java Threads: ( => current thread )
  0xb626bea8 JavaThread "Service Thread" daemon [_thread_blocked, id=1111, stack(0xa7d40000,0xa7d90000)]
  0xb626a320 JavaThread "C1 CompilerThread0" daemon [_thread_blocked, id=1110, stack(0xa7d90000,0xa7e10000)]
  0xb6268d60 JavaThread "Signal Dispatcher" daemon [_thread_blocked, id=1109, stack(0xa7e10000,0xa7e60000)]
  0xb625a140 JavaThread "Finalizer" daemon [_thread_blocked, id=1108, stack(0xa7e60000,0xa7eb0000)]
  0xb6257cc8 JavaThread "Reference Handler" daemon [_thread_blocked, id=1107, stack(0xa7eb0000,0xa7f00000)]
=>0xb6205428 JavaThread "main" [_thread_in_native, id=1105, stack(0xb63ea000,0xb643a000)]

Other Threads:
  0xb62566c8 VMThread [stack: 0xa8011000,0xa8091000] [id=1106]
  0xb620e928 WatcherThread [stack: 0xa7cc0000,0xa7d40000] [id=1112]

VM state:not at safepoint (normal execution)

VM Mutex/Monitor currently owned by a thread: None

Heap
 def new generation   total 2432K, used 321K [0xa8380000, 0xa8620000, 0xaad80000)
  eden space 2176K,  14% used [0xa8380000, 0xa83d0610, 0xa85a0000)
  from space 256K,   0% used [0xa85a0000, 0xa85a0000, 0xa85e0000)
  to   space 256K,   0% used [0xa85e0000, 0xa85e0000, 0xa8620000)
 tenured generation   total 5376K, used 0K [0xaad80000, 0xab2c0000, 0xb0180000)
   the space 5376K,   0% used [0xaad80000, 0xaad80000, 0xaad80200, 0xab2c0000)
 compacting perm gen  total 12288K, used 1528K [0xb0180000, 0xb0d80000, 0xb4180000)
   the space 12288K,  12% used [0xb0180000, 0xb02fe0f8, 0xb02fe200, 0xb0d80000)
No shared spaces configured.

Card table byte_map: [0xa8320000,0xa8380000] byte_map_base: 0xa7dde400

Polling page: 0xb6fec000

Code Cache  [0xb4200000, 0xb4298000, 0xb6200000)
 total_blobs=132 nmethods=4 adapters=66 free_code_cache=32186Kb largest_free_block=32958784

Compilation events (8 events):
Event: 0.710 Thread 0xb626a320    1             java.lang.String::indexOf (70 bytes)
Event: 0.719 Thread 0xb626a320 nmethod 1 0xb4290848 code [0xb4290940, 0xb4290aa4]
Event: 0.730 Thread 0xb626a320    2             java.lang.String::hashCode (55 bytes)
Event: 0.732 Thread 0xb626a320 nmethod 2 0xb4290cc8 code [0xb4290db0, 0xb4290ea8]
Event: 0.739 Thread 0xb626a320    3             java.lang.String::charAt (29 bytes)
Event: 0.741 Thread 0xb626a320 nmethod 3 0xb4290f48 code [0xb4291040, 0xb4291164]
Event: 0.744 Thread 0xb626a320    4             sun.nio.cs.US_ASCII$Encoder::encode (107 bytes)
Event: 0.748 Thread 0xb626a320 nmethod 4 0xb4291248 code [0xb4291330, 0xb4291518]

GC Heap History (0 events):
No events

Deoptimization events (0 events):
No events

Internal exceptions (3 events):
Event: 0.465 Thread 0xb6205428 Threw 0xa838f760 at /HUDSON/workspace/7u-2-build-linux-arm-vfp-sflt/jdk7u51/527/hotspot/src/share/vm/prims/jni.cpp:3991
Event: 0.736 Thread 0xb6205428 Threw 0xa83c1ed0 at /HUDSON/workspace/7u-2-build-linux-arm-vfp-sflt/jdk7u51/527/hotspot/src/share/vm/prims/jvm.cpp:1244
Event: 0.784 Thread 0xb6205428 Threw 0xa83c79d8 at /HUDSON/workspace/7u-2-build-linux-arm-vfp-sflt/jdk7u51/527/hotspot/src/share/vm/prims/jvm.cpp:1244

Events (10 events):
Event: 0.777 loading class 0xa82e5fd0
Event: 0.777 loading class 0xa82e5fd0 done
Event: 0.778 loading class 0xa82bb0a8
Event: 0.778 loading class 0xa82bb0a8 done
Event: 0.783 loading class 0xb62783f8
Event: 0.783 loading class 0xb62783f8 done
Event: 0.787 loading class 0xa82a6420
Event: 0.787 loading class 0xa82a6420 done
Event: 0.788 loading class 0xa82a6e60
Event: 0.789 loading class 0xa82a6e60 done


Dynamic libraries:
00008000-00009000 r-xp 00000000 b3:02 50621      /usr/java/jdk1.7.0_51/bin/java
00010000-00011000 rw-p 00000000 b3:02 50621      /usr/java/jdk1.7.0_51/bin/java
00011000-00032000 rw-p 00000000 00:00 0          [heap]
a7b3c000-a7bf0000 r-xp 00000000 b3:02 29792      /usr/lib/libstdc++.so.6.0.17
a7bf0000-a7bf7000 ---p 000b4000 b3:02 29792      /usr/lib/libstdc++.so.6.0.17
a7bf7000-a7bfb000 r--p 000b3000 b3:02 29792      /usr/lib/libstdc++.so.6.0.17
a7bfb000-a7bfd000 rw-p 000b7000 b3:02 29792      /usr/lib/libstdc++.so.6.0.17
a7bfd000-a7c03000 rw-p 00000000 00:00 0 
a7c0f000-a7c1e000 r-xp 00000000 b3:02 50007      /home/root/Desktop/BioFlip/fdx_sdk_pro_linux_arm_3_7_1_rev570/lib/arm12/libsgfplib.so
a7c1e000-a7c25000 ---p 0000f000 b3:02 50007      /home/root/Desktop/BioFlip/fdx_sdk_pro_linux_arm_3_7_1_rev570/lib/arm12/libsgfplib.so
a7c25000-a7c26000 rw-p 0000e000 b3:02 50007      /home/root/Desktop/BioFlip/fdx_sdk_pro_linux_arm_3_7_1_rev570/lib/arm12/libsgfplib.so
a7c26000-a7c41000 r-xp 00000000 b3:02 50005      /home/root/Desktop/BioFlip/fdx_sdk_pro_linux_arm_3_7_1_rev570/lib/arm12/libsgfdu03.so
a7c41000-a7c48000 ---p 0001b000 b3:02 50005      /home/root/Desktop/BioFlip/fdx_sdk_pro_linux_arm_3_7_1_rev570/lib/arm12/libsgfdu03.so
a7c48000-a7c96000 rw-p 0001a000 b3:02 50005      /home/root/Desktop/BioFlip/fdx_sdk_pro_linux_arm_3_7_1_rev570/lib/arm12/libsgfdu03.so
a7c96000-a7ca6000 r-xp 00000000 b3:02 49994      /home/root/Desktop/BioFlip/fdx_sdk_pro_linux_arm_3_7_1_rev570/lib/arm12/libsgfpamx.so
a7ca6000-a7caf000 rw-p 00010000 b3:02 49994      /home/root/Desktop/BioFlip/fdx_sdk_pro_linux_arm_3_7_1_rev570/lib/arm12/libsgfpamx.so
a7caf000-a7cb7000 r-xp 00000000 b3:02 50002      /home/root/Desktop/BioFlip/fdx_sdk_pro_linux_arm_3_7_1_rev570/lib/arm12/libusb-0.1.so.4
a7cb7000-a7cbe000 ---p 00008000 b3:02 50002      /home/root/Desktop/BioFlip/fdx_sdk_pro_linux_arm_3_7_1_rev570/lib/arm12/libusb-0.1.so.4
a7cbe000-a7cc0000 rw-p 00007000 b3:02 50002      /home/root/Desktop/BioFlip/fdx_sdk_pro_linux_arm_3_7_1_rev570/lib/arm12/libusb-0.1.so.4
a7cc0000-a7cc1000 ---p 00000000 00:00 0 
a7cc1000-a7d90000 rwxp 00000000 00:00 0          [stack:1111]
a7d90000-a7d91000 ---p 00000000 00:00 0 
a7d91000-a7f00000 rwxp 00000000 00:00 0          [stack:1107]
a7f00000-a7f21000 rw-p 00000000 00:00 0 
a7f21000-a8000000 ---p 00000000 00:00 0 
a8005000-a8009000 r-xp 00000000 b3:02 50016      /home/root/Desktop/BioFlip/fdx_sdk_pro_linux_arm_3_7_1_rev570/JNI/libFingerVerification.so
a8009000-a8010000 ---p 00004000 b3:02 50016      /home/root/Desktop/BioFlip/fdx_sdk_pro_linux_arm_3_7_1_rev570/JNI/libFingerVerification.so
a8010000-a8011000 rw-p 00003000 b3:02 50016      /home/root/Desktop/BioFlip/fdx_sdk_pro_linux_arm_3_7_1_rev570/JNI/libFingerVerification.so
a8011000-a8012000 ---p 00000000 00:00 0 
a8012000-a8091000 rwxp 00000000 00:00 0          [stack:1106]
a8091000-a80dc000 rw-p 00000000 00:00 0 
a80dc000-a829a000 r--s 039e1000 b3:02 50694      /usr/java/jdk1.7.0_51/jre/lib/rt.jar
a829a000-a82f8000 rw-p 00000000 00:00 0 
a82f8000-a8320000 rw-p 00000000 00:00 0 
a8320000-a8322000 rw-p 00000000 00:00 0 
a8322000-a8335000 rw-p 00000000 00:00 0 
a8335000-a8338000 rw-p 00000000 00:00 0 
a8338000-a835f000 rw-p 00000000 00:00 0 
a835f000-a8365000 rw-p 00000000 00:00 0 
a8365000-a837f000 rw-p 00000000 00:00 0 
a837f000-a8620000 rw-p 00000000 00:00 0 
a8620000-aad80000 rw-p 00000000 00:00 0 
aad80000-ab2c0000 rw-p 00000000 00:00 0 
ab2c0000-b0180000 rw-p 00000000 00:00 0 
b0180000-b0d80000 rw-p 00000000 00:00 0 
b0d80000-b4180000 rw-p 00000000 00:00 0 
b4180000-b4183000 rw-p 00000000 00:00 0 
b4183000-b4200000 rw-p 00000000 00:00 0 
b4200000-b4298000 rwxp 00000000 00:00 0 
b4298000-b627c000 rw-p 00000000 00:00 0 
b627c000-b6300000 ---p 00000000 00:00 0 
b6308000-b630f000 rw-p 00000000 00:00 0 
b630f000-b6329000 rw-p 00000000 00:00 0 
b6329000-b633f000 r-xp 00000000 b3:02 50678      /usr/java/jdk1.7.0_51/jre/lib/arm/libzip.so
b633f000-b6346000 ---p 00016000 b3:02 50678      /usr/java/jdk1.7.0_51/jre/lib/arm/libzip.so
b6346000-b6347000 rw-p 00015000 b3:02 50678      /usr/java/jdk1.7.0_51/jre/lib/arm/libzip.so
b6347000-b6352000 r-xp 00000000 b3:02 46765      /lib/libnss_files-2.16.so
b6352000-b6359000 ---p 0000b000 b3:02 46765      /lib/libnss_files-2.16.so
b6359000-b635a000 r--p 0000a000 b3:02 46765      /lib/libnss_files-2.16.so
b635a000-b635b000 rw-p 0000b000 b3:02 46765      /lib/libnss_files-2.16.so
b635b000-b6364000 r-xp 00000000 b3:02 46689      /lib/libnss_nis-2.16.so
b6364000-b636b000 ---p 00009000 b3:02 46689      /lib/libnss_nis-2.16.so
b636b000-b636c000 r--p 00008000 b3:02 46689      /lib/libnss_nis-2.16.so
b636c000-b636d000 rw-p 00009000 b3:02 46689      /lib/libnss_nis-2.16.so
b636d000-b637e000 r-xp 00000000 b3:02 46771      /lib/libnsl-2.16.so
b637e000-b6385000 ---p 00011000 b3:02 46771      /lib/libnsl-2.16.so
b6385000-b6386000 r--p 00010000 b3:02 46771      /lib/libnsl-2.16.so
b6386000-b6387000 rw-p 00011000 b3:02 46771      /lib/libnsl-2.16.so
b6387000-b6389000 rw-p 00000000 00:00 0 
b6389000-b638f000 r-xp 00000000 b3:02 46541      /lib/libnss_compat-2.16.so
b638f000-b6397000 ---p 00006000 b3:02 46541      /lib/libnss_compat-2.16.so
b6397000-b6398000 r--p 00006000 b3:02 46541      /lib/libnss_compat-2.16.so
b6398000-b6399000 rw-p 00007000 b3:02 46541      /lib/libnss_compat-2.16.so
b6399000-b63bf000 r-xp 00000000 b3:02 50684      /usr/java/jdk1.7.0_51/jre/lib/arm/libjava.so
b63bf000-b63c7000 ---p 00026000 b3:02 50684      /usr/java/jdk1.7.0_51/jre/lib/arm/libjava.so
b63c7000-b63c8000 rw-p 00026000 b3:02 50684      /usr/java/jdk1.7.0_51/jre/lib/arm/libjava.so
b63c8000-b63d2000 r-xp 00000000 b3:02 50650      /usr/java/jdk1.7.0_51/jre/lib/arm/libverify.so
b63d2000-b63da000 ---p 0000a000 b3:02 50650      /usr/java/jdk1.7.0_51/jre/lib/arm/libverify.so
b63da000-b63db000 rw-p 0000a000 b3:02 50650      /usr/java/jdk1.7.0_51/jre/lib/arm/libverify.so
b63db000-b63e1000 r-xp 00000000 b3:02 46539      /lib/librt-2.16.so
b63e1000-b63e8000 ---p 00006000 b3:02 46539      /lib/librt-2.16.so
b63e8000-b63e9000 r--p 00005000 b3:02 46539      /lib/librt-2.16.so
b63e9000-b63ea000 rw-p 00006000 b3:02 46539      /lib/librt-2.16.so
b63ea000-b63eb000 ---p 00000000 00:00 0 
b63eb000-b643a000 rwxp 00000000 00:00 0          [stack:1105]
b643a000-b64a2000 r-xp 00000000 b3:02 47878      /lib/libm-2.16.so
b64a2000-b64a9000 ---p 00068000 b3:02 47878      /lib/libm-2.16.so
b64a9000-b64aa000 r--p 00067000 b3:02 47878      /lib/libm-2.16.so
b64aa000-b64ab000 rw-p 00068000 b3:02 47878      /lib/libm-2.16.so
b64ab000-b69d8000 r-xp 00000000 b3:02 50654      /usr/java/jdk1.7.0_51/jre/lib/arm/client/libjvm.so
b69d8000-b69df000 ---p 0052d000 b3:02 50654      /usr/java/jdk1.7.0_51/jre/lib/arm/client/libjvm.so
b69df000-b6a04000 rw-p 0052c000 b3:02 50654      /usr/java/jdk1.7.0_51/jre/lib/arm/client/libjvm.so
b6a04000-b6e21000 rw-p 00000000 00:00 0 
b6e21000-b6e3f000 r-xp 00000000 b3:02 47882      /lib/libgcc_s.so.1
b6e3f000-b6e46000 ---p 0001e000 b3:02 47882      /lib/libgcc_s.so.1
b6e46000-b6e47000 rw-p 0001d000 b3:02 47882      /lib/libgcc_s.so.1
b6e47000-b6f6b000 r-xp 00000000 b3:02 48400      /lib/libc-2.16.so
b6f6b000-b6f72000 ---p 00124000 b3:02 48400      /lib/libc-2.16.so
b6f72000-b6f74000 r--p 00123000 b3:02 48400      /lib/libc-2.16.so
b6f74000-b6f75000 rw-p 00125000 b3:02 48400      /lib/libc-2.16.so
b6f75000-b6f78000 rw-p 00000000 00:00 0 
b6f78000-b6f7a000 r-xp 00000000 b3:02 48387      /lib/libdl-2.16.so
b6f7a000-b6f81000 ---p 00002000 b3:02 48387      /lib/libdl-2.16.so
b6f81000-b6f82000 r--p 00001000 b3:02 48387      /lib/libdl-2.16.so
b6f82000-b6f83000 rw-p 00002000 b3:02 48387      /lib/libdl-2.16.so
b6f83000-b6f96000 r-xp 00000000 b3:02 50582      /usr/java/jdk1.7.0_51/lib/arm/jli/libjli.so
b6f96000-b6f9e000 ---p 00013000 b3:02 50582      /usr/java/jdk1.7.0_51/lib/arm/jli/libjli.so
b6f9e000-b6f9f000 rw-p 00013000 b3:02 50582      /usr/java/jdk1.7.0_51/lib/arm/jli/libjli.so
b6f9f000-b6fb3000 r-xp 00000000 b3:02 48680      /lib/libpthread-2.16.so
b6fb3000-b6fba000 ---p 00014000 b3:02 48680      /lib/libpthread-2.16.so
b6fba000-b6fbb000 r--p 00013000 b3:02 48680      /lib/libpthread-2.16.so
b6fbb000-b6fbc000 rw-p 00014000 b3:02 48680      /lib/libpthread-2.16.so
b6fbc000-b6fbe000 rw-p 00000000 00:00 0 
b6fc2000-b6fca000 rw-s 00000000 00:16 7747       /tmp/hsperfdata_root/1104
b6fca000-b6fe9000 r-xp 00000000 b3:02 48402      /lib/ld-2.16.so
b6feb000-b6fec000 rw-p 00000000 00:00 0 
b6fec000-b6fed000 r--p 00000000 00:00 0 
b6fed000-b6ff0000 rw-p 00000000 00:00 0 
b6ff0000-b6ff1000 r--p 0001e000 b3:02 48402      /lib/ld-2.16.so
b6ff1000-b6ff2000 rw-p 0001f000 b3:02 48402      /lib/ld-2.16.so
bebcc000-bebed000 rwxp 00000000 00:00 0          [stack]
ffff0000-ffff1000 r-xp 00000000 00:00 0          [vectors]

VM Arguments:
java_command: FingerVerification
Launcher Type: SUN_STANDARD

Environment Variables:
JAVA_HOME=/usr/java/ejre1.7.0_51/
PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin:/usr/java/jdk1.7.0_51/bin/:/usr/java/ejre1.7.0_51/bin
LD_LIBRARY_PATH=.:../lib/arm12
SHELL=/bin/sh

Thank you.

java
c++
compiler-errors
jni
cross-compiling
asked on Stack Overflow Jul 8, 2014 by user1410668 • edited Jul 8, 2014 by user1410668

1 Answer

0

Well, I basically gave up on this. Instead of using JNI I decided to run the executable created by compiling native C++ code through Java using a similar method to this:

Run C++ executable from Java in Linux

I'm planning to just pass in arguments into the main method of the C++ code that will determine which function to call and any result returned by a function will just be saved into a temporary file that the java program can read and then delete. Hacky, but simpler and it should work. The C++ integration is just a small component of the system I was forced to use anyway.

answered on Stack Overflow Jul 10, 2014 by user1410668 • edited May 23, 2017 by Community

User contributions licensed under CC BY-SA 3.0