Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Error looking up function from current process on Linux

Open
#1,698 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
java, linux

Research direction

Reproduce the Linux x64 case with Java 25, then trace NativeLibrary.getFunction and Function from the reported stack to inspect current-process symbol lookup. Compare Native.load(null, ZstdJna.class) with the explicit library workaround and the Java Foreign Function & Memory API. Done means the reported ZSTD_createDStream lookup succeeds without explicitly loading the shared library.

Written by the indexing model from the issue text.

Description

feature request
Description

JNA seems to be unable to look up functions from the current process, specifically on Linux x64, while the same code works fine on Windows x64 and macOS aarch64. The documentation says JNA should look into the current process if null is passed to Native.load.

Additional details
  • The Foreign Function & Memory API from Java 22 finds all functions and all tests succeed

  • nm seems to indicate the function is in the shared library, and isn't mangled

    Image
  • The only workaround is to let JNA load the shared library by Native.load("/path/to/libzstd.so", ZstdJna.class)

Repro code

Using the Linux x64 binary found at https://github.com/freya022/discord-zstd-java/actions/runs/18886251057

public interface ZstdJna extends Library {
    ZstdJna INSTANCE = Native.load(null, ZstdJna.class);

    Pointer ZSTD_createDStream();
}
public class Repro {
    public static void main(String[] args) {
        System.load("/path/to/libzstd.so");

        ZstdJna.INSTANCE // Fine
            .ZSTD_createDStream(); // Fails
    }
}
Environment

Java Version: OpenJDK 25+36
JNA Version: 5.18.1 (also tested 4.4.0)
Operating System: Ubuntu 24.04 GitHub Actions runner (image details), also tested on a Kubuntu VM
C/C++ Compiler: GCC 13.3.0

Error
java.lang.UnsatisfiedLinkError: Error looking up function 'ZSTD_createDStream': /usr/lib/jvm/java-25-openjdk-amd64/bin/java: undefined symbol: ZSTD_createDStream
	at com.sun.jna.Function.<init>(Function.java:255)
	at com.sun.jna.NativeLibrary.getFunction(NativeLibrary.java:618)
	at com.sun.jna.NativeLibrary.getFunction(NativeLibrary.java:594)
	at com.sun.jna.NativeLibrary.getFunction(NativeLibrary.java:580)
	at com.sun.jna.Library$Handler.invoke(Library.java:248)
	at jdk.proxy3/jdk.proxy3.$Proxy13.ZSTD_createDStream(Unknown Source)
	at dev.freya02.discord.zstd.jna.ZstdJNATest.test_decompression(ZstdJNATest.java:36)
	at java.base/java.lang.reflect.Method.invoke(Method.java:565)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1604)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1604)

Workflow details if necessary: https://github.com/freya022/discord-zstd-java/actions/runs/18891473842

Dominant language
Java
Stars
8.9k
Forks
1.7k
Avg merge
1d 13h
Merged PRs (30d)
1

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

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.

More from java-native-access/jna

All issues in java-native-access/jna

Similar issues

More Java issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.