To register and login, use your Google, Twitter, Facebook, LinkedIn, or OpenID credentials.

This is allowing us to stop most spam registrations. We've deleted most of the spam accounts that got through, and we're closely watching for more.

Can't load pdnative

krisckrisc Posts: 11
edited November -1 in Pd Everywhere
Hi, I'm new to libpd.  I've been reading through the samples.  I got the C sample to compile and run, but I'm having trouble with the Java sample.  It compiles, but when I run it I get this error:

Exception in thread "main" java.lang.UnsatisfiedLinkError: no pdnative in java.library.path at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1681) at java.lang.Runtime.loadLibrary0(Runtime.java:840) at java.lang.System.loadLibrary(System.java:1047) at org.puredata.core.PdBase.(PdBase.java:58) at com.noisepages.nettoyeur.libpd.sample.JavaSoundThread.(JavaSoundThread.java:44) at com.noisepages.nettoyeur.libpd.sample.JavaSoundSample.main(JavaSoundSample.java:24)

I am running this from the sample/ directory of libpd, and I have included the java/ directory of libpd to my classpath.  Is there something I'm missing?

Comments

  • pbrinkmannpbrinkmann Posts: 685 ✭✭
    First, you need to build libpdnative by running make in the libpd directory. Second, the libpd directory contains a fully configured Eclipse project, and if you import that one into Eclipse, you'll be able to run the tests and sample code.
  • krisckrisc Posts: 11
    Thanks, I got it the tests to run in Eclipse.

    Now, I am trying to import libpd in a Clojure project in lein and am having the same problem.  I can import the PdBase class, but again cannot load pdnative.

    Has anyone used libpd with Clojure?  
  • pbrinkmannpbrinkmann Posts: 685 ✭✭
    Just make sure that java.library.path includes the path to libpdnative.so and things should work with Clojure, too.

    That said, though, I'm not aware of anyone using libpd with Clojure, so you're breaking new ground here. Feel free to document your findings in the libpd wiki at GitHub when you figure it out.
  • krisckrisc Posts: 11
    Getting a little closer...

    My java.library.path includes the path to libpdnative.so, which I put in a directory called "native/" in the project root.  I confirmed this with a println of  System.getProperty("java.library.path") which results in:

    "native/"

    as expected.  But it still won't load it when I load the namespace that imports PdBase:

    UnsatisfiedLinkError no pdnative in java.library.path  java.lang.ClassLoader.loadLibrary (ClassLoader.java:1681)
    Looking at PdBase.java I see that it opens the library by calling

    System.loadLibrary("pdnative");

    Maybe it's supposed to be that way, but I tried loading "libpdnative.so" instead but still get an error:

    UnsatisfiedLinkError no libpdnative.so in java.library.path  java.lang.ClassLoader.loadLibrary (ClassLoader.java:1681)

    Any ideas?
  • pbrinkmannpbrinkmann Posts: 685 ✭✭
    Yes, System.loadLibrary("pdnative") is correct; Java will automatically complete that to the proper file name for your operating system, e.g., libpdnative.so for Linux.

    Anyway, your library path is a relative path, and so the question is, relative to what? I would replace that by the absolute path and see what happens.
  • krisckrisc Posts: 11
    The absolute path gives me the exact same error.
  • krisckrisc Posts: 11
    Nevermind!  The relative path works, I just had an extra set of double quotes.  But now I'm getting a new error:

    UnsatisfiedLinkError PdBase.initialize()V  PdBase.initialize (:-2)
  • krisckrisc Posts: 11
    Nevermind, again! (sorry for wasting messages :P)  But I got it.  It's all good and loaded.  Now I'm gonna try to port the JavaSoundSample as a Clojure project.
  • krisckrisc Posts: 11
    Cool, I got it to work!  The source for the JavaSoundThread class remains a .java file though.  It's a lein project, not Eclipse, but can this be something to include in the samples directory in the repository?
  • I'm so incredibly interested in what you're doing here.

    Clojure and the JVM are amazing. pdlib is amazing, as are Overtone and Quil. The integration of all these things makes for so many possibilities on the JVM!

    Can you document the process that got things working here? I am stuck on the UnsatisfiedLinkError PdBase.initialize()V PdBase.initialize (:-2) step. This error occurs both in Clojure and in Processing, even with the seemingly out of place V at the end of the function call reference.

    If anyone has any insight into that error, or if you finished your JavaSoundSample port in Clojure, I'd love to see it/hear it. :)

    Thanks!

  • krisckrisc Posts: 11

    Oh wow, I haven't touched this project in months and when I randomly decided to check back on this forum, someone asked about it not much longer than a week ago...

    Anyhow, I put my JavaSoundSample port in my fork of libpd on Github (which I haven't updated in months...):

    https://github.com/krisc/libpd/tree/master/samples/clojure/JavaSoundSample

    The README outlines the process to get it to work. If you're interested go ahead clone it and let me know if it still works.

  • giovannibedettigiovannibedetti Posts: 1

    Hi, I have the same error:

    Exception in thread "main" java.lang.UnsatisfiedLinkError: org.puredata.core.PdBase.initialize()V at org.puredata.core.PdBase.initialize(Native Method) at org.puredata.core.PdBase.(PdBase.java:79) at com.noisepages.nettoyeour.libpd.sample.JavaSoundThread.(JavaSoundThread.java:44) at com.noisepages.nettoyeour.libpd.sample.JavaSoundSample.main(JavaSoundSample.java:24)

    What's wrong? I have the libpdnative.dylib in the libs folder, using Eclipse project with java build 1.7.0_25-b15 on Mac OS X 10.8.4

    Thanx!

Sign In or Register to comment.