signalapp / libsignal

Home to the Signal Protocol as well as other cryptographic primitives which make Signal possible.
GNU Affero General Public License v3.0
3.63k stars 420 forks source link

Can't load libsignal_jni in windows env #484

Closed ClementBareth closed 1 year ago

ClementBareth commented 2 years ago

java.lang.UnsatisfiedLinkError: ...\AppData\Local\Temp\resource16312657568160574112.so: Can't load this .dll (machine code=0x6666) on a AMD 64-bit platform

Looking at the code, it looks like the extension for windows (.dll) is not correct

private static void loadLibrary() {
    try {
      String  osName    = System.getProperty("os.name").toLowerCase(java.util.Locale.ROOT);
      boolean isMacOs   = osName.startsWith("mac os");
      String  extension = isMacOs ? ".dylib" : ".so";

      try (InputStream in = Native.class.getResourceAsStream("/libsignal_jni" + extension)) {
        if (in != null) {
          copyToTempFileAndLoad(in, extension);
        } else {
          System.loadLibrary("signal_jni");
        }
      }
    } catch (Exception e) {
      throw new RuntimeException(e);
    }
  }
jrose-signal commented 1 year ago

Fixed in v0.22.0