Skip to content

AIX libjnidispatch is wrong format #1066

@Taywee

Description

@Taywee

Provide complete information about the problem

  1. Version of JNA and related jars

jna and jna-platform are 5.2.0

  1. Version and vendor of the java virtual machine

OpenJDK 1.8.0_202 with HotspotVM

  1. Operating system

AIX 7.1 64-bit

  1. System architecture (CPU type, bitness of the JVM)

PowerPC 64

  1. Complete description of the problem

When I try to use JNA on AIX 64-bit (though it will probably work as well the same way in 32-bit, judging by the library format), I get this exception (my code paths truncated at the end):

Exception in thread "main" java.lang.UnsatisfiedLinkError: Native library (com/sun/jna/aix-ppc64/libjnidispatch.so) not found in resource path ([file:/opt/sysshepjr/agent/sysshepjr.jar])
        at com.sun.jna.Native.loadNativeDispatchLibraryFromClasspath(Native.java:1026)
        at com.sun.jna.Native.loadNativeDispatchLibrary(Native.java:988)
        at com.sun.jna.Native.<clinit>(Native.java:195)
        at com.sun.jna.platform.unix.LibC.<clinit>(LibC.java:35)

Looking at the library stated, it is in there in .a format. Like many Linux/Unix systems, AIX allows linking against .so shared objects and .a static libraries, but it also allows .a archives to store .so shared objects to allow "smart switching" based on bitness (allowing one archive to have both the 32-bit and 64-bit libraries). The library that is in the release is named .a, but it is not an ar archive, it is a shared object renamed to .a (including the 32-bit version). There are two obvious options for fixing this:

  1. Rename the .a back to .so for both 32-bit and 64-bit, allowing the loader to correctly find it. This is preferable, because JNA already distinguishes based on path the bit size.
  2. Rename the .a back to .so for both, and pack them in a .a archive, and correctly refer to the archive by the AIX contained member style. This makes the library more in the style of typical AIX libraries, but doesn't really bring any advantages to the table.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions