0

I am doing my first attempts to use libpd with java. The IDE I am using is NetBeans. For libpd I am using these binary builds for Java. When running the code I get a java.lang.UnsatisfiedLinkError. At some poit it says:

Can't find dependent libraries

I've seen a similar question answered for Android, but not for Java.

EDIT: this is the full error-message:

Exception in thread "main" java.lang.UnsatisfiedLinkError: C:\Users\jaiserpe\AppData\Local\Temp\pdnative7141399841793639340.dll: Can't find dependent libraries at java.lang.ClassLoader$NativeLibrary.load(Native Method) at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1938) at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1821) at java.lang.Runtime.load0(Runtime.java:809) at java.lang.System.load(System.java:1086) at org.puredata.core.NativeLoader.loadLibraryFromJar(NativeLoader.java:121) at org.puredata.core.NativeLoader.loadLibrary(NativeLoader.java:97) at org.puredata.core.PdBase.(PdBase.java:59) at holamundo.HolaMundo.main(HolaMundo.java:26) C:\Users\jaiserpe\AppData\Local\NetBeans\Cache\8.1\executor-snippets\run.xml:53: Java returned: 1 BUILD FAILED (total time: 0 seconds)

HaveNoDisplayName
  • 8,291
  • 106
  • 37
  • 47
jaiserpe
  • 335
  • 3
  • 5
  • 14
  • It could be that there's mingw runtime DLLs missing. Those libraries are very old. You might be best off compiling them yourself again. – Wivlaro Feb 06 '16 at 19:45

2 Answers2

1

It seems that you are missing dependent libraries of libpd.

You can use DepndencyWalker to inspect what is missing.

If you think that all required libraries are there, make sure that they are visible to JVM for loading. More info about loading DLLs on Windows here.

rkosegi
  • 14,165
  • 5
  • 50
  • 83
  • A book about libpd says: "The complete absence of dependencies means that you can build libpd as soon as you have a C compiler". But, once it is built it seems there are dependencies in run time... – jaiserpe Feb 04 '16 at 13:59
  • It seems that JVM can't load dependencies, based on your error, regardless of what book is saying. Did you tryied depndency walker before commenting this? It's more reliable than book. – rkosegi Feb 04 '16 at 14:01
  • Using DepndencyWalker I have analysed the dll that appears in the error, which is a dll that is generated in the Temp folder each time I run my Java program. The analysis says: "Error: At least one required implicit or forwarded dependency was not found." – jaiserpe Feb 04 '16 at 14:23
  • pore specifically, 9 dll are missing – jaiserpe Feb 04 '16 at 14:44
1

Those DLLs were built with MinGW. Using the technique here http://comments.gmane.org/gmane.comp.gnu.mingw.user/38834 the required DLLs for those builds are:

$ x86_64-w64-mingw32-objdump --all-headers java-build/org/puredata/core/natives/windows/x86_64/pthreadGC2.dll | grep 'DLL Name'
    DLL Name: KERNEL32.dll
    DLL Name: msvcrt.dll
    DLL Name: WS2_32.dll
$ x86_64-w64-mingw32-objdump --all-headers java-build/org/puredata/core/natives/windows/x86_64/pdnative.dll | grep 'DLL Name'
    DLL Name: ADVAPI32.dll
    DLL Name: KERNEL32.dll
    DLL Name: msvcrt.dll
    DLL Name: msvcrt.dll
    DLL Name: pthreadGC2.dll
    DLL Name: WS2_32.dll
$ x86_64-w64-mingw32-objdump --all-headers java-build/org/puredata/core/natives/windows/x86/pdnative.dll | grep 'DLL Name'
    DLL Name: ADVAPI32.dll
    DLL Name: KERNEL32.dll
    DLL Name: msvcrt.dll
    DLL Name: msvcrt.dll
    DLL Name: pthreadGC2.dll
    DLL Name: WS2_32.dll
$ x86_64-w64-mingw32-objdump --all-headers java-build/org/puredata/core/natives/windows/x86/pthreadGC2.dll | grep 'DLL Name'
    DLL Name: KERNEL32.dll
    DLL Name: msvcrt.dll
    DLL Name: WS2_32.dll

If all those dependencies are no longer found on the system, or just out of date, perhaps recompiling the DLLs would work for you.

Good luck.

Wivlaro
  • 1,455
  • 1
  • 12
  • 18