Skip to content

Allow overriding prefix for native deps on a per-jar basis #898

@brandonbloom

Description

@brandonbloom

I'm trying to use LWJGL with Clojure, but am encountering some difficulty with the native libraries.

Two dependencies are required:

[org.lwjgl.lwjgl/lwjgl "2.8.5"]
[org.lwjgl.lwjgl/lwjgl-platform "2.8.5"]])

However, the lwjgl-platform dependency failed to resolve until I manually specified a classifier:

[org.lwjgl.lwjgl/lwjgl-platform "2.8.5" :classifier "natives-osx"]

That breaks the portability of my project.clj file, but that's probably a separate ticket.

The lwjgl-platform resources are available here on maven central

When I try to use LWJGL like this, I get this error:
UnsatisfiedLinkError no lwjgl in java.library.path

I did some digging and discovered that the native path is only added to your java.library.path if such a native platform directory exists. Upon further digging, it appears that no native libraries were being extracted because of this condition in extract-native-deps and the fact that the libraries in the jar are not nested in a native directory:

$ pwd
/Users/brandon/.m2/repository/org/lwjgl/lwjgl/lwjgl-platform/2.8.5
$ jar -tf lwjgl-platform-2.8.5-natives-osx.jar     
META-INF/
META-INF/MANIFEST.MF
liblwjgl.jnilib
openal.dylib

If I manually copy these files into target/native/macosx/x86_64, then LWJGL works as advertised!

I don't know how common it is have native libraries without a native/ directory, but I found at least one other example: jinput.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions