在 Leiningen/Clojure 中使用 lwjgl [英] Using lwjgl in Leiningen/Clojure
问题描述
(1) (println (. System getProperty "java.library.path"))
这给了我一个 java 寻找本机扩展的地方的列表.
This gives me a list of places java looks for native extensions.
然后,我将 lwjgl 原生扩展放在那里.
Then, I took the lwjgl native extensions, and put them there.
(*) setting :native-path
(*) setting :native-dependencies
问题
我的设置:
(lein deps; echo "====="; cat project.clj; echo "====="; cat src/main.clj; echo "====="; lein repl) &> log
日志"的内容
Copying 10 files to /Volumes/ramdisk/fail/lib
=====
(defproject
mincase "0.0.1"
:dependencies [[org.clojure/clojure "1.4.0"]
[org.lwjgl.lwjgl/lwjgl "2.8.2"] ]
:repositories {"local" "/Users/x/z/maven_repo"}
:jvm-opts ["-Xms4g" "-Xmx4g"]
:repl-init main
)
=====
(ns main
(:import org.lwjgl.opengl.Display))
=====
REPL started; server listening on localhost port 31235
UnsatisfiedLinkError no lwjgl in java.library.path java.lang.ClassLoader.loadLibrary (ClassLoader.java:1860)
clojure.core=>
注意——我已经做了一个lein deps",所以 lwjgl 库已经被拉进了 maven.我不明白的是:
Note -- I had already done a "lein deps", so the lwjgl library has been pulled into maven. What I don't understand are:
(*) how do I get access to lwjgl from Clojure?
(*) more importantly, how do I debug which step this whole thing has gone wrong at?
$ 查找库
lib
lib/clojure-1.4.0.jar
lib/jinput-2.0.5.jar
lib/jinput-platform-2.0.5-natives-linux.jar
lib/jinput-platform-2.0.5-natives-osx.jar
lib/jinput-platform-2.0.5-natives-windows.jar
lib/jutils-1.0.0.jar
lib/lwjgl-2.8.2.jar
lib/lwjgl-platform-2.8.2-natives-linux.jar
lib/lwjgl-platform-2.8.2-natives-osx.jar
lib/lwjgl-platform-2.8.2-natives-windows.jar
看来 lwjgl 已经被拉进来了.
So it appears that lwjgl has been pulled in.
我应该尝试哪些步骤来找出我出错的步骤?
What are the steps I should try to figure out which step I went wrong on?
谢谢!
推荐答案
您的 LD_LIBRARY_PATH
看起来有问题.您是否包含正确的 .dll
或 .so
文件?
Looks like a problem with your LD_LIBRARY_PATH
. Are you including the correct .dll
or .so
files?
您可能需要在 project.clj
中添加类似 :native-dependencies [[lwjgl "2.8.2"]]
的内容.
You probably need to add something like :native-dependencies [[lwjgl "2.8.2"]]
to your project.clj
.
或者,您可以尝试从 shell 设置正确的值:
Alternatively, you could try setting the right value from your shell:
export LD_LIBRARY_PATH=/home/username/lwjgl-2.8.2/native/linux/
这篇关于在 Leiningen/Clojure 中使用 lwjgl的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!