java-native-access / java-native-access/jna

Add support for libraries based on C-standard library musl

Open
#1,694 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Java
Stars
8.9k
Forks
1.7k
PR merge metrics
No merged PRs in 30d

Description

If there are 2 versions of a library for linux-x86-64, one for glibc and one for musl then I can't add both to the classpath. A typical Linux distribution with musl is the popular Alpine Linux.

This result then to the typical error:

java.lang.UnsatisfiedLinkError: Error loading shared library libgcc_s.so.1: No such file or directory (needed by /home/cowork/.cache/JNA/temp/jna11787778965949199194.tmp)
	at com.sun.jna.Native.open(Native Method)
	at com.sun.jna.NativeLibrary.loadLibrary(NativeLibrary.java:300)
	at com.sun.jna.NativeLibrary.getInstance(NativeLibrary.java:481)
	at com.sun.jna.Library$Handler.<init>(Library.java:197)
	at com.sun.jna.Native.load(Native.java:618)

Please add support for both variants on loading from classpath. Or are there any other workarounds?

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the loading path in NativeLibrary.java and Native.java, using the stack trace as the entry point. Reproduce a classpath containing glibc and musl variants on Alpine Linux, then verify that both variants can be selected and loaded without the reported UnsatisfiedLinkError.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, linux
Domain
operating-systems
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.