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

Is this wrapper working? #2

Open
febtree opened this issue May 22, 2019 · 8 comments
Open

Is this wrapper working? #2

febtree opened this issue May 22, 2019 · 8 comments

Comments

@febtree
Copy link

febtree commented May 22, 2019

I follow the documentation and got everything right except the "error: method finalize() is already defined in class RangeSearchPartialResult". Then I commented the first finalize() method in com/thenetcircle/services/faiss/RangeSearchPartialResult.java and re-run the Test command, this time is compiles right and throw this error while loading the shared library:


T E S T S

Running com.thenetcircle.services.faiss4j.tests.Examples
Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.371 sec <<< FAILURE! - in com.thenetcircle.services.faiss4j.tests.Examples
com.thenetcircle.services.faiss4j.tests.Examples Time elapsed: 0.37 sec <<< ERROR!

java.lang.UnsatisfiedLinkError: /data/zhaohh/soft/faiss4j/swigfaiss4j.so: 
/data/zhaohh/soft/faiss4j/swigfaiss4j.so: undefined symbol: _ZTIN5faiss9IndexFlatE
    at java.lang.ClassLoader$NativeLibrary.load(Native Method)
    at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1941)
    at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1824)
    at java.lang.Runtime.load0(Runtime.java:809)
    at java.lang.System.load(System.java:1086)
    at com.thenetcircle.services.faiss4j.tests.Examples.load(Examples.java:25)

Results :

Tests in error:
Examples.load:25 » UnsatisfiedLink /data/zhaohh/soft/faiss4j/swigfaiss4j.so: /...

Tests run: 1, Failures: 0, Errors: 1, Skipped: 0

I can't figure out what went wrong, can somebody help me in here ?

@cfcodefans
Copy link
Collaborator

Sorry for the late reply.
I guess I missed one part in test

LD_LIBRARY_PATH=. mvn test -Dtest=com.thenetcircle.services.faiss4j.tests.Examples#testLib

this is run in root path of the project and the faiss so files should also be placed here.

please let me know if this helps.

@febtree
Copy link
Author

febtree commented May 28, 2019

This is exactly where I ran the test command, the project root, and swigfaiss4j.so is indeed there. I still got this error.
And there is no testLib method in com.thenetcircle.services.faiss4j.tests.Examples.java

@cfcodefans
Copy link
Collaborator

libfaiss.a and libfaiss.so, you might find it in /usr/local/lib/, and please cp both to project root.

@zwangbo
Copy link

zwangbo commented Jun 9, 2019

I also follow the instruction and get this error.
I found generated RangeSearchPartialResult.java file is not the same with original.

diff --git a/src/main/java/com/thenetcircle/services/faiss/RangeSearchPartialResult.java b/src/main/java/com/thenetcircle/services
index b322ae1..ab26209 100644
--- a/src/main/java/com/thenetcircle/services/faiss/RangeSearchPartialResult.java
+++ b/src/main/java/com/thenetcircle/services/faiss/RangeSearchPartialResult.java
@@ -61,9 +61,9 @@ public class RangeSearchPartialResult extends BufferList {
     return new SWIGTYPE_p_faiss__RangeSearchPartialResult__QueryResult(swigfaissJNI.RangeSearchPartialResult_new_result(swigCPtr,
   }

-//  public void finalize() {
-//    swigfaissJNI.RangeSearchPartialResult_finalize(swigCPtr, this);
-//  }
+  public void finalize() {
+    swigfaissJNI.RangeSearchPartialResult_finalize(swigCPtr, this);
+  }

   public void set_lims() {
     swigfaissJNI.RangeSearchPartialResult_set_lims(swigCPtr, this);

Then I roll back this file and this error solved.

@renfliu
Copy link

renfliu commented Aug 4, 2019

I also follow the instruction and get this error.
I found generated RangeSearchPartialResult.java file is not the same with original.

diff --git a/src/main/java/com/thenetcircle/services/faiss/RangeSearchPartialResult.java b/src/main/java/com/thenetcircle/services
index b322ae1..ab26209 100644
--- a/src/main/java/com/thenetcircle/services/faiss/RangeSearchPartialResult.java
+++ b/src/main/java/com/thenetcircle/services/faiss/RangeSearchPartialResult.java
@@ -61,9 +61,9 @@ public class RangeSearchPartialResult extends BufferList {
     return new SWIGTYPE_p_faiss__RangeSearchPartialResult__QueryResult(swigfaissJNI.RangeSearchPartialResult_new_result(swigCPtr,
   }

-//  public void finalize() {
-//    swigfaissJNI.RangeSearchPartialResult_finalize(swigCPtr, this);
-//  }
+  public void finalize() {
+    swigfaissJNI.RangeSearchPartialResult_finalize(swigCPtr, this);
+  }

   public void set_lims() {
     swigfaissJNI.RangeSearchPartialResult_set_lims(swigCPtr, this);

Then I roll back this file and this error solved.

I found two finalize() method in this file.

23 protected void finalize() {
24 delete();
25 }

64 public void finalize() {
65 swigfaissJNI.RangeSearchPartialResult_finalize(swigCPtr, this);
66 }

Maybe this is the reason for that. But I don't know which is the right.

@DunZhang
Copy link

Hi, I follow the documentation and also get flowing error:

java.lang.UnsatisfiedLinkError: /data/zhaohh/soft/faiss4j/swigfaiss4j.so: 
/data/zhaohh/soft/faiss4j/swigfaiss4j.so: undefined symbol: _ZTIN5faiss9IndexFlatE
    at java.lang.ClassLoader$NativeLibrary.load(Native Method)
    at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1941)
    at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1824)
    at java.lang.Runtime.load0(Runtime.java:809)
    at java.lang.System.load(System.java:1086)
    at com.thenetcircle.services.faiss4j.tests.Examples.load(Examples.java:25)

Could you please give me your docker images? @Baineng

@cfcodefans
Copy link
Collaborator

Hi, I follow the documentation and also get flowing error:

java.lang.UnsatisfiedLinkError: /data/zhaohh/soft/faiss4j/swigfaiss4j.so: 
/data/zhaohh/soft/faiss4j/swigfaiss4j.so: undefined symbol: _ZTIN5faiss9IndexFlatE
    at java.lang.ClassLoader$NativeLibrary.load(Native Method)
    at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1941)
    at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1824)
    at java.lang.Runtime.load0(Runtime.java:809)
    at java.lang.System.load(System.java:1086)
    at com.thenetcircle.services.faiss4j.tests.Examples.load(Examples.java:25)

Could you please give me your docker images? @Baineng

Hi, Mr Zhang, did you build faiss with source of version 1.5.0?
I haven't tested any other version's source.

@xuedisong
Copy link

libfaiss.a and libfaiss.so, you might find it in /usr/local/lib/, and please cp both to project root.

I done this, but I still got the error too.
"undefined symbol: _ZTIN5faiss9IndexFlatE"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants