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

Fix: Java JAR contains native library twice #430

Open
wants to merge 1 commit into
base: main-dev
Choose a base branch
from

Conversation

MarkReedZ
Copy link
Contributor

This PR fixes #314 by excluding the shared/ directory.

Tested with

javac -cp /usr/share/java/junit4.jar:../../build/libs/usearch-2.13.0.jar IndexTest.java
java -cp .:/usr/share/java/junit4.jar org.junit.runner.JUnitCore IndexTest

@MarkReedZ
Copy link
Contributor Author

Note that a cleaner fix for this issue would probably be to not copy the dlls and load them from usearch/shared/

In the build.gradle we copy usearch/shared/* to ../ then in the code we load from /usearch. Instead we can remove the copying and load from /usearch/shared/

          NativeUtils.loadLibraryFromJar("/usearch/libusearch.dylib");
        } else {
          NativeUtils.loadLibraryFromJar("/usearch/libusearch.so");

@ashvardanian
Copy link
Contributor

The latter sounds like a good plan. I can wait for that patch, if you want to follow up on this branch 🤗

@MarkReedZ
Copy link
Contributor Author

Proper fix and verified the jar as in the OP.

@@ -375,9 +375,9 @@ public Config expansion_search(long _expansion_search) {
} catch (UnsatisfiedLinkError e) {
try {
if (System.getProperty("os.name").equals("Mac OS X")) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we know what this property is equal to on Windows? We should probably link to .dll there.

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

Successfully merging this pull request may close these issues.

2 participants