Closed cjaentsch closed 4 years ago
Thanks, I just checked. We build the path correct, without the duplicate. Seems to be an issue somewhere else. I need to look into it some more.
Thanks, I just checked. We build the path correct, without the duplicate. Seems to be an issue somewhere else. I need to look into it some more.
Maybe on MacOS you don't need to add the ".dylib" when calling Native.register...
Thanks, I just checked. We build the path correct, without the duplicate. Seems to be an issue somewhere else. I need to look into it some more.
Maybe on MacOS you don't need to add the ".dylib" when calling Native.register...
Tried that as well, didn't work.
Ok, but you can reproduce it? So it's not an error just in our environment?
Ok, but you can reproduce it? So it's not an error just in our environment?
Yes, I am able to reproduce, and I will work on a fix.
Seems to be the libName not starting with "lib" triggers the following function in NativeLibrary.mapSharedLibraryName:
... which leads the "name" to have another ".dylib" appended.
Yep, just came to the same conclusion. But changing the dylib name just for JNA sounds kinda dirty to me.
But it looks like the problem kinda lies with Java itself. https://www.tutorialspoint.com/java/lang/system_maplibraryname.htm
I found a workaround for now. This would only work if the .dylib is in System.getProperty("user.dir").
static {
String libName = getLibName();
if (Platform.isMac()) {
libName = System.getProperty("user.dir") + "/" + libName;
}
setLibSearchPath();
Native.register(ClientLibrary.class, libName);
}
Strange JAVA behaviour... In our case the dylib is located in the "jna.library.path", so the workaround wouldn't work.
So, the workaround will be that we provide a .dylib specially for Java named "libcom.fiskaly.client-darwin-amd64-v1.2.000.dylib" and remove the dylib extension from our path builder. I tested this, and this works for sure. Expect changes by tomorrow or the day after.
Works already when renaming the file to "libcom.fiskaly.client-darwin-amd64-v1.2.000.dylib.dylib". But still, strange Java logic.
I get the following exception when trying to load the dylib for MacOS (v.1.2.000):
The path seems to be built incorrectly (double "dylib.dylib").