Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Javacpp Not Working on IBM AIX #23

Closed
deepakagrawal7 opened this issue Jul 14, 2015 · 4 comments
Closed

Javacpp Not Working on IBM AIX #23

deepakagrawal7 opened this issue Jul 14, 2015 · 4 comments
Labels

Comments

@deepakagrawal7
Copy link

Hi Samuel
After getting Javacpp work on linux and with caffe, I have to shift to a new environment ie IBM AIX.
Trying to compile a very basic example just to check the functionality:

prediction.h

#include cstring
#include cstdlib 
#include vector 
#include string 
#include iostream 
#include stdio.h
#include assert.h
using namespace std;
static inline int process(int a,int b)
{ printf("hello"); return a+b;}

PredictionClass.java

import org.bytedeco.javacpp.*;
import org.bytedeco.javacpp.annotation.*;

@Platform(include="prediction.h")
public class PredictClass {
    static {
    Loader.load();
    }
    public static native int process(int  a, int b);
    public static void main(String[] args) {
         int a=3,b=5;
      int c= process(a, b);
    System.out.println("sum is "+c);
    }
}

It compiles fine. But when I run

java -jar javacpp.jar PredictClass

It give the following error.

Generating /home/testing/jniPredictClass.cpp
Compiling /home/testing/aix-ppc64/libjniPredictClass.so
g++ -I/usr/java6_64/include /home/testing/jniPredictClass.cpp -Wall -O3 -fPIC -shared -s -o /home/testing/aix-ppc64/libjniPredictClass.so
/home/testing/jniPredictClass.cpp: In function 'void JNI_OnUnload(JavaVM*, void*)':
/home/testing/jniPredictClass.cpp:350:52: error: no matching function for call to 'JNIEnv_::DeleteWeakGlobalRef(_jclass*&)'
         env->DeleteWeakGlobalRef(JavaCPP_classes[i]);
                                                    ^
/home/testing/jniPredictClass.cpp:350:52: note: candidate is:
In file included from /home/testing/jniPredictClass.cpp:26:0:
/usr/java6_64/include/jni.h:648:7: note: void JNIEnv_::DeleteWeakGlobalRef(jweak)
  void DeleteWeakGlobalRef(jweak obj) { functions->DeleteWeakGlobalRef(this, obj); }
       ^
/usr/java6_64/include/jni.h:648:7: note:   no known conversion for argument 1 from 'jclass {aka _jclass*}' to 'jweak {aka _jweak*}'

It worked fine on Centos. Do you see any reason why it's showing it on AIX?

Thanks in advance

Regards

saudet added a commit that referenced this issue Jul 14, 2015
@saudet
Copy link
Member

saudet commented Jul 14, 2015

It should be fixed now, so please try again with the latest source and let me know how that goes.

And thanks for reporting!

@saudet saudet added the bug label Jul 14, 2015
@deepakagrawal7
Copy link
Author

Hi, using the latest source that issue is resolved. However, it seems that there is some issue with AIX using the shared object file(.so).

Thanks

@saudet
Copy link
Member

saudet commented Jul 15, 2015

Right, could you let me know what command we should be executing to compile a shared library from a .cpp file under AIX? thanks!

@saudet
Copy link
Member

saudet commented Oct 30, 2015

Fix included in JavaCPP 1.1. If there is anything more that needs to be added to support AIX, please let me know, and thanks for reporting!

@saudet saudet closed this as completed Oct 30, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants