Can not install v4l4j on ARM with JamVM

138 views
Skip to first unread message

Hettmann

unread,
Feb 27, 2012, 5:00:20 PM2/27/12
to v4l4j
Hi

i have the BeagleBoeard C3 with ARM installed Ubuntu with JamVM build
1.6.0-devel und IcedTea6 1.11pre. I have Downloaded
v4l4j-0.8.10.tar.gz and run ant all and than sudo ant install. So the
files are created correctly und were copied. Nowi get this exception
when running my code:

Cant load v4l4j JNI library
Exception in thread "main" java.lang.UnsatisfiedLinkError: /usr/lib/
jni/libv4l4j.so: /usr/lib/jni/libv4l4j.so: undefined symbol:

On an other PC this a i386.deb everythin is working fine andthe same
code is running without problems. Can you please helm me to run the
code on the BeagleBoeald.


With best regards

Hettmann

Gilles Gigan

unread,
Feb 27, 2012, 5:27:46 PM2/27/12
to v4...@googlegroups.com
Hi there,
I quickly looked at the JamVM source code, and JamVM will look for
native libs in the directoryies listed in the LD_LIBRARY_PATH
environment variable.
What this means it that if your JamVM command looks like this:
jamvm -cp my/class/path -Djava.library.path=/path/to/jni/libs myjar.app
then you should use
LD_LIBRARY_PATH=/path/to/jni/libs jamvm -cp my/class/path myjar.app

Let me know if this helps.
Gilles

> --
> You received this message because you are subscribed to the Google Groups "v4l4j" group.
> To post to this group, send email to v4...@googlegroups.com.
> To unsubscribe from this group, send email to v4l4j+un...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/v4l4j?hl=en.
>

Waldemar Hettmann

unread,
Feb 28, 2012, 2:24:58 PM2/28/12
to v4...@googlegroups.com
Hi,

thank for your fast answer. 

My jni path is /usr/lib/jni ...thre ist also my libv4l4j.so file.
I have installed JamVM but linux donw know the jamvm command, So at first i start the code with
java -jar application.jar -Djava.library.path=/usr/lib/jni  but that dont works.

Afer that i set LD_LIBRARY_PATH=usr/lib/jni und run java -jar application.jar this also dont works.
I have still the same exception java.lang.UsatisfiedLinkError: no v4lvj in java.library.path

But if ran my code with java -jar -server application.jar -Djava.library.path=/usr/lib/jni
i get the Exception in thread "main" java.lang.UnsatisfiedLinkError: /usr/lib/jni/libv4l4j.so: /usr/lib/jni/libv4l4j.so: undefined symbol: libvideo_palettes

Can you help me? What can i do to run the jar on the arm machine? If you need more information, e.g. files, configuration etc. please ask.

Hettmann

2012/2/27 Gilles Gigan <gilles...@gmail.com>

Gilles Gigan

unread,
Feb 28, 2012, 4:12:20 PM2/28/12
to v4...@googlegroups.com
Hi,
Ok so it seems "java -jar -server -Djava.library.path=/usr/lib/jni
..." is the command you should use.
Where did you copy libvideo.so ?
Can you run "ldd /usr/lib/jni/libv4l4j.so" and send the output ?
Thanks
Gilles

On 29 February 2012 06:24, Waldemar Hettmann

Waldemar Hettmann

unread,
Feb 28, 2012, 5:09:44 PM2/28/12
to v4...@googlegroups.com

Hi,

the libvideo.so and  libvideo.so.0   is under /usr/lib/ 

the output of /usr/lib$ ldd /usr/lib/jni/libv4l4j.so:
libc.so.6 => /lib/arm-linux-gnueabi/libc.so.6 (0x4021a000)
/lib/ld-linux.so.3 (0x40032000)

thanks,
Hettmann

2012/2/28 Gilles Gigan <gilles...@gmail.com>

Gilles Gigan

unread,
Feb 28, 2012, 5:24:53 PM2/28/12
to v4...@googlegroups.com
Hi,
That's weird, libv4l4j.so should depend on libvideo.so and libjpeg.so
but I dont see this in the output of ldd...
For reference, this is what I get on x86_64:
gillesg@ubuntu:~/workspace/v4l4j-trunk$ ldd /usr/lib/jni/libv4l4j.so
linux-vdso.so.1 => (0x00007ffffe5ff000)
libjpeg.so.62 => /usr/lib/libjpeg.so.62 (0x00007f4cd3c20000)
libvideo.so.0 => /usr/lib/libvideo.so.0 (0x00007f4cd38d1000)
libc.so.6 => /lib/libc.so.6 (0x00007f4cd354d000)
libm.so.6 => /lib/libm.so.6 (0x00007f4cd32ca000)
librt.so.1 => /lib/librt.so.1 (0x00007f4cd30c2000)
/lib64/ld-linux-x86-64.so.2 (0x00007f4cd4065000)
libpthread.so.0 => /lib/libpthread.so.0 (0x00007f4cd2ea4000)

Not sure where to go from here, but I saw there is a beagle board
emulator. This is my best shot at helping you since I dont own or have
access to a beagle board myself.
I ll get back to you when I have more info.
In the meantime, can you go to the libvideo/ dir, and run "make test".
This will build 3 test apps.
Then can you run "ldd ./list-caps" and post the output.
then try "./list-caps /dev/video0" and post the output.
(if the above doesnt work, try "LD_LIBRARY_PATH=/usr/lib ./list-caps
/dev/video0")
Of course, replace /dev/video0 with whatever video device file you
should be using.

Gilles

On 29 February 2012 09:09, Waldemar Hettmann

Gilles Gigan

unread,
Feb 29, 2012, 12:03:48 AM2/29/12
to v4...@googlegroups.com
Hi,
Ok, so I managed to install a beagle board emulator running Ubuntu oneiric.
The icedtea-6-jre-jamvm package didnt install cleanly, but I managed
to compile libvideo.so, libv4l4j.so
and eventually managed to run the SimpleViewer example app.

This is what I got for ldd:
root@linaro-alip:~/v4l4j-0.8.10# ldd /usr/lib/libvideo.so
libm.so.6 => /lib/arm-linux-gnueabi/libm.so.6 (0x40201000)
librt.so.1 => /lib/arm-linux-gnueabi/librt.so.1 (0x400b9000)
libc.so.6 => /lib/arm-linux-gnueabi/libc.so.6 (0x4026d000)
/lib/ld-linux.so.3 (0x4009a000)
libpthread.so.0 => /lib/arm-linux-gnueabi/libpthread.so.0 (0x400c7000)

root@linaro-alip:~/v4l4j-0.8.10# ldd /usr/lib/jni/libv4l4j.so
libjpeg.so.62 => /usr/lib/arm-linux-gnueabi/libjpeg.so.62 (0x40264000)
libvideo.so.0 => /usr/lib/libvideo.so.0 (0x400c9000)
libc.so.6 => /lib/arm-linux-gnueabi/libc.so.6 (0x4029d000)
/lib/ld-linux.so.3 (0x40031000)
libm.so.6 => /lib/arm-linux-gnueabi/libm.so.6 (0x40180000)
librt.so.1 => /lib/arm-linux-gnueabi/librt.so.1 (0x4000e000)
libpthread.so.0 => /lib/arm-linux-gnueabi/libpthread.so.0 (0x4009e000)

Both libraries have the right dependencies.
I even managed to run the example app (although it didnt do much
because there is no video device),
but there was no java.lang.UnsatisfiedLinkError exception thrown,
meaning the JNI
libraries and their dependencies were loaded without problem.
This is the command I used:
LD_LIBRARY_PATH=/usr/lib/jni java -jamvm -cp /usr/share/java/v4l4j.jar
au.edu.jcu.v4l4j.examples.SimpleViewer

Gilles

Gilles Gigan

unread,
Feb 29, 2012, 6:38:45 PM2/29/12
to v4...@googlegroups.com
Hi,
Thanks for giving me access to your board. I solved the problem !!!
It was a stupid bug in gcc where the libraries a binary should be
linked against MUST be at the end rather than at the beginning of the
command:
This is the command that should work:
gcc -shared -ljpeg -L../libvideo -lvideo jpeg.o rgb.o
v4l4j_FrameGrabber.o v4l4j_ImageFormatList.o v4l4j_DeviceInfo.o
v4l4j_VideoDevice.o v4l4j_Control.o v4l4j_Tuner.o
v4l4j_ResolutionInfo.o v4l4j_FrameInterval.o -o libv4l4j.so

This is the workaround:
gcc jpeg.o rgb.o v4l4j_FrameGrabber.o v4l4j_ImageFormatList.o
v4l4j_DeviceInfo.o v4l4j_VideoDevice.o v4l4j_Control.o v4l4j_Tuner.o
v4l4j_ResolutionInfo.o v4l4j_FrameInterval.o -shared -ljpeg
-L../libvideo -lvideo -o libv4l4j.so

So, you now have a working v4l4j installation. If you have an X11
server running you can view the output of the webcam with 'ant
test-gui'. Otherwise, you can start a webcam server with 'ant
test-server'.
On another machine, in firefox, go to "http://ip_address_of_the_board/"
By the way, I found that you only need this to run any v4l4j app:
java -Djava.library.path=/usr/lib/jni -cp /my/class/path ...

I will commit this fix so it will be in the next v4l4j release.
Let me know if you have any other issue
Gilles

Reply all
Reply to author
Forward
0 new messages