在Leiningen / Clojure中使用lwjgl [英] Using lwjgl in Leiningen/Clojure

查看:186
本文介绍了在Leiningen / Clojure中使用lwjgl的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

解决方案



 (1)(println(。System getPropertyjava.library.path))

这给出了一个java寻找原生扩展名的地方列表。



然后,我把lwjgl原生扩展,并把它们放在那里。



没有为我工作的东西(可能是因为我错误地使用) h2>

 (*)设置:native-path 
(*)设置:native-dependencies



问题



我的设置:

 (lein deps; echo=====; cat project.clj; echo=====; cat src / main.clj; echo =====; lein repl)&> log 

log的内容

 将10个文件复制到/ Volumes / ramdisk / fail / lib 
=====
(defproject
mincase0.0.1
:dependencies [[org.clojure / clojure1.4.0]
[org.lwjgl.lwjgl / lwjgl2.8.2]]
:repositories {local/ Users / z / maven_repo}
:jvm-opts [-Xms4g-Xmx4g]
:repl-init main


=====
(ns main
(:import org.lwjgl.opengl.Display))
=====
REPL started;服务器侦听localhost端口31235
unsatisfiedLinkError否lwjgl在java.library.path java.lang.ClassLoader.loadLibrary(ClassLoader.java:1860)
clojure.core =>



注意 - 我已经做了一个lein deps,所以lwjgl库已经被拉入maven。我不明白是什么:

 (*)如何从Clojure访问lwjgl? 
(*)更重要的是,我如何调试哪个步骤这整个东西出了问题?

$ find lib

  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- -osx.jar
lib / lwjgl-platform-2.8.2-natives-windows.jar

所以看起来lwjgl已经被拉入了。



我应该尝试找出哪个步骤我错了?



谢谢!

解决方案

看起来像您的 LD_LIBRARY_PATH 。您是否包含正确的 .dll .so 文件?



您可能需要向 project.clj 添加:native-dependencies [[lwjgl2.8.2]] code>。



或者,您可以尝试从shell设置正确的值:

  export LD_LIBRARY_PATH = / home / username / lwjgl-2.8.2 / native / linux / 


Solution

(1) (println (. System getProperty "java.library.path"))

This gives me a list of places java looks for native extensions.

Then, I took the lwjgl native extensions, and put them there.

Things that didn't work for me (probably because I used them incorrectly)

(*) setting :native-path
(*) setting :native-dependencies

Problem

My setup:

(lein deps; echo "====="; cat project.clj; echo "====="; cat src/main.clj; echo "====="; lein repl) &> log

contents of "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=> 

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?

$ find lib

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

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?

Thanks!

解决方案

Looks like a problem with your LD_LIBRARY_PATH. Are you including the correct .dll or .so files?

You probably need to add something like :native-dependencies [[lwjgl "2.8.2"]] to your project.clj.

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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆