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(windows loading): expliciting temp file suffix #41

Merged
merged 1 commit into from
Feb 8, 2024

Conversation

DariusIMP
Copy link
Member

@DariusIMP DariusIMP commented Feb 8, 2024

A strange issue was thrown when loading the zenoh-jni native library from the package:

Exception in thread "main" java.lang.UnsatisfiedLinkError: C:\Users\....\AppData\Local\Temp\tempLib10649058771145031396: Can't find dependent libraries
    at java.base/jdk.internal.loader.NativeLibraries.load(Native Method)
    at java.base/jdk.internal.loader.NativeLibraries$NativeLibraryImpl.open(NativeLibraries.java:388)
    at java.base/jdk.internal.loader.NativeLibraries.loadLibrary(NativeLibraries.java:232)
    at java.base/jdk.internal.loader.NativeLibraries.loadLibrary(NativeLibraries.java:174)
    at java.base/java.lang.ClassLoader.loadLibrary(ClassLoader.java:2389)
    at java.base/java.lang.Runtime.load0(Runtime.java:755)
    at java.base/java.lang.System.load(System.java:1953)
    at io.zenoh.Zenoh$Companion.loadZenohJNI(Zenoh.kt:125)
    at io.zenoh.Zenoh$Companion.tryLoadingLibraryFromJarPackage-IoAF18A(Zenoh.kt:137)
    at io.zenoh.Zenoh$Companion.access$tryLoadingLibraryFromJarPackage-IoAF18A(Zenoh.kt:29)
    at io.zenoh.Zenoh.<init>(Zenoh.kt:161)
    at io.zenoh.Zenoh.<init>(Zenoh.kt)
    at io.zenoh.Zenoh$Companion.load(Zenoh.kt:36)
    at io.zenoh.Session.<init>(Session.kt:81)
    at io.zenoh.Session.<init>(Session.kt)
    at io.zenoh.Session$Companion.open-d1pmJ48(Session.kt:64)

The PR explicitly states a suffix for File.createTempFile, since providing an empty suffix (which I had thought would be unnecessary for a temporary file being created and deleted at runtime) causes in windows an undesired behaviour: the temporary file with the library fails to be created, and therefore fails to be loaded.

Closes #42

@eclipse-zenoh-bot
Copy link
Contributor

@DariusIMP If this pull request contains a bugfix or a new feature, then please consider using Closes #ISSUE-NUMBER syntax to link it to an issue.

1 similar comment
@eclipse-zenoh-bot
Copy link
Contributor

@DariusIMP If this pull request contains a bugfix or a new feature, then please consider using Closes #ISSUE-NUMBER syntax to link it to an issue.

@Mallets Mallets merged commit a91df33 into eclipse-zenoh:main Feb 8, 2024
9 checks passed
@Mallets Mallets deleted the fix_windows_loading branch February 8, 2024 16:20
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.

[Bug] Failure loading windows library
3 participants