Skip to content

Conversation

SnirDecartAI
Copy link
Contributor

Hey 👋

Currently the project builds 6 native libraries:

  • webrtc-java.dll for Windows x86_64 in webrtc-java-$VERSION-windows-x86_64.jar
  • libwebrtc-java.so for Linux x86_64 in webrtc-java-$VERSION-linux-x86_64.jar
  • libwebrtc-java.so for Linux aarch32 in webrtc-java-$VERSION-linux-aarch32.jar
  • libwebrtc-java.so for Linux aarch64 in webrtc-java-$VERSION-linux-aarch64.jar
  • libwebrtc-java.dylib for macOS x86_64 in webrtc-java-$VERSION-macos-x86_64.jar
  • libwebrtc-java.dylib for macOS aarch64 in webrtc-java-$VERSION-macos-aarch64.jar

For a cross-platform app that doesn't ship a different package per platform, all 6 of these jars might be in the classpath together.
This means that NativeLoader can load the wrong one, because it just looks for a filename with an extension matching the current platform.

I suggest appending the OS and architecture to the filename:

  • webrtc-java-windows-x86_64.dll for Windows x86_64 in webrtc-java-$VERSION-windows-x86_64.jar
  • libwebrtc-java-linux-x86_64.so for Linux x86_64 in webrtc-java-$VERSION-linux-x86_64.jar
  • libwebrtc-java-linux-aarch32.so for Linux aarch32 in webrtc-java-$VERSION-linux-aarch32.jar
  • libwebrtc-java-linux-aarch64.so for Linux aarch64 in webrtc-java-$VERSION-linux-aarch64.jar
  • libwebrtc-java-macos-x86_64.dylib for macOS x86_64 in webrtc-java-$VERSION-macos-x86_64.jar
  • libwebrtc-java-macos-aarch64.dylib for macOS aarch64 in webrtc-java-$VERSION-macos-aarch64.jar

Then we can lookup with webrtc-java-$OS-$ARCH, and all 6 jars can live together in the classpath - I tested it and it works.

What do you think?
Thanks

Copy link
Owner

@devopvoid devopvoid left a comment

Choose a reason for hiding this comment

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

Some minor improvements to be more robust.

fix: make native platform detection more robust

Co-authored-by: Alex Andres <58339654+devopvoid@users.noreply.github.com>
@devopvoid devopvoid merged commit 52b7241 into devopvoid:main Aug 15, 2025
1 check passed
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