Re: [Jamvm-general] Cannot load JNI .so file with -Djava.library.path
Brought to you by:
rlougher
From: Christopher F. <chr...@gm...> - 2008-12-11 17:47:40
|
Ok - so exporting LD_LIBRARY_PATH=${PWD} seemed to solve the problem of not loading ${PWD}/libjpeg.so.62 . That means that -Djava.library.path has some implementation error. I'm now running into an error with my kernel module for V4L2 ... sigh... when will Technologic Systems start distributing their boards with a modern linux kernel instead of 2.4.26 ? I needed to patch their kernel with the V4L2 code, and even then it wouldn't run properly. It seems like the v4l2 modules are not compatible with the kernel they they've developed. Thanks for your help jamvm-general ... I guess I'll have to put a newer Linux kernel on my boards just to use v4l2 Cheers, Chris On Thu, Dec 11, 2008 at 10:51 AM, Christopher Friedt <chr...@gm...> wrote: > Hi again Rob, > > Here's the output after I patched jamvm's native library loader, as > you mentioned in the other post. > > $ jamvm -Djava.library.path=${PWD} -cp .:v4l4j.jar > com/visibleassets/motion/StatisticalMotionDetector > Successfully opened /usr/local/jamvm/lib/classpath/libjavanio.so > Successfully opened /usr/local/jamvm/lib/classpath/libjavaio.so > Successfully opened /usr/local/jamvm/lib/classpath/libjavalang.so > Open failed /usr/local/jamvm/lib/classpath/libv4l4j.so: cannot open > shared object file: No such file or directory > > =============================================== > Note: dlopen successfully finds /root/libv4l4j.so at this point, but > fails to load the libjpeg.so.62 dependency. > =============================================== > > Open failed libjpeg.so.62: cannot open shared object file: No such > file or directory > Could not load v4l4j library > java.lang.UnsatisfiedLinkError: Native library `v4l4j' not found (as > file `libv4l4j.so') in gnu.classpath.boot.library.path and > java.library.path > at java.lang.Runtime.loadLibrary(Runtime.java:763) > at java.lang.System.loadLibrary(System.java:662) > at au.edu.jcu.v4l4j.FrameGrabber.<clinit>(FrameGrabber.java:157) > at com.visibleassets.motion.StatisticalMotionDetector.<init>(StatisticalMotionDetector.java:64) > at com.visibleassets.motion.StatisticalMotionDetector.main(StatisticalMotionDetector.java:99) > $ file libjpeg.so.62 > libjpeg.so.62: ELF 32-bit LSB shared object, ARM, version 1, stripped > $ objdump -p libv4l4j.so | grep -i "needed" > NEEDED libjpeg.so.62 > NEEDED libc.so.6 > $ objdump -p libjpeg.so.62 | grep -i soname > SONAME libjpeg.so.62 > $ objdump -p libv4l4j.so | grep -i soname > SONAME v4l4j > > This is slightly confusing ... I wonder why it doesn't find > libjpeg.so.62 when it's also present in the PWD. > > I ran a simple Hello class with JNI, but it did not experience any > errors at all. > > Thoughts? > > Cheers, > > Chris > > On Wed, Dec 10, 2008 at 8:30 PM, Christopher Friedt > <chr...@gm...> wrote: >> Thanks Rob ! You helped partiallly :) >> >> I forgot that I'd linked against libjpeg.so. However, even after I >> copied libjpeg.so to the PWD, I still received the same >> UnsatisfiedLinkError [1]. >> >> The only way I got it to work was by saying >> >> export LD_LIBRARY_PATH=${PWD} >> jamvm -cp .:${PWD}/v4l4j.jar com/visibleassets/motion/StatisticalMotionDetector >> >> So it seems that -Djava.library.path does not work as expected after all. >> >> I think that maybe the System ClassLoader needs to be updated when >> java.library.path is updated anytime after the VM starts. >> >> If it's any consolation, setting the java.library.path system property >> in Sun's Java implementation (programmatically with Java code) also >> lacks in expected functionality. [2] >> >> >> Cheers, >> >> Chris >> >> [1] $ jamvm -Djava.library.path=${PWD} -cp .:${PWD}/v4l4j.jar >> com/visibleassets/motion/StatisticalMotionDetector >> Could not load v4l4j library >> java.lang.UnsatisfiedLinkError: Native library `v4l4j' not found (as >> file `libv4l4j.so') in gnu.classpath.boot.library.path and >> java.library.path >> at java.lang.Runtime.loadLibrary (Runtime.java:763) >> at java.lang.System.loadLibrary (System.java:512) >> at au.edu.jcu.v4l4j.FrameGrabber.<clinit> (FrameGrabber.java:157) >> at com.visibleassets.motion.StatisticalMotionDetector.<init> >> (StatisticalMotionDetector.java:64) >> at com.visibleassets.motion.StatisticalMotionDetector.main >> (StatisticalMotionDetector.java:99) >> >> [2] http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4280189 >> >> On Wed, Dec 10, 2008 at 7:23 PM, Robert Lougher <rob...@gm...> wrote: >>> Hi, >>> >>> You're the second person to have library problems today. The usual >>> reason is that a dependency of your library cannot be found. >>> Unfortunately, this looks the same as the library itself not being >>> found. >>> >>> See my answer to the previous question for help: >>> >>> http://www.nabble.com/Error-when-using-JNI-td20930484.html#a20930484 >>> >>> Rob. >>> >>> P.S. Let the list know what happens. >>> >>> 2008/12/10 Christopher Friedt <chr...@gm...>: >>>> Hi there, >>>> >>>> I'm using jamvm-1.5.1 running on an arm920t core, and the following >>>> UnsatisfiedLinkError keeps occurring, indicating that JamVM has some >>>> sort of internal ClassLoader bug: >>>> >>>> jamvm -Djava.library.path=${PWD} -cp .:${PWD}/v4l4j.jar >>>> com/visibleassets/motion/StatisticalMotionDetector >>>> Could not load v4l4j library >>>> java.lang.UnsatisfiedLinkError: Native library `v4l4j' not found (as >>>> file `libv4l4j.so') in gnu.classpath.boot.library.path and >>>> java.library.path >>>> at java.lang.Runtime.loadLibrary (Runtime.java:763) >>>> at java.lang.System.loadLibrary (System.java:512) >>>> at au.edu.jcu.v4l4j.FrameGrabber.<clinit> (FrameGrabber.java:157) >>>> at com.visibleassets.motion.StatisticalMotionDetector.<init> >>>> (StatisticalMotionDetector.java:64) >>>> at com.visibleassets.motion.StatisticalMotionDetector.main >>>> (StatisticalMotionDetector.java:99) >>>> >>>> Yes libv4l4j.so exist in ${PWD}. This runs perfectly on sun's jdk / >>>> i386, and the shared library compiles perfectly for ARM as well. The >>>> error clearly states that the library isn't found. I've written up a >>>> quick test to spit out the value of java.library.path when I pass >>>> -Djava.library.path and it indeed is set as a system property. >>>> >>>> I'll try to follow up with this using a really simple "Hello, JNI World!" test. >>>> >>>> Has anyone else experienced problems loading libraries for use with JNI ?? >>>> >>>> >>>> Regards, >>>> >>>> Christopher >>>> >>>> ------------------------------------------------------------------------------ >>>> SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada. >>>> The future of the web can't happen without you. Join us at MIX09 to help >>>> pave the way to the Next Web now. Learn more and register at >>>> http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/ >>>> _______________________________________________ >>>> Jamvm-general mailing list >>>> Jam...@li... >>>> https://lists.sourceforge.net/lists/listinfo/jamvm-general >>>> >>> >> > |