Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Leiningen native paths issue (for LWJGL, maybe others) #1961

Closed
noncom opened this issue Aug 21, 2015 · 1 comment
Closed

Leiningen native paths issue (for LWJGL, maybe others) #1961

noncom opened this issue Aug 21, 2015 · 1 comment
Assignees
Labels
Milestone

Comments

@noncom
Copy link

noncom commented Aug 21, 2015

UPDATE: Okay, I am seeing this issue is not getting picked up. Probably because it needs to be reformulated. The original message will be available under the tearline.

My project depends on LWJGL and it involves working with the LWJGL native libraries. I have found that Leiningen is searching for the native libs in the project/target/native/windows/x86_64 directory. However, in reality the native libs get extracted into project/target/native/windows. If I manually copy the dlls from the latter to the former, then the project, launched with Leiningen can see the dlls and use them.

Apparently this is an issue in how Leiningen manages the paths and needs to be corrected.

Below is a link to an example project. The issue was successfully reproduced on Windows and Mac. Please also read the reproduction instruction because it describes precise steps of reproducing the problem. How the problem manifests itself depends on the sequence of actions taken.

REPRODUCTION INSTRUCTION

_I. The Original Failure_

See how Leiningen fails to find the dlls it extracts.

  • remove the target and bin directories
  • lein clean
  • add :native-path "target/native/native/windows" to the project.clj
  • lein repl
  • (require 'test-natives.core)
  • It fails to find the dep

If you go to the target dir, there's a strange thing. The dlls are lying in this actual location: target\native\native\windows\native\windows\..this looks very wrong...

_II. The original guilt of the :native-path_

This will prove that the :native-path parameter does not behave correctly:

  • manually remove the target and bin directories
  • lein clean
  • lein repl
  • exit lein repl back to command line
  • add :native-path "target/native/native/windows" to the project.clj
  • lein repl
  • (require 'test-natives.core)
  • It works.

Somehow specifying :natives-path before the first creation of target wreaks havoc on the directory structure.

_III. The Final Disclosure_

How to understand what is going on:

  • manually remove the target and bin directories
  • lein clean
  • add :native-path "target/native/a/b/c/d/native/windows" to the project.clj
  • lein repl
  • (require 'test-natives.core) fail!
  • exit lein repl back to command line
  • examine the directory structure and find dlls at target\native\a\b\c\d\native\windows\native\windows\ - the actual path differs from the one specified in project.clj by having an additional \native\windows\ at the end. alright.
  • change :native-path "target/native/a/b/c/d/native/windows" to :native-path "target/native/a/b/c/d/native/windows/native/windows" the project.clj
  • lein repl
  • (require 'test-natives.core)
  • It works

Obviously this is a bug in Leiningen. It treats the :native-paths parameter differently in cases of the first and subsequent runs.

-------------- tearline --------------

Working with LWJGL in Leiningen, I have stepped into some strange errors on about how Leiningen works with native libraries paths. As I work through CounterClockWise, I first reported the problem to its issue tracker, but after some research it became evident that the problem is of Leiningen origin.

As the description of the problem is rather extensive, I think I won't copy-paste it here and instead provide the description via link to the CCW issue.

@hypirion hypirion added this to the 2.6.0 milestone Nov 7, 2015
@hypirion hypirion added the bug label Jan 18, 2016
@hypirion hypirion self-assigned this Jan 23, 2016
@hypirion
Copy link
Collaborator

Alright, this is inconsistent because the native path is not cleaned up if :native-path has been changed. Neither does it clean up if the native dependencies themselves change. I'm working on a fix for this, which should be provided with 2.6.0.

It seems like the native paths themselves works as intended for native dependencies (mostly because of what's discussed over at #898 (comment)), but as outlined in https://github.com/rogerallen/hello_lwjgl it seems like lwjgl has a very strange packaging format that cannot be extracted by Leiningen itself.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants