HamoudaOthman / javacv

Automatically exported from code.google.com/p/javacv
GNU General Public License v2.0
0 stars 0 forks source link

[Chumby, ARM] java.lang.UnsatisfiedLinkError: no jniopencv_core in java.library.path #76

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Hello Samuel,
I have successfully cross-compiled a c program which opens the camera capture 
on the target machine.  The target is a Chumby with an ARM processor - this is 
not Android.

You had mentioned before that you could for-see problems with this.

For fun since the Loader (I'm guessing) is looking for the Android binaries (on 
a ARM system) - I symbolically linked them to what I saw was the naming 
convention for Android binaries(ln -s libopencv_core.2.2.0 libjniopencv_core.so 
(etc)) - now I get the below error.  Would you have any suggestions?

Kind Regards,
Greg.

Exception in thread "OpenCV_videoProcessor" 
java.lang.ExceptionInInitializerError
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:169)
    at com.googlecode.javacpp.Loader.load(Loader.java:286)
    at com.googlecode.javacv.cpp.opencv_imgproc.<clinit>(opencv_imgproc.java:87)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:169)
    at com.googlecode.javacpp.Loader.load(Loader.java:286)
    at com.googlecode.javacv.cpp.opencv_highgui.<clinit>(opencv_highgui.java:88)
    at org.myrobotlab.service.OpenCV$VideoProcess.run(Unknown Source)
    at java.lang.Thread.run(Thread.java:662)
Caused by: java.lang.NullPointerException
    at com.googlecode.javacpp.Loader.sizeof(Loader.java:421)
    at com.googlecode.javacv.cpp.opencv_core.<clinit>(opencv_core.java:945)
    ... 10 more

Original issue reported on code.google.com by supert...@gmail.com on 11 Jun 2011 at 11:20

GoogleCodeExporter commented 9 years ago
It seems that the JVM is not executing the JNI_OnLoad() function.. I am afraid 
you will need to recompile the binaries for your platform. Unless it does not 
work with properly compiled binaries?

Original comment by samuel.a...@gmail.com on 12 Jun 2011 at 12:59

GoogleCodeExporter commented 9 years ago
I did recompile the binaries for my target platform.  The c program is working. 
 What part should I re-compile?  I can try a different JVM soon, the one I'm 
using is Sun's so I figure they would conform to the JNI API specification.

Original comment by supert...@gmail.com on 12 Jun 2011 at 1:14

GoogleCodeExporter commented 9 years ago
You need to compile OpenCV (libopencv_*.so) and the JNI binaries for JavaCV 
(libjniopencv_*.so)

Original comment by samuel.a...@gmail.com on 12 Jun 2011 at 1:24

GoogleCodeExporter commented 9 years ago
Forgive me for my complete ignorance, but where are the sources for the "JNI 
binaries for JavaCV (libjniopencv_*.so)"

There are no .c files in your JavaCV source bundle and the only reference in 
OpenCV that I have seen is "OpenCV-2.2.0/android/android-jni"

Original comment by supert...@gmail.com on 12 Jun 2011 at 1:44

GoogleCodeExporter commented 9 years ago
They are generated by JavaCPP at build time. Check inside JavaCV's `build.xml` 
file...

Original comment by samuel.a...@gmail.com on 12 Jun 2011 at 1:49

GoogleCodeExporter commented 9 years ago
I have always used Eclipse in the past.  I downloaded netbeans and loaded 
javacv.  It looks to have generated the files and is attempting to compile. Now 
I'll need to create the appropriate links and get my cross-compiler/tool chain 
ready for the projects.

Thanks for you direction.

Would you be interested in any of the binaries from this ARM 9 build?

Greg.

Original comment by supert...@gmail.com on 12 Jun 2011 at 4:44

GoogleCodeExporter commented 9 years ago
BTW, we do not need NetBeans just to build JavaCV/JavaCPP. Apache Ant alone 
works just fine

If the binaries work, sure you can post them here, thanks

Original comment by samuel.a...@gmail.com on 13 Jun 2011 at 4:36

GoogleCodeExporter commented 9 years ago
Ok... I was curious about NetBeans anyway.  I got the .cpp files to generate - 
I see that it will take command parameters, and you have a set of properties 
for each platform.  That's very slick.  

I generated and compiled the .cpps loaded them on the target system and removed 
all the incorrect platform jars (just in case Android confusion comes up) and 
am now getting at least a different error :)

Error loading class com/googlecode/javacpp/Pointer.Error getting init method ID 
of Pointer class.Exception in thread "OpenCV_videoProcessor" 
java.lang.NoSuchMethodError: init
    at java.lang.ClassLoader$NativeLibrary.load(Native Method)
    at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1807)
    at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1732)
    at java.lang.Runtime.loadLibrary0(Runtime.java:823)
    at java.lang.System.loadLibrary(System.java:1028)
    at com.googlecode.javacpp.Loader.load(Loader.java:338)
    at com.googlecode.javacpp.Loader.load(Loader.java:266)
    at com.googlecode.javacv.cpp.opencv_core.<clinit>(opencv_core.java:118)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:169)
    at com.googlecode.javacpp.Loader.load(Loader.java:286)
    at com.googlecode.javacv.cpp.opencv_imgproc.<clinit>(opencv_imgproc.java:87)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:169)
    at com.googlecode.javacpp.Loader.load(Loader.java:286)
    at com.googlecode.javacv.cpp.opencv_highgui.<clinit>(opencv_highgui.java:88)
    at org.myrobotlab.service.OpenCV$VideoProcess.run(Unknown Source)
    at java.lang.Thread.run(Thread.java:662)

Original comment by supert...@gmail.com on 13 Jun 2011 at 4:41

GoogleCodeExporter commented 9 years ago
I changed the signature of the `init()` method in the June 10th release.. there 
must be old stuff still lying around somewhere

Original comment by samuel.a...@gmail.com on 13 Jun 2011 at 4:44

GoogleCodeExporter commented 9 years ago
Ha !  I've been focusing on building with this toolchain, I completely forgot 
about your update... Thanks, I'll get your latest release.

Original comment by supert...@gmail.com on 13 Jun 2011 at 4:53

GoogleCodeExporter commented 9 years ago
Hmm... now I remember downloading it today...  I checked the README.txt and it 
has a 
June 10, 2011 entry...  I created the directory today too.. so it was not an 
overlay.  I could start diffing...

Original comment by supert...@gmail.com on 13 Jun 2011 at 5:01

GoogleCodeExporter commented 9 years ago
"there must be old stuff still lying around somewhere" ... I'm guessing/hoping 
you were not referring to my system then?

Original comment by supert...@gmail.com on 13 Jun 2011 at 5:22

GoogleCodeExporter commented 9 years ago
Yes, your system. I would not be releasing something that obviously does not 
work 

Original comment by samuel.a...@gmail.com on 13 Jun 2011 at 7:54

GoogleCodeExporter commented 9 years ago
Success ! Capturing and streaming images off of the Chumby 1 now.  I was so 
focussed on keeping my build environment clean and up to date, I forgot about 
the target system which had the old binaries.  Thanks for your guidance. I have 
attached the .so objects to the ticket.  The hardware is a Chumby 1, I believe 
it is an ARM 9 processor, it was compiled with the arm2008q3 toolchain.

Let me know if you want anymore information.

Best Regards,
Greg.

Original comment by supert...@gmail.com on 13 Jun 2011 at 2:05

Attachments:

GoogleCodeExporter commented 9 years ago
Thanks! I am sure other people that have questions will find their way here :)

Original comment by samuel.a...@gmail.com on 14 Jun 2011 at 12:56

GoogleCodeExporter commented 9 years ago
I have just the same problem, could you tell me, where is this "old stuff" in 
system exactly?

Original comment by kdo...@gmail.com on 9 Nov 2011 at 12:35

GoogleCodeExporter commented 9 years ago
I think all the binaries are listed @ this link

http://myrobotlab.org/node/97

Attachment  Size
rxtxSerial.tar_.gz  143.86 KB
chumby.javacv.tar_.gz   620.71 KB
chumby.opencv.2.2.0.zip 3.69 MB
CMakeCache.txt  31.07 KB
CMakeLists.txt  12.39 KB

Of course all are tied to a version and must be in sync :
OpenCV version javacv version then the jni libraries version

I would recommend testing incrementally - test some small OpenCV program ... 
only when that is working move on to the jni & javacv..

Original comment by supert...@gmail.com on 9 Nov 2011 at 2:45