Skip to Main Content

Java HotSpot Virtual Machine

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

can't load a library that depends on another

843829Oct 24 2007 — edited Oct 26 2007
I built a library and it loaded perfectly (just for testing).

Now, my library is supposed use ALSA's API.

Now, I get to compile my library, just like before, but now I can't load the library. I get a UnsatisfiedLinkError. The message is a little cryptic: Can't load IA 32-bit .so on a IA 32-bit platform

It seems like when my library is being loaded, the alsa library on which it depends (libalsa09.so) can't be loaded. How can I avoid this? I added both my library's and alsa's directories to LD_LIBRARY_PATH, but I just can't get it done.

Here's what happens:
$ LD_LIBRARY_PATH=/usr/lib/ao/plugins-2:lib java -cp bin wmagic.basic.Wave 440
Can't load library wmagic_alsa
java.lang.UnsatisfiedLinkError: /home/antoranz/eclipse/europa/workspace/wmagic/lib/libwmagic_alsa.so: Can't load IA 32-bit .so on a IA 32-bit platform
        at java.lang.ClassLoader$NativeLibrary.load(Native Method)
        at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1751)
        at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1676)
        at java.lang.Runtime.loadLibrary0(Runtime.java:822)
        at java.lang.System.loadLibrary(System.java:993)
        at wmagic.basic.SoundOutput.initializeAlsa(SoundOutput.java:87)
        at wmagic.basic.SoundOutput.<init>(SoundOutput.java:29)
        at wmagic.basic.Wave.main(Wave.java:61)
Maybe the problem is the way I'm creating my jni so (in an ant target):
<echo>Compiling Library</echo>
<exec executable="${Ccompiler}">
	<arg value="-o"/>
	<arg value="${library.dir}/libwmagic_alsa.so" />
	<arg value="-shared" />
	<arg value="-I${source.dir}/wmagic/alsa" />
	<arg value="-I${jni.includes.dir}" />
	<arg value="-I${jni.includes.dir}/linux" />
	<arg value="-lalsa09" />
	<arg value="-L/usr/lib/ao/plugins-2" />
	<arg value="${source.dir}/wmagic/alsa/wmagic_alsa.c" />
	<arg value="-static" />
	<arg value="-lc" />
</exec>
How can I get it to work? I'm catching the exception and using Java Sound as a fall back, but I want to use alsa (and that's another thread in the forums: How to use alsa's default device in Java Sound... but nobody has told me how to... so don't go down that path, please. :-)).
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Nov 23 2007
Added on Oct 24 2007
2 comments
210 views