[Portaudio] Problems with PortAudio binding in Java on MacOS 10.5.4 (Macbook 2.4 GHz - Core 2 Duo)
Joscha Rieber
joscharieber at googlemail.com
Tue Aug 26 15:27:56 EDT 2008
Hi!
First, we downloaded the current version of PortAudio from http://www.portaudio.com/
and the current version of the PortAudio binding from http://code.google.com/p/jpab/
.
Then we downloaded the current version of the source of jpab via
TortoiseSVN.
Now we compiled PortAudio via GCC on our Mac. To do this, we followed
the instructions given at the PortAudio Wiki http://www.portaudio.com/trac/wiki/TutorialDir/Compile/MacintoshCoreAudio
.
The Building process was successful and inside of the folder
"libs/.libs" are several compiled files.
JPAB c source compiling...
To use JPAB (Java PortAudio Binding) in our Java Application, we had
to compile it, too. So we decided to compile it linking against the
static library file "libportaudio.a", which has been created during
the make process before (We tried several other files, like
"libportaudio.2.0.0.dylib", too).
To do so we used following command:
gcc -I"/System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/
Headers" -I"/Volumes/Daten/Java/.../jpab/Source/c/includes" -I"/
Volumes/Daten/Java/.../jpab/Source/c/library" -L"/Volumes/Daten/
Java/.../jpab/Source/c/library" -lportaudio -framework CoreAudio -
framework AudioToolbox -framework AudioUnit -framework CoreServices -
dynamiclib -framework Appkit -Wall -o libjpab.jnilib jpab.c
The folder "/Volumes/Daten/Java/.../jpab/Source/c/library" just
includes the file "libportaudio.a", so the command -lportaudio links
to this file.
After all that we wrote a little Java application with Netbeans. It's
very simple and looks like this:
package unibonn.agclausen.portaudiotest;
import org.jpab.PortAudio;
import org.jpab.PortAudioException;
public class Main {
public static void main(String[] args) throws PortAudioException {
PortAudio.initialize();
System.out.println(PortAudio.getVersion());
PortAudio.terminate();
}
}
Our project contains the JAR-packages "jpab.jar" and "trove-mini.jar".
JPAB needs the compiled PortAudio library, so we put the file
"libportaudio.2.0.0.dylib" into a folder in which our Java application
can find it. When running, jpab includes the library "portaudio_x86",
we think, so we renamed that .dylib file into
"libportaudio_x86.jnilib". Now it should be found by jpab. It is all
contained in the same folder. We weren't sure about the name, so we
copied the file and named it "libportaudio_x86.dylib", too. Also we
tried several other names like "libportaudio.jnilib".
Unfortunately, we get the following error:
Exception in thread "main" java.lang.UnsatisfiedLinkError: /Volumes/
Daten/Java/PortAudioTest/test/libjpab.jnilib:
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1822)
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1739)
at java.lang.Runtime.loadLibrary0(Runtime.java:823)
at java.lang.System.loadLibrary(System.java:1030)
at unibonn.agclausen.portaudiotest.Main.(Main.java:19)
We created a similar program on our Windows XP system and it works
just fine using the precompiled .DLL's included in the JPAB package.
Thanks for your attention.
regards,
Joscha Rieber
More information about the Portaudio
mailing list