Native library not found after upgrade to leiningen 2.0

338 views
Skip to first unread message

Dave Snowdon

unread,
Mar 21, 2013, 6:55:35 PM3/21/13
to clo...@googlegroups.com
I just upgraded from leiningen version 1.5.2 to 2.0.0 and noticed that the native library path no longer seems to be set correctly.

Here is my project file:

(defproject naojure "0.1.0-SNAPSHOT"
  :description "Clojure wrapper for Aldebaran Robotics java NAOQI binding. Depends on the Aldebaran jar file being installed in a local repo and the shared library being in the dynamic library load path"
  :url "https://github.com/davesnowdon/naojure"
  :repositories {"local" ~(str (.toURI (java.io.File. "maven_repository")))}
  :native-path "native"
  :dependencies [[org.clojure/clojure "1.4.0"] [com.aldebaran/jnaoqi "1.14.0"]])

The native library is in a folder "native" at the top-level of the project and the corresponding jar in a local repo also contained within the leiningen project.

If I run lein1 repl (I renamed the old leiningen script before upgrading) then I can create instances of native classes from the repl, If I run lein repl (leiningen 2.0.0) then I get the following error:

CompilerException java.lang.UnsatisfiedLinkError: no jnaoqi in java.library.path, compiling:(NO_SOURCE_PATH:1)

Here are the exact values reported by lein version (running on Linux - Fedora Core 14)
Leiningen 1.5.2 on Java 1.6.0_20 OpenJDK 64-Bit Server VM
&
Leiningen 2.0.0 on Java 1.6.0_20 OpenJDK 64-Bit Server VM

I've looked online for issues related to leiningen and native path handling but the bugs I found all related to leiningen 1 and have been supposedly fixed.

Can anyone suggest why the native library is not being located?

thanks

Dave

xumingmingv

unread,
Mar 21, 2013, 9:17:27 PM3/21/13
to clo...@googlegroups.com, xumingmingv
--
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clo...@googlegroups.com
Note that posts from new members are moderated - please be patient with your first post.
To unsubscribe from this group, send email to
clojure+u...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
---
You received this message because you are subscribed to the Google Groups "Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email to clojure+u...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Karsten Schmidt

unread,
Mar 22, 2013, 5:13:16 AM3/22/13
to clo...@googlegroups.com, xumingmingv
You can see the actual path used by doing this in the repl:
(System/getProperty "java.library.path")

I found it best to wrap native libs in a jar with this internal structure:

/META-INF/MANIFEST.MF
/native/linux/x86
/native/linux/x86_64
/native/macosx/x86
/native/macosx/x86_64
/native/windows/x86
/native/windows/x86_64

Then deploy the jar to your repo and refer to it as normal from
project.clj, no need to set native path manually...
--
Karsten Schmidt
http://postspectacular.com | http://toxiclibs.org | http://toxi.co.uk

Dave Snowdon

unread,
Mar 23, 2013, 12:46:45 PM3/23/13
to clo...@googlegroups.com, xumingmingv, in...@toxi.co.uk
Thanks James, Karsten

That works thanks! 

I then found that I needed to use "mvn deploy:deploy-file" to get the jar into my local repo instead of "mvn install:install-file" otherwise maven didn't create the necessary supporting files and I got a "no supported algorithms found" error when I ran "lein deps"

cheers

Dave
Reply all
Reply to author
Forward
0 new messages