I am writing a Kotlin Multiplatform wrapper for google/leveldb. Links for context:
For the Kotlin/JVM and Android part I am using JNA. The JVM implementation is shared between Android and desktop using the Gradle KMP plugin. The tests are also common. All tests passes (Linux x64, macOs x64 arm64, Android x64), but for Windows x64.
In particular, the error in question is (sorry for the Italian):
UnsatisfiedLinkError: The specified procedure could not be found
INFORMAZIONI: Found library resource at jar:file:/C:/Users/lamba/IdeaProjects/kotlin-leveldb/build/libs/kotlin-leveldb-jvm-1.0-SNAPSHOT.jar!/win32-x86-64/leveldb.dll
nov 13, 2024 11:43:04 PM com.sun.jna.Native extractFromResourcePath
INFORMAZIONI: Extracting library to C:\Users\lamba\AppData\Local\Temp\jna-102737879\jna900937333738511061.dll
Exception in thread "main" java.lang.UnsatisfiedLinkError: Impossibile trovare la procedura specificata.
Not another detail.
You can check what is in the .so on you own here.
I am not really an expert in native compilations, and at this point I am really out of ideas. The strange part is that on other OS/archs it works perfectly, you can see it in the tests.
I am out of ideas on how to fix this one. Has someone encountered a similar issue?
Of course I made many attempts to try to figure out what was going on:
nm -g .\leveldb.dll | findstr "leveldb_"
: all symbols are there, perfect names, no magnlingThe issue was library libwinpthread-1.dll
was missing in the system at runtime in the native code. My solution was to link statically libwinpthread
and all now works fine!