Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed to initialize BridJ on raspberry pi # < Raspbian “wheezy”> #28

Closed
He-Pin opened this issue Jan 30, 2013 · 64 comments
Closed
Labels

Comments

@He-Pin
Copy link

He-Pin commented Jan 30, 2013

^Cpi@raspberrypi ~ $ java -jar ICE2.jar 
13:21:54.561 [main] INFO  c.g.sarxos.webcam.WebcamDriverUtils - Searching driver com.github.sarxos.webcam.ds.openimaj.OpenImajDriver
13:21:54.638 [main] DEBUG c.g.sarxos.webcam.WebcamDriverUtils - Driver com.github.sarxos.webcam.ds.openimaj.OpenImajDriver not found
13:21:54.641 [main] INFO  c.g.sarxos.webcam.WebcamDriverUtils - Searching driver com.github.sarxos.webcam.ds.civil.LtiCivilDriver
13:21:54.649 [main] DEBUG c.g.sarxos.webcam.WebcamDriverUtils - Driver com.github.sarxos.webcam.ds.civil.LtiCivilDriver not found
13:21:54.652 [main] INFO  c.g.sarxos.webcam.WebcamDriverUtils - Searching driver com.github.sarxos.webcam.ds.jmf.JmfDriver
13:21:54.660 [main] DEBUG c.g.sarxos.webcam.WebcamDriverUtils - Driver com.github.sarxos.webcam.ds.jmf.JmfDriver not found
13:21:54.664 [main] INFO  com.github.sarxos.webcam.Webcam - Webcam driver has not been found, default one will be used!
13:21:54.774 [webcam-discovery] DEBUG c.g.s.w.d.b.WebcamDefaultDriver - Searching devices
java.lang.RuntimeException: Failed to initialize BridJ
    at org.bridj.Platform.initLibrary(Platform.java:370)
    at org.bridj.Platform.<clinit>(Platform.java:175)
    at com.github.sarxos.webcam.ds.buildin.natives.OpenIMAJGrabber.<clinit>(OpenIMAJGrabber.java:59)
    at com.github.sarxos.webcam.ds.buildin.WebcamGrabberProcessor$NewGrabberTask.handle(WebcamGrabberProcessor.java:81)
    at com.github.sarxos.webcam.ds.buildin.WebcamGrabberProcessor$StaticProcessor.run(WebcamGrabberProcessor.java:52)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
    at java.lang.Thread.run(Thread.java:722)
Caused by: java.lang.UnsatisfiedLinkError: /tmp/BridJExtractedLibraries2757211256629756447/bridj.so: /tmp/BridJExtractedLibraries2757211256629756447/bridj.so: no such file or forlder~~~
    at java.lang.ClassLoader$NativeLibrary.load(Native Method)
    at java.lang.ClassLoader.loadLibrary1(ClassLoader.java:1935)
    at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1860)
    at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1821)
    at java.lang.Runtime.load0(Runtime.java:792)
    at java.lang.System.load(System.java:1059)
    at org.bridj.Platform.initLibrary(Platform.java:347)
    ... 7 more
Exception in thread "ProcessorThreadFactory" java.lang.UnsatisfiedLinkError: org.bridj.Platform.sizeOf_ptrdiff_t()I
    at org.bridj.Platform.sizeOf_ptrdiff_t(Native Method)
    at org.bridj.Platform.<clinit>(Platform.java:179)
    at com.github.sarxos.webcam.ds.buildin.natives.OpenIMAJGrabber.<clinit>(OpenIMAJGrabber.java:59)
    at com.github.sarxos.webcam.ds.buildin.WebcamGrabberProcessor$NewGrabberTask.handle(WebcamGrabberProcessor.java:81)
    at com.github.sarxos.webcam.ds.buildin.WebcamGrabberProcessor$StaticProcessor.run(WebcamGrabberProcessor.java:52)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
    at java.lang.Thread.run(Thread.java:722)
java.util.concurrent.TimeoutException: Webcams discovery timeout (6000 ms) has been exceeded
    at com.github.sarxos.webcam.WebcamDiscoveryService.getWebcams(WebcamDiscoveryService.java:119)
    at com.github.sarxos.webcam.Webcam.getWebcams(Webcam.java:355)
    at com.github.sarxos.webcam.Webcam.getDefault(Webcam.java:409)
    at com.github.sarxos.webcam.Webcam.getDefault(Webcam.java:388)
    at us.sosia.media.webcam.WebCamUtils.getDefaultWebcam(WebCamUtils.java:23)
    at us.sosia.nat.client.P2PAgentor.main(P2PAgentor.java:171)
............

Hello sarxos,sorry for that,i was running this on the raspberry pi with linux and openjdk7,then i get this ...i see the arm build so is contains and use the bridj 0.6.2 and your 0.3.7 lib

@sarxos
Copy link
Owner

sarxos commented Jan 30, 2013

Hi,

I don't know why BridJ is not being loaded. I created new issue for BridJ project nativelibs4java/nativelibs4java#364

@sarxos
Copy link
Owner

sarxos commented Jan 30, 2013

There is other Raspberry Pi issue you have to be aware. Please find description in #27.

@sarxos
Copy link
Owner

sarxos commented Jan 30, 2013

By the way. In terms of your problem, did you check permissions on /tmp directory ??

@He-Pin
Copy link
Author

He-Pin commented Jan 31, 2013

@sarxos i check the permission of /tem ,its
drwxrwxrwt 5 root root 4096 Jan 31 09:42 tmp
so ,i don't think that cause an problem,i will going to try your new snapshot.and update the issue here,thanks,

i upgrade to your new snapshot ,it still cause the probleam,i still try to use sudo java -jar to run the program,make no sense

i view the source code of the Platform.java at line #347

    public static synchronized void initLibrary() {
        if (inited) {
            return;
        }
        inited = true;

        try {
            boolean loaded = false;

            String forceLibFile = getenvOrProperty("BRIDJ_LIBRARY", "bridj.library", null);

            String lib = null;

            if (forceLibFile != null) {
                try {
                    System.load(lib = forceLibFile);
                    loaded = true;
                } catch (Throwable ex) {
                    BridJ.error("Failed to load forced library " + forceLibFile, ex);
                }
            }

            if (!loaded) {
                if (!Platform.isAndroid()) {
                    try {
                        File libFile = extractEmbeddedLibraryResource(BridJLibraryName);
                        if (libFile == null) {
                            throw new FileNotFoundException("Failed to extract embedded library '" + BridJLibraryName + "' (could be a classloader issue, or missing binary in resource path " + StringUtils.implode(embeddedLibraryResourceRoots, ", ") + ")");
                        }

                        if (BridJ.veryVerbose)
                            BridJ.info("Loading library " + libFile);
 #347                       System.load(lib = libFile.toString());
                        BridJ.setNativeLibraryFile(BridJLibraryName, libFile);
                        loaded = true;
                    } catch (IOException ex) {
                        BridJ.error("Failed to load '" + BridJLibraryName + "'", ex);
                    }
                }
                if (!loaded) {
                    System.loadLibrary("bridj");
                }
            }
            if (BridJ.veryVerbose)
                BridJ.info("Loaded library " + lib);

            init();

            //if (BridJ.protectedMode)
            //      BridJ.info("Protected mode enabled");
            if (BridJ.logCalls) {
                BridJ.info("Calls logs enabled");
            }

        } catch (Throwable ex) {
            throw new RuntimeException("Failed to initialize " + BridJ.class.getSimpleName(), ex);
        }
    }

and only one issue may be the Bridj.so does not exists

@He-Pin
Copy link
Author

He-Pin commented Jan 31, 2013

@sarxos i have test it agian,and i have found that the bridj.so just appear once on the tem directory and at any other time ,it just disappeared,only the tmp Bridj directory exists.
i run the program with sudo and with the normal user pi ,it both make no sence.and i finally check the permission

pi@raspberrypi /tmp/BridJExtractedLibraries49040284520094105 $ ls -al
total 8
drwxr-xr-x  2 root root 4096 Jan 31 10:18 .
drwxrwxrwt 11 root root 4096 Jan 31 10:19 ..

the permission is ok.
i think that in
https://github.com/ochafik/nativelibs4java/blob/master/libraries/BridJ/src/main/java/org/bridj/Platform.java
line #554 may be not that effeciant ,the method don't wirte out the bridj.so

pi@raspberrypi ~ $ ls
Desktop   indiecity  python_games
ICE2.jar  lib       
pi@raspberrypi ~ $ cd /tmp/
pi@raspberrypi /tmp $ ls
BridJExtractedLibraries3267982877460781584  hsperfdata_pi       serverauth.mRVt7VwVB2
BridJExtractedLibraries4219928437651459057  hsperfdata_root     ssh-iZnhqdTaIXy1
BridJExtractedLibraries4894160729112053169  pulse-McHFq2CKohqD
BridJExtractedLibraries778676711031521002   pulse-PKdhtXMmr18n
pi@raspberrypi /tmp $ cd BridJExtractedLibraries
BridJExtractedLibraries3267982877460781584/ BridJExtractedLibraries4894160729112053169/
BridJExtractedLibraries4219928437651459057/ BridJExtractedLibraries778676711031521002/
pi@raspberrypi /tmp $ cd BridJExtractedLibraries3267982877460781584/
pi@raspberrypi /tmp/BridJExtractedLibraries3267982877460781584 $ ls
bridj.so
pi@raspberrypi /tmp/BridJExtractedLibraries3267982877460781584 $ cd ../BridJExtractedLibraries4894160729112053169/
pi@raspberrypi /tmp/BridJExtractedLibraries4894160729112053169 $ ls
pi@raspberrypi /tmp/BridJExtractedLibraries4894160729112053169 $ ls
pi@raspberrypi /tmp/BridJExtractedLibraries4894160729112053169 $ cd ../BridJExtractedLibraries4
BridJExtractedLibraries4219928437651459057/ BridJExtractedLibraries4894160729112053169/
pi@raspberrypi /tmp/BridJExtractedLibraries4894160729112053169 $ cd ../BridJExtractedLibraries4219928437651459057/
pi@raspberrypi /tmp/BridJExtractedLibraries4219928437651459057 $ ls
pi@raspberrypi /tmp/BridJExtractedLibraries4219928437651459057 $ cd ../BridJExtractedLibraries778676711031521002/
pi@raspberrypi /tmp/BridJExtractedLibraries778676711031521002 $ ls
pi@raspberrypi /tmp/BridJExtractedLibraries778676711031521002 $ cd ..     
pi@raspberrypi /tmp $ ls
BridJExtractedLibraries3267982877460781584  hsperfdata_pi       serverauth.mRVt7VwVB2
BridJExtractedLibraries4219928437651459057  hsperfdata_root     ssh-iZnhqdTaIXy1
BridJExtractedLibraries4894160729112053169  pulse-McHFq2CKohqD
BridJExtractedLibraries778676711031521002   pulse-PKdhtXMmr18n
pi@raspberrypi /tmp $ sudo rm -rf BridJExtractedLibraries*
pi@raspberrypi /tmp $ ls
hsperfdata_pi  hsperfdata_root  pulse-McHFq2CKohqD  pulse-PKdhtXMmr18n  serverauth.mRVt7VwVB2  ssh-iZnhqdTaIXy1
pi@raspberrypi /tmp $ java -jar ~/ICE2.jar 
10:17:14.802 [main] INFO  c.g.sarxos.webcam.WebcamDriverUtils - Searching driver com.github.sarxos.webcam.ds.openimaj.OpenImajDriver
10:17:14.947 [main] DEBUG c.g.sarxos.webcam.WebcamDriverUtils - Driver com.github.sarxos.webcam.ds.openimaj.OpenImajDriver not found
10:17:14.958 [main] INFO  c.g.sarxos.webcam.WebcamDriverUtils - Searching driver com.github.sarxos.webcam.ds.civil.LtiCivilDriver
10:17:14.965 [main] DEBUG c.g.sarxos.webcam.WebcamDriverUtils - Driver com.github.sarxos.webcam.ds.civil.LtiCivilDriver not found
10:17:14.979 [main] INFO  c.g.sarxos.webcam.WebcamDriverUtils - Searching driver com.github.sarxos.webcam.ds.jmf.JmfDriver
10:17:14.986 [main] DEBUG c.g.sarxos.webcam.WebcamDriverUtils - Driver com.github.sarxos.webcam.ds.jmf.JmfDriver not found
10:17:14.998 [main] INFO  com.github.sarxos.webcam.Webcam - Webcam driver has not been found, default one will be used!
10:17:15.218 [webcam-discovery] DEBUG c.g.s.w.d.b.WebcamDefaultDriver - Searching devices
java.lang.RuntimeException: Failed to initialize BridJ
    at org.bridj.Platform.initLibrary(Platform.java:370)
    at org.bridj.Platform.<clinit>(Platform.java:175)
    at com.github.sarxos.webcam.ds.buildin.natives.OpenIMAJGrabber.<clinit>(OpenIMAJGrabber.java:59)
    at com.github.sarxos.webcam.ds.buildin.WebcamGrabberProcessor$NewGrabberTask.handle(WebcamGrabberProcessor.java:81)
    at com.github.sarxos.webcam.ds.buildin.WebcamGrabberProcessor$StaticProcessor.run(WebcamGrabberProcessor.java:52)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
    at java.lang.Thread.run(Thread.java:722)
Caused by: java.lang.UnsatisfiedLinkError: /tmp/BridJExtractedLibraries1991918788439668360/bridj.so: /tmp/BridJExtractedLibraries1991918788439668360/bridj.so: cannot open shared object file: No such file or directory
    at java.lang.ClassLoader$NativeLibrary.load(Native Method)
    at java.lang.ClassLoader.loadLibrary1(ClassLoader.java:1935)
    at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1860)
    at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1821)
    at java.lang.Runtime.load0(Runtime.java:792)
    at java.lang.System.load(System.java:1059)
    at org.bridj.Platform.initLibrary(Platform.java:347)
    ... 7 more
Exception in thread "ProcessorThreadFactory" java.lang.UnsatisfiedLinkError: org.bridj.Platform.sizeOf_ptrdiff_t()I
    at org.bridj.Platform.sizeOf_ptrdiff_t(Native Method)
    at org.bridj.Platform.<clinit>(Platform.java:179)
    at com.github.sarxos.webcam.ds.buildin.natives.OpenIMAJGrabber.<clinit>(OpenIMAJGrabber.java:59)
    at com.github.sarxos.webcam.ds.buildin.WebcamGrabberProcessor$NewGrabberTask.handle(WebcamGrabberProcessor.java:81)
    at com.github.sarxos.webcam.ds.buildin.WebcamGrabberProcessor$StaticProcessor.run(WebcamGrabberProcessor.java:52)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
    at java.lang.Thread.run(Thread.java:722)
java.util.concurrent.TimeoutException: Webcams discovery timeout (6000 ms) has been exceeded
    at com.github.sarxos.webcam.WebcamDiscoveryService.getWebcams(WebcamDiscoveryService.java:119)
    at com.github.sarxos.webcam.Webcam.getWebcams(Webcam.java:355)
    at com.github.sarxos.webcam.Webcam.getDefault(Webcam.java:409)
    at com.github.sarxos.webcam.Webcam.getDefault(Webcam.java:388)
    at us.sosia.media.webcam.WebCamUtils.getDefaultWebcam(WebCamUtils.java:23)
    at us.sosia.nat.client.P2PAgentor.main(P2PAgentor.java:180)...
pi@raspberrypi /tmp $ ls
BridJExtractedLibraries1991918788439668360  hsperfdata_root     pulse-PKdhtXMmr18n     ssh-iZnhqdTaIXy1
hsperfdata_pi                               pulse-McHFq2CKohqD  serverauth.mRVt7VwVB2
pi@raspberrypi /tmp $ ls BridJExtractedLibraries1991918788439668360/
pi@raspberrypi /tmp $ cd BridJExtractedLibraries1991918788439668360/ 
pi@raspberrypi /tmp/BridJExtractedLibraries1991918788439668360 $ ls
pi@raspberrypi /tmp/BridJExtractedLibraries1991918788439668360 $ cd ..
pi@raspberrypi /tmp $ sudo rm BridJExtractedLibraries1991918788439668360/
rm: cannot remove `BridJExtractedLibraries1991918788439668360/': Is a directory
pi@raspberrypi /tmp $ sudo rm -rf  BridJExtractedLibraries1991918788439668360/
pi@raspberrypi /tmp $ ls
hsperfdata_pi  hsperfdata_root  pulse-McHFq2CKohqD  pulse-PKdhtXMmr18n  serverauth.mRVt7VwVB2  ssh-iZnhqdTaIXy1
pi@raspberrypi /tmp $ sudo java -jar ~/ICE2.jar 
10:18:26.254 [main] INFO  c.g.sarxos.webcam.WebcamDriverUtils - Searching driver com.github.sarxos.webcam.ds.openimaj.OpenImajDriver
10:18:26.402 [main] DEBUG c.g.sarxos.webcam.WebcamDriverUtils - Driver com.github.sarxos.webcam.ds.openimaj.OpenImajDriver not found
10:18:26.406 [main] INFO  c.g.sarxos.webcam.WebcamDriverUtils - Searching driver com.github.sarxos.webcam.ds.civil.LtiCivilDriver
10:18:26.416 [main] DEBUG c.g.sarxos.webcam.WebcamDriverUtils - Driver com.github.sarxos.webcam.ds.civil.LtiCivilDriver not found
10:18:26.430 [main] INFO  c.g.sarxos.webcam.WebcamDriverUtils - Searching driver com.github.sarxos.webcam.ds.jmf.JmfDriver
10:18:26.447 [main] DEBUG c.g.sarxos.webcam.WebcamDriverUtils - Driver com.github.sarxos.webcam.ds.jmf.JmfDriver not found
10:18:26.451 [main] INFO  com.github.sarxos.webcam.Webcam - Webcam driver has not been found, default one will be used!
10:18:26.667 [webcam-discovery] DEBUG c.g.s.w.d.b.WebcamDefaultDriver - Searching devices
java.lang.RuntimeException: Failed to initialize BridJ
    at org.bridj.Platform.initLibrary(Platform.java:370)
    at org.bridj.Platform.<clinit>(Platform.java:175)
    at com.github.sarxos.webcam.ds.buildin.natives.OpenIMAJGrabber.<clinit>(OpenIMAJGrabber.java:59)
    at com.github.sarxos.webcam.ds.buildin.WebcamGrabberProcessor$NewGrabberTask.handle(WebcamGrabberProcessor.java:81)
    at com.github.sarxos.webcam.ds.buildin.WebcamGrabberProcessor$StaticProcessor.run(WebcamGrabberProcessor.java:52)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
    at java.lang.Thread.run(Thread.java:722)
Caused by: java.lang.UnsatisfiedLinkError: /tmp/BridJExtractedLibraries49040284520094105/bridj.so: /tmp/BridJExtractedLibraries49040284520094105/bridj.so: cannot open shared object file: No such file or directory
    at java.lang.ClassLoader$NativeLibrary.load(Native Method)
    at java.lang.ClassLoader.loadLibrary1(ClassLoader.java:1935)
    at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1860)
    at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1821)
    at java.lang.Runtime.load0(Runtime.java:792)
    at java.lang.System.load(System.java:1059)
    at org.bridj.Platform.initLibrary(Platform.java:347)
    ... 7 more
Exception in thread "ProcessorThreadFactory" java.lang.UnsatisfiedLinkError: org.bridj.Platform.sizeOf_ptrdiff_t()I
    at org.bridj.Platform.sizeOf_ptrdiff_t(Native Method)
    at org.bridj.Platform.<clinit>(Platform.java:179)
    at com.github.sarxos.webcam.ds.buildin.natives.OpenIMAJGrabber.<clinit>(OpenIMAJGrabber.java:59)
    at com.github.sarxos.webcam.ds.buildin.WebcamGrabberProcessor$NewGrabberTask.handle(WebcamGrabberProcessor.java:81)
    at com.github.sarxos.webcam.ds.buildin.WebcamGrabberProcessor$StaticProcessor.run(WebcamGrabberProcessor.java:52)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
    at java.lang.Thread.run(Thread.java:722)
java.util.concurrent.TimeoutException: Webcams discovery timeout (6000 ms) has been exceeded
    at com.github.sarxos.webcam.WebcamDiscoveryService.getWebcams(WebcamDiscoveryService.java:119)
    at com.github.sarxos.webcam.Webcam.getWebcams(Webcam.java:355)
    at com.github.sarxos.webcam.Webcam.getDefault(Webcam.java:409)
    at com.github.sarxos.webcam.Webcam.getDefault(Webcam.java:388)
    at us.sosia.media.webcam.WebCamUtils.getDefaultWebcam(WebCamUtils.java:23)
    at us.sosia.nat.client.P2PAgentor.main(P2PAgentor.java:180)
connection checker is started
^Cpi@raspberrypi /tmp $ ls
BridJExtractedLibraries49040284520094105  hsperfdata_root     pulse-PKdhtXMmr18n     ssh-iZnhqdTaIXy1
hsperfdata_pi                             pulse-McHFq2CKohqD  serverauth.mRVt7VwVB2
pi@raspberrypi /tmp $ ls -al
total 52
drwxrwxrwt 11 root root 4096 Jan 31 10:18 .
drwxr-xr-x 23 root root 4096 Jan 24 18:13 ..
drwxrwxrwt  2 root root 4096 Jan 30 16:17 .ICE-unix
-r--r--r--  1 root root   11 Jan 31 10:02 .X0-lock
drwxrwxrwt  2 root root 4096 Jan 31 10:02 .X11-unix
drwx------  2 pi   pi   4096 Jan 31 10:03 .esd-1000
srwxr-xr-x  1 pi   pi      0 Jan 31 10:03 .lxterminal-socket:0.0-pi
srwxr-xr-x  1 pi   pi      0 Jan 31 10:02 .menu-cached-:0-pi
srwxr-xr-x  1 pi   pi      0 Jan 31 10:02 .pcmanfm-socket--0-pi
drwxr-xr-x  2 root root 4096 Jan 31 10:18 BridJExtractedLibraries49040284520094105
drwxr-xr-x  2 pi   pi   4096 Jan 31 10:17 hsperfdata_pi
drwxr-xr-x  2 root root 4096 Jan 31 10:18 hsperfdata_root
drwx------  2 pi   pi   4096 Jan 31 10:03 pulse-McHFq2CKohqD
drwx------  2 root root 4096 Jan 30 16:17 pulse-PKdhtXMmr18n
-rw-------  1 pi   pi    168 Jan 31 10:02 serverauth.mRVt7VwVB2
drwx------  2 pi   pi   4096 Jan 31 10:02 ssh-iZnhqdTaIXy1
pi@raspberrypi /tmp $ cd BridJExtractedLibraries49040284520094105/
pi@raspberrypi /tmp/BridJExtractedLibraries49040284520094105 $ ls -al
total 8
drwxr-xr-x  2 root root 4096 Jan 31 10:18 .
drwxrwxrwt 11 root root 4096 Jan 31 10:19 ..
pi@raspberrypi /tmp/BridJExtractedLibraries49040284520094105 $ 

@sarxos
Copy link
Owner

sarxos commented Jan 31, 2013

@hepin1989

Please try running your app with the following options added (with sudo or without it):

java -jar ~/ICE2.jar \
-Dwebcam.debug=true \
-Dbridj.debug=true \
-Dbridj.veryVerbose=true \
-Dbridj.verbose=true

This can reveal us some more internal flow marks.

@He-Pin
Copy link
Author

He-Pin commented Feb 1, 2013

@sarxos
OK,I got these below
pi@raspberrypi ~ $ java -jar ~/ICE2.jar \

-Dwebcam.debug=true
-Dbridj.debug=true
-Dbridj.veryVerbose=true
-Dbridj.verbose=true
09:49:44.787 [main] INFO c.g.sarxos.webcam.WebcamDriverUtils - Searching driver com.github.sarxos.webcam.ds.openimaj.OpenImajDriver
09:49:44.861 [main] DEBUG c.g.sarxos.webcam.WebcamDriverUtils - Driver com.github.sarxos.webcam.ds.openimaj.OpenImajDriver not found
09:49:44.865 [main] INFO c.g.sarxos.webcam.WebcamDriverUtils - Searching driver com.github.sarxos.webcam.ds.civil.LtiCivilDriver
09:49:44.873 [main] DEBUG c.g.sarxos.webcam.WebcamDriverUtils - Driver com.github.sarxos.webcam.ds.civil.LtiCivilDriver not found
09:49:44.876 [main] INFO c.g.sarxos.webcam.WebcamDriverUtils - Searching driver com.github.sarxos.webcam.ds.jmf.JmfDriver
09:49:44.885 [main] DEBUG c.g.sarxos.webcam.WebcamDriverUtils - Driver com.github.sarxos.webcam.ds.jmf.JmfDriver not found
09:49:44.888 [main] INFO com.github.sarxos.webcam.Webcam - Webcam driver has not been found, default one will be used!
09:49:45.002 [webcam-discovery] DEBUG c.g.s.w.d.b.WebcamDefaultDriver - Searching devices
java.lang.RuntimeException: Failed to initialize BridJ
at org.bridj.Platform.initLibrary(Platform.java:370)
at org.bridj.Platform.(Platform.java:175)
at com.github.sarxos.webcam.ds.buildin.natives.OpenIMAJGrabber.(OpenIMAJGrabber.java:59)
at com.github.sarxos.webcam.ds.buildin.WebcamGrabberProcessor$NewGrabberTask.handle(WebcamGrabberProcessor.java:81)
at com.github.sarxos.webcam.ds.buildin.WebcamGrabberProcessor$StaticProcessor.run(WebcamGrabberProcessor.java:52)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
at java.lang.Thread.run(Thread.java:722)
Caused by: java.lang.UnsatisfiedLinkError: /tmp/BridJExtractedLibraries1787467994836053402/bridj.so: /tmp/BridJExtractedLibraries1787467994836053402/bridj.so: can not open the share object blablabla :not such file or direcotry ...
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary1(ClassLoader.java:1935)
at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1860)
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1821)
at java.lang.Runtime.load0(Runtime.java:792)
at java.lang.System.load(System.java:1059)
at org.bridj.Platform.initLibrary(Platform.java:347)
... 7 more
Exception in thread "ProcessorThreadFactory" java.lang.UnsatisfiedLinkError: org.bridj.Platform.sizeOf_ptrdiff_t()I
at org.bridj.Platform.sizeOf_ptrdiff_t(Native Method)
at org.bridj.Platform.(Platform.java:179)
at com.github.sarxos.webcam.ds.buildin.natives.OpenIMAJGrabber.(OpenIMAJGrabber.java:59)
at com.github.sarxos.webcam.ds.buildin.WebcamGrabberProcessor$NewGrabberTask.handle(WebcamGrabberProcessor.java:81)
at com.github.sarxos.webcam.ds.buildin.WebcamGrabberProcessor$StaticProcessor.run(WebcamGrabberProcessor.java:52)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
at java.lang.Thread.run(Thread.java:722)
java.util.concurrent.TimeoutException: Webcams discovery timeout (6000 ms) has been exceeded
at com.github.sarxos.webcam.WebcamDiscoveryService.getWebcams(WebcamDiscoveryService.java:119)
at com.github.sarxos.webcam.Webcam.getWebcams(Webcam.java:355)
at com.github.sarxos.webcam.Webcam.getDefault(Webcam.java:409)
at com.github.sarxos.webcam.Webcam.getDefault(Webcam.java:388)
at us.sosia.media.webcam.WebCamUtils.getDefaultWebcam(WebCamUtils.java:23)

and i try with the sodo ,it same again.
there is no bridj.so in the /tmp/BridJExtractedLibraries*/.

@He-Pin
Copy link
Author

He-Pin commented Feb 1, 2013

i write an more simple code with
public class WebcamTest {

/**
 * @param args
 */
public static void main(String[] args) {
    // TODO Auto-generated method stub
    Webcam webcam = null;
    try {
        webcam = Webcam.getDefault();
    } catch (WebcamException e) {
        System.out.println("webcam exception");
        System.exit(0);
    }
    if (webcam != null) {
        System.out.println("has webcam");
    }else{
        System.out.println("has no webcam");
        System.exit(0);
    }
}

}
pi@raspberrypi ~ cat /proc/cpuinfo
Processor : ARMv6-compatible processor rev 7 (v6l)
BogoMIPS : 697.95
Features : swp half thumb fastmult vfp edsp java tls
CPU implementer : 0x41
CPU architecture: 7
CPU variant : 0x0
CPU part : 0xb76
CPU revision : 7

Hardware : BCM2708
Revision : 000f
Serial : 000000002ad68f1c
pi@raspberrypi ~ $ uname -a
Linux raspberrypi 3.2.27+ #250 PREEMPT Thu Oct 18 19:03:02 BST 2012 armv6l GNU/Linux

pi@raspberrypi ~ $ java -jar WebcamTest_fat.jar
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
java.lang.RuntimeException: Failed to initialize BridJ
at org.bridj.Platform.initLibrary(Platform.java:370)
at org.bridj.Platform.(Platform.java:175)
at com.github.sarxos.webcam.ds.buildin.natives.OpenIMAJGrabber.(OpenIMAJGrabber.java:59)
at com.github.sarxos.webcam.ds.buildin.WebcamGrabberProcessor$NewGrabberTask.handle(WebcamGrabberProcessor.java:81)
at com.github.sarxos.webcam.ds.buildin.WebcamGrabberProcessor$StaticProcessor.run(WebcamGrabberProcessor.java:52)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
at java.lang.Thread.run(Thread.java:722)
Caused by: java.lang.UnsatisfiedLinkError: /tmp/BridJExtractedLibraries5492840119970647906/bridj.so: /tmp/BridJExtractedLibraries5492840119970647906/bridj.so:no that file~~
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary1(ClassLoader.java:1935)
at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1860)
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1821)
at java.lang.Runtime.load0(Runtime.java:792)
at java.lang.System.load(System.java:1059)
at org.bridj.Platform.initLibrary(Platform.java:347)
... 7 more
Exception in thread "ProcessorThreadFactory" java.lang.UnsatisfiedLinkError: org.bridj.Platform.sizeOf_ptrdiff_t()I
at org.bridj.Platform.sizeOf_ptrdiff_t(Native Method)
at org.bridj.Platform.(Platform.java:179)
at com.github.sarxos.webcam.ds.buildin.natives.OpenIMAJGrabber.(OpenIMAJGrabber.java:59)
at com.github.sarxos.webcam.ds.buildin.WebcamGrabberProcessor$NewGrabberTask.handle(WebcamGrabberProcessor.java:81)
at com.github.sarxos.webcam.ds.buildin.WebcamGrabberProcessor$StaticProcessor.run(WebcamGrabberProcessor.java:52)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
at java.lang.Thread.run(Thread.java:722)

should i change to arch linux on pi?

@sarxos
Copy link
Owner

sarxos commented Feb 1, 2013

I'm very sorry, I gave you incorrect command to be run (with incorrect arguments order) 😢

The correct one should be (-jar <file> at the end):

java -Dwebcam.debug=true -Dbridj.debug=true -Dbridj.veryVerbose=true \
-Dbridj.verbose=true -jar ~/ICE2.jar

It will print much more information, and what we are looking for is something similar to this fragment:

Feb 1, 2013 11:23:04 AM org.bridj.BridJ log
INFO: Embedded paths for library bridj : [org/bridj/v0_6_2/lib/linux_x64/libbridj.so, org/bridj/v0_6_2/lib/linux_x64/bridj.so, org/bridj/lib/linux_x64/libbridj.so, org/bridj/lib/linux_x64/bridj.so, lib/linux_x64/libbridj.so, lib/linux_x64/bridj.so]
Feb 1, 2013 11:23:04 AM org.bridj.BridJ log
INFO: Loading library /tmp/BridJExtractedLibraries4073504794422716556/libbridj.so
Feb 1, 2013 11:23:04 AM org.bridj.BridJ log
INFO: Loaded library /tmp/BridJExtractedLibraries4073504794422716556/libbridj.so

@sarxos
Copy link
Owner

sarxos commented Feb 1, 2013

Hi,

Olivier Chafik who is in charge of BridJ project commented on the issue I reported in regards to your problem. He is asking to use the newest BridJ snapshot due to last changes in raspbian support. I'm sure he is more experienced in BridJ then I am and will be able to help you diagnose the problem.

Please see his comment here: nativelibs4java/nativelibs4java#364 (comment)

@sarxos
Copy link
Owner

sarxos commented Feb 1, 2013

I just noticed your pull request for BridJ. Sorry for doubling posts :)

@He-Pin
Copy link
Author

He-Pin commented Feb 1, 2013

@sarxos
OK.thanks ,i noticed that ,he is using the URI to read the resouces,so the Filechannel will make no sense,
another issue's user is using the arch linux,so may be this is the difference bettween my evn and his.

i don't have so much time cause my boss always push me ,so i just look the code ,and can not patch an quick fix,even more,i don't wanna use the source code and apply an quick hot fix.

thanks,cause it's going to be Spring Festival in China,so it's a little busy now.

thank you very much ,you help me a lot.

for my current demo implement ,i will try to capture the image from the raspberry pi ,and then render them on the android side via udt.

and the xuggler has not and arm support,i will going to figure one way out too.after i finish my current learning of maven,may be i can make some help
.thankyou

@He-Pin
Copy link
Author

He-Pin commented Feb 1, 2013

@sarxos ,haha ,i notice the incurrent command.:)

@He-Pin
Copy link
Author

He-Pin commented Feb 1, 2013

INFO: Embedded paths for library bridj : [org/bridj/v0_6_2/lib/linux_arm32_arm/libbridj.so, org/bridj/v0_6_2/lib/linux_arm32_arm/bridj.so, org/bridj/lib/linux_arm32_arm/libbridj.so, org/bridj/lib/linux_arm32_arm/bridj.so, lib/linux_arm32_arm/libbridj.so, lib/linux_arm32_arm/bridj.so]
���� 01, 2013 7:58:03 ���� org.bridj.BridJ log
INFO: Loading library /tmp/BridJExtractedLibraries751593573653795873/bridj.so
java.lang.RuntimeException: Failed to initialize BridJ
    at org.bridj.Platform.initLibrary(Platform.java:370)
    at org.bridj.Platform.<clinit>(Platform.java:175)

you can see that~~,can not to load~~

@sarxos
Copy link
Owner

sarxos commented Feb 1, 2013

Yes... I was was hoping there is some strange behavior which cause the code to jump into catch after receiving IOException in https://github.com/ochafik/nativelibs4java/blob/master/libraries/BridJ/src/main/java/org/bridj/Platform.java#L70, but there is no clue in log of such operation. I really hope that Olivier will be able to help you.

@He-Pin
Copy link
Author

He-Pin commented Feb 1, 2013

@sarxos wow,thanks

i just use the updated bridj snapshot and yours ,then the bridj.so is load ok,but for you can not found the OpenIMAJGrabber.so

i have install the lib you mentioned in the other issue
sudo apt-get install libv4l*

but make no sence for my current Raspbian “wheezy”,i try to run with sudo too,

java -jar webcam_test.jar 

with more detail

pi@raspberrypi ~ $ java -jar -Dwebcam.debug=true \
> -Dbridj.debug=true \
> -Dbridj.veryVerbose=true \
> -Dbridj.verbose=true webcam_test.jar 
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
Feb 01, 2013 11:13:19 PM org.bridj.BridJ log
INFO: Embedded paths for library bridj : [org/bridj/v0_6_3/lib/linux_arm32_arm/libbridj.so, org/bridj/v0_6_3/lib/linux_arm32_arm/bridj.so, org/bridj/lib/linux_arm32_arm/libbridj.so, org/bridj/lib/linux_arm32_arm/bridj.so, lib/linux_arm32_arm/libbridj.so, lib/linux_arm32_arm/bridj.so]
Feb 01, 2013 11:13:20 PM org.bridj.BridJ log
INFO: Loading library /tmp/BridJExtractedLibraries7475852078937339850/libbridj.so
Feb 01, 2013 11:13:20 PM org.bridj.BridJ log
INFO: Loaded library /tmp/BridJExtractedLibraries7475852078937339850/libbridj.so
Feb 01, 2013 11:13:20 PM org.bridj.BridJ log
INFO: Runtime for com.github.sarxos.webcam.ds.buildin.natives.OpenIMAJGrabber : org.bridj.cpp.CPPRuntime
Feb 01, 2013 11:13:20 PM org.bridj.BridJ log
INFO: Environment var LD_LIBRARY_PATH = null
Feb 01, 2013 11:13:20 PM org.bridj.BridJ log
INFO: Environment var DYLD_LIBRARY_PATH = null
Feb 01, 2013 11:13:20 PM org.bridj.BridJ log
INFO: Environment var PATH = /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/games:/usr/games
Feb 01, 2013 11:13:20 PM org.bridj.BridJ log
INFO: Property java.library.path = /usr/java/packages/lib/arm:/usr/lib/arm-linux-gnueabihf/jni:/lib/arm-linux-gnueabihf:/usr/lib/arm-linux-gnueabihf:/usr/lib/jni:/lib:/usr/lib
Feb 01, 2013 11:13:20 PM org.bridj.BridJ log
INFO: Property gnu.classpath.boot.library.path = null
Feb 01, 2013 11:13:20 PM org.bridj.BridJ log
INFO: Looking for library 'OpenIMAJGrabber' in paths [null, ., /usr/local/sbin, /usr/local/bin, /usr/sbin, /usr/bin, /sbin, /bin, /usr/local/games, /usr/games, /usr/java/packages/lib/arm, /usr/lib/arm-linux-gnueabihf/jni, /lib/arm-linux-gnueabihf, /usr/lib/arm-linux-gnueabihf, /usr/lib/jni, /lib, /usr/lib, /usr/lib/jvm/java-7-openjdk-armhf/jre/bin, /lib/arm-linux-gnueabi, /usr/lib/arm-linux-gnueabi, /usr/lib32, /lib32, /usr/lib, /lib, /usr/local/lib]
Feb 01, 2013 11:13:21 PM org.bridj.BridJ log
INFO: Embedded paths for library OpenIMAJGrabber : [com/github/sarxos/webcam/ds/buildin/lib/linux_arm32_arm/libOpenIMAJGrabber.so, com/github/sarxos/webcam/ds/buildin/lib/linux_arm32_arm/OpenIMAJGrabber.so, org/bridj/v0_6_3/lib/linux_arm32_arm/libOpenIMAJGrabber.so, org/bridj/v0_6_3/lib/linux_arm32_arm/OpenIMAJGrabber.so, org/bridj/lib/linux_arm32_arm/libOpenIMAJGrabber.so, org/bridj/lib/linux_arm32_arm/OpenIMAJGrabber.so, lib/linux_arm32_arm/libOpenIMAJGrabber.so, lib/linux_arm32_arm/OpenIMAJGrabber.so]
# BridJ: dlopen error when loading /tmp/BridJExtractedLibraries7475852078937339850/OpenIMAJGrabber.so : /tmp/BridJExtractedLibraries7475852078937339850/OpenIMAJGrabber.so: cannot open shared object file: No such file or directory
# BridJ: dlopen error when loading /tmp/BridJExtractedLibraries7475852078937339850/OpenIMAJGrabber.so : /tmp/BridJExtractedLibraries7475852078937339850/OpenIMAJGrabber.so: cannot open shared object file: No such file or directory
# BridJ: dlopen error when loading /tmp/BridJExtractedLibraries7475852078937339850/OpenIMAJGrabber.so : /tmp/BridJExtractedLibraries7475852078937339850/OpenIMAJGrabber.so: cannot open shared object file: No such file or directory
# BridJ: dlopen error when loading /tmp/BridJExtractedLibraries7475852078937339850/OpenIMAJGrabber.so : /tmp/BridJExtractedLibraries7475852078937339850/OpenIMAJGrabber.so: cannot open shared object file: No such file or directory
# BridJ: dlopen error when loading /tmp/BridJExtractedLibraries7475852078937339850/OpenIMAJGrabber.so : /tmp/BridJExtractedLibraries7475852078937339850/OpenIMAJGrabber.so: cannot open shared object file: No such file or directory
# BridJ: dlopen error when loading /tmp/BridJExtractedLibraries7475852078937339850/OpenIMAJGrabber.so : /tmp/BridJExtractedLibraries7475852078937339850/OpenIMAJGrabber.so: cannot open shared object file: No such file or directory
# BridJ: dlopen error when loading /tmp/BridJExtractedLibraries7475852078937339850/OpenIMAJGrabber.so : /tmp/BridJExtractedLibraries7475852078937339850/OpenIMAJGrabber.so: cannot open shared object file: No such file or directory
# BridJ: dlopen error when loading /tmp/BridJExtractedLibraries7475852078937339850/OpenIMAJGrabber.so : /tmp/BridJExtractedLibraries7475852078937339850/OpenIMAJGrabber.so: cannot open shared object file: No such file or directory
# BridJ: dlopen error when loading /tmp/BridJExtractedLibraries7475852078937339850/OpenIMAJGrabber.so : /tmp/BridJExtractedLibraries7475852078937339850/OpenIMAJGrabber.so: cannot open shared object file: No such file or directory
Feb 01, 2013 11:13:22 PM org.bridj.BridJ log
INFO: // size = 0, alignment = -1
struct OpenIMAJGrabber { 
}
# BridJ: dlopen error when loading /tmp/BridJExtractedLibraries7475852078937339850/OpenIMAJGrabber.so : /tmp/BridJExtractedLibraries7475852078937339850/OpenIMAJGrabber.so: cannot open shared object file: No such file or directory
java.lang.RuntimeException: Library 'OpenIMAJGrabber' was not loaded successfully from file '/tmp/BridJExtractedLibraries7475852078937339850/OpenIMAJGrabber.so'
    at org.bridj.BridJ.getNativeLibrary(BridJ.java:921)
    at org.bridj.BridJ.getNativeLibrary(BridJ.java:900)
    at org.bridj.BridJ.getNativeLibrary(BridJ.java:513)
    at org.bridj.cpp.CPPRuntime.newCPPInstance(CPPRuntime.java:627)
    at org.bridj.cpp.CPPRuntime$CPPTypeInfo.initialize(CPPRuntime.java:833)
    at org.bridj.cpp.CPPRuntime$CPPTypeInfo.initialize(CPPRuntime.java:760)
    at org.bridj.CRuntime$CTypeInfo.initialize(CRuntime.java:219)
    at org.bridj.BridJ.initialize(BridJ.java:969)
    at org.bridj.NativeObject.<init>(NativeObject.java:23)
    at org.bridj.StructObject.<init>(StructObject.java:14)
    at org.bridj.cpp.CPPObject.<init>(CPPObject.java:27)
    at com.github.sarxos.webcam.ds.buildin.natives.OpenIMAJGrabber.<init>(OpenIMAJGrabber.java:64)
    at com.github.sarxos.webcam.ds.buildin.WebcamGrabberProcessor$NewGrabberTask.handle(WebcamGrabberProcessor.java:81)
    at com.github.sarxos.webcam.ds.buildin.WebcamGrabberProcessor$StaticProcessor.run(WebcamGrabberProcessor.java:52)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
    at java.lang.Thread.run(Thread.java:722)
Exception in thread "ProcessorThreadFactory" java.lang.RuntimeException: Failed to allocate new instance of type class com.github.sarxos.webcam.ds.buildin.natives.OpenIMAJGrabber
    at org.bridj.cpp.CPPRuntime.newCPPInstance(CPPRuntime.java:674)
    at org.bridj.cpp.CPPRuntime$CPPTypeInfo.initialize(CPPRuntime.java:833)
    at org.bridj.cpp.CPPRuntime$CPPTypeInfo.initialize(CPPRuntime.java:760)
    at org.bridj.CRuntime$CTypeInfo.initialize(CRuntime.java:219)
    at org.bridj.BridJ.initialize(BridJ.java:969)
    at org.bridj.NativeObject.<init>(NativeObject.java:23)
    at org.bridj.StructObject.<init>(StructObject.java:14)
    at org.bridj.cpp.CPPObject.<init>(CPPObject.java:27)
    at com.github.sarxos.webcam.ds.buildin.natives.OpenIMAJGrabber.<init>(OpenIMAJGrabber.java:64)
    at com.github.sarxos.webcam.ds.buildin.WebcamGrabberProcessor$NewGrabberTask.handle(WebcamGrabberProcessor.java:81)
    at com.github.sarxos.webcam.ds.buildin.WebcamGrabberProcessor$StaticProcessor.run(WebcamGrabberProcessor.java:52)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
    at java.lang.Thread.run(Thread.java:722)
Caused by: java.lang.RuntimeException: Library 'OpenIMAJGrabber' was not loaded successfully from file '/tmp/BridJExtractedLibraries7475852078937339850/OpenIMAJGrabber.so'
    at org.bridj.BridJ.getNativeLibrary(BridJ.java:921)
    at org.bridj.BridJ.getNativeLibrary(BridJ.java:900)
    at org.bridj.BridJ.getNativeLibrary(BridJ.java:513)
    at org.bridj.cpp.CPPRuntime.newCPPInstance(CPPRuntime.java:627)
    ... 13 more

@He-Pin
Copy link
Author

He-Pin commented Feb 1, 2013

sorry for my unfamiliar with Markdown

@sarxos
Copy link
Owner

sarxos commented Feb 1, 2013

To format text as source code you have to add ``` (same as ~ char but without shift pressed) before paragraph to open code block, and after to close it.

Example:

public class A { }

Will be changed to:

public class A { }

@sarxos
Copy link
Owner

sarxos commented Feb 1, 2013

Well... I'm not sure what can be a root cause. You can try the following:

  1. Download OpenIMAJGrabber.so for ARM 32 from webcam-capture repo,
  2. Drop it in the same directory where your JAR is located, or e.g. in /usr/lib,
  3. Make sure to set appropriate permissions, so all users will be able to read it.

In this case BridJ should load it directly without extracting it from JAR, however I'm really not sure if this will help.

You can also try to compile *.so object on your Raspberry Pi. To do that please download C++ code to your Raspberry Pi machine and run build-arm.sh. If there is any problem with the build you can ask question in OpenIMAJ JIRA.

There are probably many more things which could be done, but I'm not familiar with Raspberries and nothing more came into my mind except what I stated above :( Sorry for that...

@sarxos
Copy link
Owner

sarxos commented Feb 1, 2013

Could you please additionally describe this problem in nativelibs4java/nativelibs4java#364 (comment) so Olivier will be aware of it?

@He-Pin
Copy link
Author

He-Pin commented Feb 2, 2013

@sarxos hi,sorry for my lazy,i sleep a lot this weekend,and now my GF drag me to meet her sweet-mate..so sad...

i have report the issue to the nativelibs4java/nativelibs4java#364 (comment)

may be the way fix the bridj load issue on the Raspbian Wheezy will works for us too.

one words,it's so weird~

@He-Pin
Copy link
Author

He-Pin commented Feb 4, 2013

@sarxos
Hi,sarxos,thanks a lot,i tryed what you just said, after i copy the OpenIMAJGrabber.so to /usr/lib.his make no sence

the error is

pi@raspberrypi ~ $ java -jar webcam_test.jar 
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
# BridJ: dlopen error when loading /usr/lib/OpenIMAJGrabber.so : /usr/lib/OpenIMAJGrabber.so: cannot open shared object file: No such file or directory
# BridJ: dlopen error when loading /usr/lib/OpenIMAJGrabber.so : /usr/lib/OpenIMAJGrabber.so: cannot open shared object file: No such file or directory
# BridJ: dlopen error when loading /usr/lib/OpenIMAJGrabber.so : /usr/lib/OpenIMAJGrabber.so: cannot open shared object file: No such file or directory
# BridJ: dlopen error when loading /usr/lib/OpenIMAJGrabber.so : /usr/lib/OpenIMAJGrabber.so: cannot open shared object file: No such file or directory
# BridJ: dlopen error when loading /usr/lib/OpenIMAJGrabber.so : /usr/lib/OpenIMAJGrabber.so: cannot open shared object file: No such file or directory
# BridJ: dlopen error when loading /usr/lib/OpenIMAJGrabber.so : /usr/lib/OpenIMAJGrabber.so: cannot open shared object file: No such file or directory
# BridJ: dlopen error when loading /usr/lib/OpenIMAJGrabber.so : /usr/lib/OpenIMAJGrabber.so: cannot open shared object file: No such file or directory
# BridJ: dlopen error when loading /usr/lib/OpenIMAJGrabber.so : /usr/lib/OpenIMAJGrabber.so: cannot open shared object file: No such file or directory
# BridJ: dlopen error when loading /usr/lib/OpenIMAJGrabber.so : /usr/lib/OpenIMAJGrabber.so: cannot open shared object file: No such file or directory
# BridJ: dlopen error when loading /usr/lib/OpenIMAJGrabber.so : /usr/lib/OpenIMAJGrabber.so: cannot open shared object file: No such file or directory
java.lang.RuntimeException: Library 'OpenIMAJGrabber' was not loaded successfully from file '/usr/lib/OpenIMAJGrabber.so'
    at org.bridj.BridJ.getNativeLibrary(BridJ.java:921)
    at org.bridj.BridJ.getNativeLibrary(BridJ.java:900)
    at org.bridj.BridJ.getNativeLibrary(BridJ.java:513)
    at org.bridj.cpp.CPPRuntime.newCPPInstance(CPPRuntime.java:627)
    at org.bridj.cpp.CPPRuntime$CPPTypeInfo.initialize(CPPRuntime.java:833)
    at org.bridj.cpp.CPPRuntime$CPPTypeInfo.initialize(CPPRuntime.java:760)
    at org.bridj.CRuntime$CTypeInfo.initialize(CRuntime.java:219)
    at org.bridj.BridJ.initialize(BridJ.java:969)
    at org.bridj.NativeObject.<init>(NativeObject.java:23)
    at org.bridj.StructObject.<init>(StructObject.java:14)
    at org.bridj.cpp.CPPObject.<init>(CPPObject.java:27)
    at com.github.sarxos.webcam.ds.buildin.natives.OpenIMAJGrabber.<init>(OpenIMAJGrabber.java:64)
    at com.github.sarxos.webcam.ds.buildin.WebcamGrabberProcessor$NewGrabberTask.handle(WebcamGrabberProcessor.java:81)
    at com.github.sarxos.webcam.ds.buildin.WebcamGrabberProcessor$StaticProcessor.run(WebcamGrabberProcessor.java:52)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
    at java.lang.Thread.run(Thread.java:722)
Exception in thread "ProcessorThreadFactory" java.lang.RuntimeException: Failed to allocate new instance of type class com.github.sarxos.webcam.ds.buildin.natives.OpenIMAJGrabber
    at org.bridj.cpp.CPPRuntime.newCPPInstance(CPPRuntime.java:674)
    at org.bridj.cpp.CPPRuntime$CPPTypeInfo.initialize(CPPRuntime.java:833)
    at org.bridj.cpp.CPPRuntime$CPPTypeInfo.initialize(CPPRuntime.java:760)
    at org.bridj.CRuntime$CTypeInfo.initialize(CRuntime.java:219)
    at org.bridj.BridJ.initialize(BridJ.java:969)
    at org.bridj.NativeObject.<init>(NativeObject.java:23)
    at org.bridj.StructObject.<init>(StructObject.java:14)
    at org.bridj.cpp.CPPObject.<init>(CPPObject.java:27)
    at com.github.sarxos.webcam.ds.buildin.natives.OpenIMAJGrabber.<init>(OpenIMAJGrabber.java:64)
    at com.github.sarxos.webcam.ds.buildin.WebcamGrabberProcessor$NewGrabberTask.handle(WebcamGrabberProcessor.java:81)
    at com.github.sarxos.webcam.ds.buildin.WebcamGrabberProcessor$StaticProcessor.run(WebcamGrabberProcessor.java:52)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
    at java.lang.Thread.run(Thread.java:722)
Caused by: java.lang.RuntimeException: Library 'OpenIMAJGrabber' was not loaded successfully from file '/usr/lib/OpenIMAJGrabber.so'
    at org.bridj.BridJ.getNativeLibrary(BridJ.java:921)
    at org.bridj.BridJ.getNativeLibrary(BridJ.java:900)
    at org.bridj.BridJ.getNativeLibrary(BridJ.java:513)
    at org.bridj.cpp.CPPRuntime.newCPPInstance(CPPRuntime.java:627)

I think this may be the cause of #364
and the comment here:

@sarxos @hepin1989 Regarding the "file not found exception", this is the exception that occurs when you've >loaded the armhf bridj.so and then use it to try to load the armel OpenIMAJGrabber.so. Clearly this is the wrong >exception to raise - however it should cease to be a problem once the libraries for the different ABIs are >separated

thanks ,i will now move to the Arch Linux and take a try.

@sarxos
Copy link
Owner

sarxos commented Feb 4, 2013

Ok, hope this will permanently fix your problem :)

@He-Pin
Copy link
Author

He-Pin commented Feb 5, 2013

@sarxos after i change to the soft-float,it works

@sarxos
Copy link
Owner

sarxos commented Feb 5, 2013

Great! I'm glad it's now fixed.

I will close this ticket and create second one with reference this this problem. New ticket will be marked as feature and its goal will be to integrate Jonathon's changes regarding armel vs armhf support on Raspberry Pi for non Arch Linux distributions.

@He-Pin
Copy link
Author

He-Pin commented Feb 5, 2013

@sarxos ,really really thanks

@sarxos
Copy link
Owner

sarxos commented Feb 7, 2013

Hi @hepin1989,

Today I released Webcam Capture version 0.3.8, but I'm not able to test it on Raspberry Pi. Could you do me a favor and test it on your machine? Just run some basic examples and let me know if everything works fine. I would really appreciate your help.

It's worth to mention that from 0.3.8 webcam.open() has to be obligatory called before you try to get image. If you would like to open it automatically, as it was done in previous releases, then at the very beginning of your main() method or just before you try to use your Webcams, call static method:

Webcam.setAutoOpenMode(true);

In case of multi-threaded applications auto-open mode can have some negative drawbacks - see Javadoc comment on this method for more details.

Thank you and wish you Happy Spring Festival!

@He-Pin
Copy link
Author

He-Pin commented Feb 7, 2013

@sarxos if i use the bridj-0.6.3-20130201.095358-5.jar,it will always cause an problem ,and now the raspberry pi runs the soft-float debian but not the hart-float one,the support maybe after you merge the others' work

thanks lot.

@He-Pin
Copy link
Author

He-Pin commented Feb 7, 2013

@sarxos ,you are welcome,cause your project and you help me a lot.it's my pleasure,i report an netty issue today,it
can't receive the udp package on android from the NIODatagramChannel,the android's current DatagramChannel's implement is OK.

i will go back home tomorrow~
thanks~i will going to take a walk with my girlfirend

@He-Pin
Copy link
Author

He-Pin commented Feb 17, 2013

@sarxos ,i need to note you that all the test i have done is on the armel not on the armhf,your last release on the armel will still cause the probleam such as

pi@raspberrypi ~ $ java -jar WebcamTest_fat.jar 
Feb 17, 2013 6:27:15 AM com.github.sarxos.webcam.WebcamDriverUtils findDriver
INFO: Searching driver com.github.sarxos.webcam.ds.openimaj.OpenImajDriver
Feb 17, 2013 6:27:15 AM com.github.sarxos.webcam.WebcamDriverUtils findDriver
INFO: Searching driver com.github.sarxos.webcam.ds.civil.LtiCivilDriver
Feb 17, 2013 6:27:15 AM com.github.sarxos.webcam.WebcamDriverUtils findDriver
INFO: Searching driver com.github.sarxos.webcam.ds.jmf.JmfDriver
Feb 17, 2013 6:27:15 AM com.github.sarxos.webcam.Webcam getDriver
INFO: Webcam driver has not been found, default one will be used!
java.lang.RuntimeException: Failed to initialize BridJ
    at org.bridj.Platform.initLibrary(Platform.java:370)
    at org.bridj.Platform.<clinit>(Platform.java:175)
    at com.github.sarxos.webcam.ds.buildin.natives.OpenIMAJGrabber.<clinit>(OpenIMAJGrabber.java:59)
    at com.github.sarxos.webcam.ds.buildin.WebcamDefaultDriver.<clinit>(WebcamDefaultDriver.java:35)
    at com.github.sarxos.webcam.Webcam.getDriver(Webcam.java:500)
    at com.github.sarxos.webcam.Webcam.getDiscoveryService(Webcam.java:742)
    at com.github.sarxos.webcam.Webcam.getWebcams(Webcam.java:368)
    at com.github.sarxos.webcam.Webcam.getDefault(Webcam.java:428)
    at com.github.sarxos.webcam.Webcam.getDefault(Webcam.java:406)
    at com.github.sarxos.webcam.Webcam.getDefault(Webcam.java:388)
    at com.github.sarxos.webcam.TakePictureExample.main(TakePictureExample.java:23)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:601)
    at com.simontuffs.onejar.Boot.run(Boot.java:306)
    at com.simontuffs.onejar.Boot.main(Boot.java:159)
Caused by: java.lang.UnsatisfiedLinkError: /tmp/BridJExtractedLibraries2894329014618149903/bridj.so: /tmp/BridJExtractedLibraries2894329014618149903/bridj.so: cannot open shared object file: No such file or directory
    at java.lang.ClassLoader$NativeLibrary.load(Native Method)
    at java.lang.ClassLoader.loadLibrary1(ClassLoader.java:1935)
    at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1860)
    at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1821)
    at java.lang.Runtime.load0(Runtime.java:792)
    at java.lang.System.load(System.java:1059)
    at org.bridj.Platform.initLibrary(Platform.java:347)
    ... 16 more
Exception in thread "main" java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:601)
    at com.simontuffs.onejar.Boot.run(Boot.java:306)
    at com.simontuffs.onejar.Boot.main(Boot.java:159)
Caused by: java.lang.UnsatisfiedLinkError: org.bridj.Platform.sizeOf_ptrdiff_t()I
    at org.bridj.Platform.sizeOf_ptrdiff_t(Native Method)
    at org.bridj.Platform.<clinit>(Platform.java:179)
    at com.github.sarxos.webcam.ds.buildin.natives.OpenIMAJGrabber.<clinit>(OpenIMAJGrabber.java:59)
    at com.github.sarxos.webcam.ds.buildin.WebcamDefaultDriver.<clinit>(WebcamDefaultDriver.java:35)
    at com.github.sarxos.webcam.Webcam.getDriver(Webcam.java:500)
    at com.github.sarxos.webcam.Webcam.getDiscoveryService(Webcam.java:742)
    at com.github.sarxos.webcam.Webcam.getWebcams(Webcam.java:368)
    at com.github.sarxos.webcam.Webcam.getDefault(Webcam.java:428)
    at com.github.sarxos.webcam.Webcam.getDefault(Webcam.java:406)
    at com.github.sarxos.webcam.Webcam.getDefault(Webcam.java:388)
    at com.github.sarxos.webcam.TakePictureExample.main(TakePictureExample.java:23)
    ... 6 more

after i update the bridj to the last snapshot

pi@raspberrypi ~ $ java -jar WebcamTest_fat.jar 
Feb 17, 2013 6:45:12 AM com.github.sarxos.webcam.WebcamDriverUtils findDriver
INFO: Searching driver com.github.sarxos.webcam.ds.openimaj.OpenImajDriver
Feb 17, 2013 6:45:12 AM com.github.sarxos.webcam.WebcamDriverUtils findDriver
INFO: Searching driver com.github.sarxos.webcam.ds.civil.LtiCivilDriver
Feb 17, 2013 6:45:12 AM com.github.sarxos.webcam.WebcamDriverUtils findDriver
INFO: Searching driver com.github.sarxos.webcam.ds.jmf.JmfDriver
Feb 17, 2013 6:45:12 AM com.github.sarxos.webcam.Webcam getDriver
INFO: Webcam driver has not been found, default one will be used!
# BridJ: dlopen error when loading /tmp/BridJExtractedLibraries3132868083279348426/OpenIMAJGrabber.so : /tmp/BridJExtractedLibraries3132868083279348426/OpenIMAJGrabber.so: cannot open shared object file: No such file or directory
# BridJ: dlopen error when loading /tmp/BridJExtractedLibraries3132868083279348426/OpenIMAJGrabber.so : /tmp/BridJExtractedLibraries3132868083279348426/OpenIMAJGrabber.so: cannot open shared object file: No such file or directory
# BridJ: dlopen error when loading /tmp/BridJExtractedLibraries3132868083279348426/OpenIMAJGrabber.so : /tmp/BridJExtractedLibraries3132868083279348426/OpenIMAJGrabber.so: cannot open shared object file: No such file or directory
# BridJ: dlopen error when loading /tmp/BridJExtractedLibraries3132868083279348426/OpenIMAJGrabber.so : /tmp/BridJExtractedLibraries3132868083279348426/OpenIMAJGrabber.so: cannot open shared object file: No such file or directory
# BridJ: dlopen error when loading /tmp/BridJExtractedLibraries3132868083279348426/OpenIMAJGrabber.so : /tmp/BridJExtractedLibraries3132868083279348426/OpenIMAJGrabber.so: cannot open shared object file: No such file or directory
# BridJ: dlopen error when loading /tmp/BridJExtractedLibraries3132868083279348426/OpenIMAJGrabber.so : /tmp/BridJExtractedLibraries3132868083279348426/OpenIMAJGrabber.so: cannot open shared object file: No such file or directory
# BridJ: dlopen error when loading /tmp/BridJExtractedLibraries3132868083279348426/OpenIMAJGrabber.so : /tmp/BridJExtractedLibraries3132868083279348426/OpenIMAJGrabber.so: cannot open shared object file: No such file or directory
# BridJ: dlopen error when loading /tmp/BridJExtractedLibraries3132868083279348426/OpenIMAJGrabber.so : /tmp/BridJExtractedLibraries3132868083279348426/OpenIMAJGrabber.so: cannot open shared object file: No such file or directory
# BridJ: dlopen error when loading /tmp/BridJExtractedLibraries3132868083279348426/OpenIMAJGrabber.so : /tmp/BridJExtractedLibraries3132868083279348426/OpenIMAJGrabber.so: cannot open shared object file: No such file or directory
# BridJ: dlopen error when loading /tmp/BridJExtractedLibraries3132868083279348426/OpenIMAJGrabber.so : /tmp/BridJExtractedLibraries3132868083279348426/OpenIMAJGrabber.so: cannot open shared object file: No such file or directory
java.lang.RuntimeException: Library 'OpenIMAJGrabber' was not loaded successfully from file '/tmp/BridJExtractedLibraries3132868083279348426/OpenIMAJGrabber.so'
    at org.bridj.BridJ.getNativeLibrary(BridJ.java:921)
    at org.bridj.BridJ.getNativeLibrary(BridJ.java:900)
    at org.bridj.BridJ.getNativeLibrary(BridJ.java:513)
    at org.bridj.cpp.CPPRuntime.newCPPInstance(CPPRuntime.java:627)
    at org.bridj.cpp.CPPRuntime$CPPTypeInfo.initialize(CPPRuntime.java:833)
    at org.bridj.cpp.CPPRuntime$CPPTypeInfo.initialize(CPPRuntime.java:760)
    at org.bridj.CRuntime$CTypeInfo.initialize(CRuntime.java:219)
    at org.bridj.BridJ.initialize(BridJ.java:969)
    at org.bridj.NativeObject.<init>(NativeObject.java:23)
    at org.bridj.StructObject.<init>(StructObject.java:14)
    at org.bridj.cpp.CPPObject.<init>(CPPObject.java:27)
    at com.github.sarxos.webcam.ds.buildin.natives.OpenIMAJGrabber.<init>(OpenIMAJGrabber.java:64)
    at com.github.sarxos.webcam.ds.buildin.WebcamDefaultDriver.<clinit>(WebcamDefaultDriver.java:35)
    at com.github.sarxos.webcam.Webcam.getDriver(Webcam.java:500)
    at com.github.sarxos.webcam.Webcam.getDiscoveryService(Webcam.java:742)
    at com.github.sarxos.webcam.Webcam.getWebcams(Webcam.java:368)
    at com.github.sarxos.webcam.Webcam.getDefault(Webcam.java:428)
    at com.github.sarxos.webcam.Webcam.getDefault(Webcam.java:406)
    at com.github.sarxos.webcam.Webcam.getDefault(Webcam.java:388)
    at com.github.sarxos.webcam.TakePictureExample.main(TakePictureExample.java:23)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:601)
    at com.simontuffs.onejar.Boot.run(Boot.java:306)
    at com.simontuffs.onejar.Boot.main(Boot.java:159)
Exception in thread "main" java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:601)
    at com.simontuffs.onejar.Boot.run(Boot.java:306)
    at com.simontuffs.onejar.Boot.main(Boot.java:159)
Caused by: java.lang.ExceptionInInitializerError
    at com.github.sarxos.webcam.Webcam.getDriver(Webcam.java:500)
    at com.github.sarxos.webcam.Webcam.getDiscoveryService(Webcam.java:742)
    at com.github.sarxos.webcam.Webcam.getWebcams(Webcam.java:368)
    at com.github.sarxos.webcam.Webcam.getDefault(Webcam.java:428)
    at com.github.sarxos.webcam.Webcam.getDefault(Webcam.java:406)
    at com.github.sarxos.webcam.Webcam.getDefault(Webcam.java:388)
    at com.github.sarxos.webcam.TakePictureExample.main(TakePictureExample.java:23)
    ... 6 more
Caused by: java.lang.RuntimeException: Failed to allocate new instance of type class com.github.sarxos.webcam.ds.buildin.natives.OpenIMAJGrabber
    at org.bridj.cpp.CPPRuntime.newCPPInstance(CPPRuntime.java:674)
    at org.bridj.cpp.CPPRuntime$CPPTypeInfo.initialize(CPPRuntime.java:833)
    at org.bridj.cpp.CPPRuntime$CPPTypeInfo.initialize(CPPRuntime.java:760)
    at org.bridj.CRuntime$CTypeInfo.initialize(CRuntime.java:219)
    at org.bridj.BridJ.initialize(BridJ.java:969)
    at org.bridj.NativeObject.<init>(NativeObject.java:23)
    at org.bridj.StructObject.<init>(StructObject.java:14)
    at org.bridj.cpp.CPPObject.<init>(CPPObject.java:27)
    at com.github.sarxos.webcam.ds.buildin.natives.OpenIMAJGrabber.<init>(OpenIMAJGrabber.java:64)
    at com.github.sarxos.webcam.ds.buildin.WebcamDefaultDriver.<clinit>(WebcamDefaultDriver.java:35)
    ... 13 more
Caused by: java.lang.RuntimeException: Library 'OpenIMAJGrabber' was not loaded successfully from file '/tmp/BridJExtractedLibraries3132868083279348426/OpenIMAJGrabber.so'
    at org.bridj.BridJ.getNativeLibrary(BridJ.java:921)
    at org.bridj.BridJ.getNativeLibrary(BridJ.java:900)
    at org.bridj.BridJ.getNativeLibrary(BridJ.java:513)
    at org.bridj.cpp.CPPRuntime.newCPPInstance(CPPRuntime.java:627)
    ... 22 more

So ,it means now the armel support of the your great library is OK,but not armhf,and my previous test just on the armel.
thanks

@sarxos
Copy link
Owner

sarxos commented Feb 17, 2013

Yes, I'm aware of this. I saw that Jonathon is already working to add armhf support in OpenIMAJ. I will owe him a great beer ;]

@He-Pin
Copy link
Author

He-Pin commented Feb 18, 2013

@sarxos yes,i sensed that too,i just want you know that ,the current library just running fine on armel

@ochafik
Copy link

ochafik commented Feb 18, 2013

Hi guys,

I've just deployed a build of BridJ 0.6.3-SNAPSHOT that contains Linux binaries for both armhf and armel ABIs.
Can you please give it a try?

Cheers

@He-Pin
Copy link
Author

He-Pin commented Feb 18, 2013

@ochafik ,hi ,thanks a lot ,i will take a try after i finish my current test,
i will come back here again and let you know the test result.

@He-Pin
Copy link
Author

He-Pin commented Feb 18, 2013

@sarxos @ochafik
hi,i have tried this at the armhf raspberry pi Debian linux:
i just replace the old bridj0.6.2 to the last snapshot
and i cannot pass the test.
first,the simple thing,

pi@raspberrypi ~ $ java -jar WebcamTest_fat.jar 
Feb 18, 2013 9:58:45 AM com.github.sarxos.webcam.WebcamDriverUtils findDriver
INFO: Searching driver com.github.sarxos.webcam.ds.openimaj.OpenImajDriver
Feb 18, 2013 9:58:45 AM com.github.sarxos.webcam.WebcamDriverUtils findDriver
INFO: Searching driver com.github.sarxos.webcam.ds.civil.LtiCivilDriver
Feb 18, 2013 9:58:45 AM com.github.sarxos.webcam.WebcamDriverUtils findDriver
INFO: Searching driver com.github.sarxos.webcam.ds.jmf.JmfDriver
Feb 18, 2013 9:58:45 AM com.github.sarxos.webcam.Webcam getDriver
INFO: Webcam driver has not been found, default one will be used!
Feb 18, 2013 9:58:47 AM org.bridj.BridJ log
INFO: Library not found : OpenIMAJGrabber
# BridJ: dlopen error when loading OpenIMAJGrabber : OpenIMAJGrabber: cannot open shared object file: No such file or directory
Feb 18, 2013 9:58:48 AM org.bridj.BridJ log
INFO: Library not found : OpenIMAJGrabber
# BridJ: dlopen error when loading OpenIMAJGrabber : OpenIMAJGrabber: cannot open shared object file: No such file or directory
Feb 18, 2013 9:58:49 AM org.bridj.BridJ log
INFO: Library not found : OpenIMAJGrabber
# BridJ: dlopen error when loading OpenIMAJGrabber : OpenIMAJGrabber: cannot open shared object file: No such file or directory
Feb 18, 2013 9:58:50 AM org.bridj.BridJ log
INFO: Library not found : OpenIMAJGrabber
# BridJ: dlopen error when loading OpenIMAJGrabber : OpenIMAJGrabber: cannot open shared object file: No such file or directory
Feb 18, 2013 9:58:51 AM org.bridj.BridJ log
INFO: Library not found : OpenIMAJGrabber
# BridJ: dlopen error when loading OpenIMAJGrabber : OpenIMAJGrabber: cannot open shared object file: No such file or directory
Feb 18, 2013 9:58:51 AM org.bridj.BridJ log
INFO: Library not found : OpenIMAJGrabber
# BridJ: dlopen error when loading OpenIMAJGrabber : OpenIMAJGrabber: cannot open shared object file: No such file or directory
Feb 18, 2013 9:58:52 AM org.bridj.BridJ log
INFO: Library not found : OpenIMAJGrabber
# BridJ: dlopen error when loading OpenIMAJGrabber : OpenIMAJGrabber: cannot open shared object file: No such file or directory
Feb 18, 2013 9:58:53 AM org.bridj.BridJ log
INFO: Library not found : OpenIMAJGrabber
# BridJ: dlopen error when loading OpenIMAJGrabber : OpenIMAJGrabber: cannot open shared object file: No such file or directory
Feb 18, 2013 9:58:54 AM org.bridj.BridJ log
INFO: Library not found : OpenIMAJGrabber
# BridJ: dlopen error when loading OpenIMAJGrabber : OpenIMAJGrabber: cannot open shared object file: No such file or directory
Feb 18, 2013 9:58:55 AM org.bridj.BridJ log
INFO: Library not found : OpenIMAJGrabber
# BridJ: dlopen error when loading OpenIMAJGrabber : OpenIMAJGrabber: cannot open shared object file: No such file or directory
java.io.FileNotFoundException: Library 'OpenIMAJGrabber' was not found in path '[null, ., /usr/local/sbin, /usr/local/bin, /usr/sbin, /usr/bin, /sbin, /bin, /usr/local/games, /usr/games, /usr/java/packages/lib/arm, /usr/lib/arm-linux-gnueabihf/jni, /lib/arm-linux-gnueabihf, /usr/lib/arm-linux-gnueabihf, /usr/lib/jni, /lib, /usr/lib, /usr/lib/jvm/java-7-openjdk-armhf/jre/bin, /lib/arm-linux-gnueabi, /usr/lib/arm-linux-gnueabi, /usr/lib32, /lib32, /usr/lib, /lib, /usr/local/lib]'
    at org.bridj.BridJ.getNativeLibrary(BridJ.java:923)
    at org.bridj.BridJ.getNativeLibrary(BridJ.java:900)
    at org.bridj.BridJ.getNativeLibrary(BridJ.java:513)
    at org.bridj.cpp.CPPRuntime.newCPPInstance(CPPRuntime.java:627)
    at org.bridj.cpp.CPPRuntime$CPPTypeInfo.initialize(CPPRuntime.java:833)
    at org.bridj.cpp.CPPRuntime$CPPTypeInfo.initialize(CPPRuntime.java:760)
    at org.bridj.CRuntime$CTypeInfo.initialize(CRuntime.java:219)
    at org.bridj.BridJ.initialize(BridJ.java:969)
    at org.bridj.NativeObject.<init>(NativeObject.java:23)
    at org.bridj.StructObject.<init>(StructObject.java:14)
    at org.bridj.cpp.CPPObject.<init>(CPPObject.java:27)
    at com.github.sarxos.webcam.ds.buildin.natives.OpenIMAJGrabber.<init>(OpenIMAJGrabber.java:64)
    at com.github.sarxos.webcam.ds.buildin.WebcamDefaultDriver.<clinit>(WebcamDefaultDriver.java:35)
    at com.github.sarxos.webcam.Webcam.getDriver(Webcam.java:500)
    at com.github.sarxos.webcam.Webcam.getDiscoveryService(Webcam.java:742)
    at com.github.sarxos.webcam.Webcam.getWebcams(Webcam.java:368)
    at com.github.sarxos.webcam.Webcam.getDefault(Webcam.java:428)
    at com.github.sarxos.webcam.Webcam.getDefault(Webcam.java:406)
    at com.github.sarxos.webcam.Webcam.getDefault(Webcam.java:388)
    at com.github.sarxos.webcam.TakePictureExample.main(TakePictureExample.java:23)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:601)
    at com.simontuffs.onejar.Boot.run(Boot.java:306)
    at com.simontuffs.onejar.Boot.main(Boot.java:159)
Exception in thread "main" java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:601)
    at com.simontuffs.onejar.Boot.run(Boot.java:306)
    at com.simontuffs.onejar.Boot.main(Boot.java:159)
Caused by: java.lang.ExceptionInInitializerError
    at com.github.sarxos.webcam.Webcam.getDriver(Webcam.java:500)
    at com.github.sarxos.webcam.Webcam.getDiscoveryService(Webcam.java:742)
    at com.github.sarxos.webcam.Webcam.getWebcams(Webcam.java:368)
    at com.github.sarxos.webcam.Webcam.getDefault(Webcam.java:428)
    at com.github.sarxos.webcam.Webcam.getDefault(Webcam.java:406)
    at com.github.sarxos.webcam.Webcam.getDefault(Webcam.java:388)
    at com.github.sarxos.webcam.TakePictureExample.main(TakePictureExample.java:23)
    ... 6 more
Caused by: java.lang.RuntimeException: Failed to allocate new instance of type class com.github.sarxos.webcam.ds.buildin.natives.OpenIMAJGrabber
    at org.bridj.cpp.CPPRuntime.newCPPInstance(CPPRuntime.java:674)
    at org.bridj.cpp.CPPRuntime$CPPTypeInfo.initialize(CPPRuntime.java:833)
    at org.bridj.cpp.CPPRuntime$CPPTypeInfo.initialize(CPPRuntime.java:760)
    at org.bridj.CRuntime$CTypeInfo.initialize(CRuntime.java:219)
    at org.bridj.BridJ.initialize(BridJ.java:969)
    at org.bridj.NativeObject.<init>(NativeObject.java:23)
    at org.bridj.StructObject.<init>(StructObject.java:14)
    at org.bridj.cpp.CPPObject.<init>(CPPObject.java:27)
    at com.github.sarxos.webcam.ds.buildin.natives.OpenIMAJGrabber.<init>(OpenIMAJGrabber.java:64)
    at com.github.sarxos.webcam.ds.buildin.WebcamDefaultDriver.<clinit>(WebcamDefaultDriver.java:35)
    ... 13 more
Caused by: java.io.FileNotFoundException: Library 'OpenIMAJGrabber' was not found in path '[null, ., /usr/local/sbin, /usr/local/bin, /usr/sbin, /usr/bin, /sbin, /bin, /usr/local/games, /usr/games, /usr/java/packages/lib/arm, /usr/lib/arm-linux-gnueabihf/jni, /lib/arm-linux-gnueabihf, /usr/lib/arm-linux-gnueabihf, /usr/lib/jni, /lib, /usr/lib, /usr/lib/jvm/java-7-openjdk-armhf/jre/bin, /lib/arm-linux-gnueabi, /usr/lib/arm-linux-gnueabi, /usr/lib32, /lib32, /usr/lib, /lib, /usr/local/lib]'
    at org.bridj.BridJ.getNativeLibrary(BridJ.java:923)
    at org.bridj.BridJ.getNativeLibrary(BridJ.java:900)
    at org.bridj.BridJ.getNativeLibrary(BridJ.java:513)
    at org.bridj.cpp.CPPRuntime.newCPPInstance(CPPRuntime.java:627)
    ... 22 more

afther i copy the OpenIMAJGrabber.so to /usr/lib

pi@raspberrypi ~ $ java -jar WebcamTest_fat.jar 
Feb 18, 2013 9:58:02 AM com.github.sarxos.webcam.WebcamDriverUtils findDriver
INFO: Searching driver com.github.sarxos.webcam.ds.openimaj.OpenImajDriver
Feb 18, 2013 9:58:02 AM com.github.sarxos.webcam.WebcamDriverUtils findDriver
INFO: Searching driver com.github.sarxos.webcam.ds.civil.LtiCivilDriver
Feb 18, 2013 9:58:02 AM com.github.sarxos.webcam.WebcamDriverUtils findDriver
INFO: Searching driver com.github.sarxos.webcam.ds.jmf.JmfDriver
Feb 18, 2013 9:58:02 AM com.github.sarxos.webcam.Webcam getDriver
INFO: Webcam driver has not been found, default one will be used!
# BridJ: dlopen error when loading /usr/lib/OpenIMAJGrabber.so : /usr/lib/OpenIMAJGrabber.so: cannot open shared object file: No such file or directory
# BridJ: dlopen error when loading /usr/lib/OpenIMAJGrabber.so : /usr/lib/OpenIMAJGrabber.so: cannot open shared object file: No such file or directory
# BridJ: dlopen error when loading /usr/lib/OpenIMAJGrabber.so : /usr/lib/OpenIMAJGrabber.so: cannot open shared object file: No such file or directory
# BridJ: dlopen error when loading /usr/lib/OpenIMAJGrabber.so : /usr/lib/OpenIMAJGrabber.so: cannot open shared object file: No such file or directory
# BridJ: dlopen error when loading /usr/lib/OpenIMAJGrabber.so : /usr/lib/OpenIMAJGrabber.so: cannot open shared object file: No such file or directory
# BridJ: dlopen error when loading /usr/lib/OpenIMAJGrabber.so : /usr/lib/OpenIMAJGrabber.so: cannot open shared object file: No such file or directory
# BridJ: dlopen error when loading /usr/lib/OpenIMAJGrabber.so : /usr/lib/OpenIMAJGrabber.so: cannot open shared object file: No such file or directory
# BridJ: dlopen error when loading /usr/lib/OpenIMAJGrabber.so : /usr/lib/OpenIMAJGrabber.so: cannot open shared object file: No such file or directory
# BridJ: dlopen error when loading /usr/lib/OpenIMAJGrabber.so : /usr/lib/OpenIMAJGrabber.so: cannot open shared object file: No such file or directory
# BridJ: dlopen error when loading /usr/lib/OpenIMAJGrabber.so : /usr/lib/OpenIMAJGrabber.so: cannot open shared object file: No such file or directory
java.lang.RuntimeException: Library 'OpenIMAJGrabber' was not loaded successfully from file '/usr/lib/OpenIMAJGrabber.so'
    at org.bridj.BridJ.getNativeLibrary(BridJ.java:921)
    at org.bridj.BridJ.getNativeLibrary(BridJ.java:900)
    at org.bridj.BridJ.getNativeLibrary(BridJ.java:513)
    at org.bridj.cpp.CPPRuntime.newCPPInstance(CPPRuntime.java:627)
    at org.bridj.cpp.CPPRuntime$CPPTypeInfo.initialize(CPPRuntime.java:833)
    at org.bridj.cpp.CPPRuntime$CPPTypeInfo.initialize(CPPRuntime.java:760)
    at org.bridj.CRuntime$CTypeInfo.initialize(CRuntime.java:219)
    at org.bridj.BridJ.initialize(BridJ.java:969)
    at org.bridj.NativeObject.<init>(NativeObject.java:23)
    at org.bridj.StructObject.<init>(StructObject.java:14)
    at org.bridj.cpp.CPPObject.<init>(CPPObject.java:27)
    at com.github.sarxos.webcam.ds.buildin.natives.OpenIMAJGrabber.<init>(OpenIMAJGrabber.java:64)
    at com.github.sarxos.webcam.ds.buildin.WebcamDefaultDriver.<clinit>(WebcamDefaultDriver.java:35)
    at com.github.sarxos.webcam.Webcam.getDriver(Webcam.java:500)
    at com.github.sarxos.webcam.Webcam.getDiscoveryService(Webcam.java:742)
    at com.github.sarxos.webcam.Webcam.getWebcams(Webcam.java:368)
    at com.github.sarxos.webcam.Webcam.getDefault(Webcam.java:428)
    at com.github.sarxos.webcam.Webcam.getDefault(Webcam.java:406)
    at com.github.sarxos.webcam.Webcam.getDefault(Webcam.java:388)
    at com.github.sarxos.webcam.TakePictureExample.main(TakePictureExample.java:23)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:601)
    at com.simontuffs.onejar.Boot.run(Boot.java:306)
    at com.simontuffs.onejar.Boot.main(Boot.java:159)
Exception in thread "main" java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:601)
    at com.simontuffs.onejar.Boot.run(Boot.java:306)
    at com.simontuffs.onejar.Boot.main(Boot.java:159)
Caused by: java.lang.ExceptionInInitializerError
    at com.github.sarxos.webcam.Webcam.getDriver(Webcam.java:500)
    at com.github.sarxos.webcam.Webcam.getDiscoveryService(Webcam.java:742)
    at com.github.sarxos.webcam.Webcam.getWebcams(Webcam.java:368)
    at com.github.sarxos.webcam.Webcam.getDefault(Webcam.java:428)
    at com.github.sarxos.webcam.Webcam.getDefault(Webcam.java:406)
    at com.github.sarxos.webcam.Webcam.getDefault(Webcam.java:388)
    at com.github.sarxos.webcam.TakePictureExample.main(TakePictureExample.java:23)
    ... 6 more
Caused by: java.lang.RuntimeException: Failed to allocate new instance of type class com.github.sarxos.webcam.ds.buildin.natives.OpenIMAJGrabber
    at org.bridj.cpp.CPPRuntime.newCPPInstance(CPPRuntime.java:674)
    at org.bridj.cpp.CPPRuntime$CPPTypeInfo.initialize(CPPRuntime.java:833)
    at org.bridj.cpp.CPPRuntime$CPPTypeInfo.initialize(CPPRuntime.java:760)
    at org.bridj.CRuntime$CTypeInfo.initialize(CRuntime.java:219)
    at org.bridj.BridJ.initialize(BridJ.java:969)
    at org.bridj.NativeObject.<init>(NativeObject.java:23)
    at org.bridj.StructObject.<init>(StructObject.java:14)
    at org.bridj.cpp.CPPObject.<init>(CPPObject.java:27)
    at com.github.sarxos.webcam.ds.buildin.natives.OpenIMAJGrabber.<init>(OpenIMAJGrabber.java:64)
    at com.github.sarxos.webcam.ds.buildin.WebcamDefaultDriver.<clinit>(WebcamDefaultDriver.java:35)
    ... 13 more
Caused by: java.lang.RuntimeException: Library 'OpenIMAJGrabber' was not loaded successfully from file '/usr/lib/OpenIMAJGrabber.so'
    at org.bridj.BridJ.getNativeLibrary(BridJ.java:921)
    at org.bridj.BridJ.getNativeLibrary(BridJ.java:900)
    at org.bridj.BridJ.getNativeLibrary(BridJ.java:513)
    at org.bridj.cpp.CPPRuntime.newCPPInstance(CPPRuntime.java:627)
    ... 22 more

Thanks a lot, i tested this on armhf

@sarxos
Copy link
Owner

sarxos commented Feb 18, 2013

Hi guys, @ochafik, @hepin1989,

The OpenIMAJGrabber.so which is currently available in the repo is for armel only. For both armel and armhf please use the newest ones prepared by @jonhare and available in the OpenIMAJ repository. Thank you Jonathon for preparing this stuff so fast :)

@hepin1989, can you please repeat your test but use armhf version of OpenIMAJGRabber.so instead?

@He-Pin
Copy link
Author

He-Pin commented Feb 18, 2013

@sarxos ,i will re-test this tomorrow

@ochafik
Copy link

ochafik commented Feb 18, 2013

@hepin1989 thanks for the update. This would seem to indicate OpenIMAJGrabber just needs to be built for Linux/armhf (my understanding is that it's currently built for Linux/armel), which I guess should be done in #33.
(also, it should be embedded in a new path lib/linux_armel or lib/linux_armhf, see https://code.google.com/p/bridj/wiki/LibrariesLookup )

@He-Pin
Copy link
Author

He-Pin commented Feb 19, 2013

@sarxos ,when i scp @jonhare's armhf version to the pi,and then run the test this morning.
it comes to be the libv4l2 error,and i have install libv4l* on pi.
So ,in one word,it still not working,thanks.

pi@raspberrypi ~ $ java -jar WebcamTest_fat.jar 
Feb 19, 2013 2:08:05 AM com.github.sarxos.webcam.WebcamDriverUtils findDriver
INFO: Searching driver com.github.sarxos.webcam.ds.openimaj.OpenImajDriver
Feb 19, 2013 2:08:06 AM com.github.sarxos.webcam.WebcamDriverUtils findDriver
INFO: Searching driver com.github.sarxos.webcam.ds.civil.LtiCivilDriver
Feb 19, 2013 2:08:06 AM com.github.sarxos.webcam.WebcamDriverUtils findDriver
INFO: Searching driver com.github.sarxos.webcam.ds.jmf.JmfDriver
Feb 19, 2013 2:08:06 AM com.github.sarxos.webcam.Webcam getDriver
INFO: Webcam driver has not been found, default one will be used!
# BridJ: dlopen error when loading /home/pi/OpenIMAJGrabber.so : libv4l2.so.0: cannot open shared object file: No such file or directory
# BridJ: dlopen error when loading /home/pi/OpenIMAJGrabber.so : libv4l2.so.0: cannot open shared object file: No such file or directory
# BridJ: dlopen error when loading /home/pi/OpenIMAJGrabber.so : libv4l2.so.0: cannot open shared object file: No such file or directory
# BridJ: dlopen error when loading /home/pi/OpenIMAJGrabber.so : libv4l2.so.0: cannot open shared object file: No such file or directory
# BridJ: dlopen error when loading /home/pi/OpenIMAJGrabber.so : libv4l2.so.0: cannot open shared object file: No such file or directory
# BridJ: dlopen error when loading /home/pi/OpenIMAJGrabber.so : libv4l2.so.0: cannot open shared object file: No such file or directory
# BridJ: dlopen error when loading /home/pi/OpenIMAJGrabber.so : libv4l2.so.0: cannot open shared object file: No such file or directory
# BridJ: dlopen error when loading /home/pi/OpenIMAJGrabber.so : libv4l2.so.0: cannot open shared object file: No such file or directory
# BridJ: dlopen error when loading /home/pi/OpenIMAJGrabber.so : libv4l2.so.0: cannot open shared object file: No such file or directory
# BridJ: dlopen error when loading /home/pi/OpenIMAJGrabber.so : libv4l2.so.0: cannot open shared object file: No such file or directory
java.lang.RuntimeException: Library 'OpenIMAJGrabber' was not loaded successfully from file '/home/pi/OpenIMAJGrabber.so'
    at org.bridj.BridJ.getNativeLibrary(BridJ.java:921)
    at org.bridj.BridJ.getNativeLibrary(BridJ.java:900)
    at org.bridj.BridJ.getNativeLibrary(BridJ.java:513)
    at org.bridj.cpp.CPPRuntime.newCPPInstance(CPPRuntime.java:627)
    at org.bridj.cpp.CPPRuntime$CPPTypeInfo.initialize(CPPRuntime.java:833)
    at org.bridj.cpp.CPPRuntime$CPPTypeInfo.initialize(CPPRuntime.java:760)
    at org.bridj.CRuntime$CTypeInfo.initialize(CRuntime.java:219)
    at org.bridj.BridJ.initialize(BridJ.java:969)
    at org.bridj.NativeObject.<init>(NativeObject.java:23)
    at org.bridj.StructObject.<init>(StructObject.java:14)
    at org.bridj.cpp.CPPObject.<init>(CPPObject.java:27)
    at com.github.sarxos.webcam.ds.buildin.natives.OpenIMAJGrabber.<init>(OpenIMAJGrabber.java:64)
    at com.github.sarxos.webcam.ds.buildin.WebcamDefaultDriver.<clinit>(WebcamDefaultDriver.java:35)
    at com.github.sarxos.webcam.Webcam.getDriver(Webcam.java:500)
    at com.github.sarxos.webcam.Webcam.getDiscoveryService(Webcam.java:742)
    at com.github.sarxos.webcam.Webcam.getWebcams(Webcam.java:368)
    at com.github.sarxos.webcam.Webcam.getDefault(Webcam.java:428)
    at com.github.sarxos.webcam.Webcam.getDefault(Webcam.java:406)
    at com.github.sarxos.webcam.Webcam.getDefault(Webcam.java:388)
    at com.github.sarxos.webcam.TakePictureExample.main(TakePictureExample.java:23)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:601)
    at com.simontuffs.onejar.Boot.run(Boot.java:306)
    at com.simontuffs.onejar.Boot.main(Boot.java:159)
Exception in thread "main" java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:601)
    at com.simontuffs.onejar.Boot.run(Boot.java:306)
    at com.simontuffs.onejar.Boot.main(Boot.java:159)
Caused by: java.lang.ExceptionInInitializerError
    at com.github.sarxos.webcam.Webcam.getDriver(Webcam.java:500)
    at com.github.sarxos.webcam.Webcam.getDiscoveryService(Webcam.java:742)
    at com.github.sarxos.webcam.Webcam.getWebcams(Webcam.java:368)
    at com.github.sarxos.webcam.Webcam.getDefault(Webcam.java:428)
    at com.github.sarxos.webcam.Webcam.getDefault(Webcam.java:406)
    at com.github.sarxos.webcam.Webcam.getDefault(Webcam.java:388)
    at com.github.sarxos.webcam.TakePictureExample.main(TakePictureExample.java:23)
    ... 6 more
Caused by: java.lang.RuntimeException: Failed to allocate new instance of type class com.github.sarxos.webcam.ds.buildin.natives.OpenIMAJGrabber
    at org.bridj.cpp.CPPRuntime.newCPPInstance(CPPRuntime.java:674)
    at org.bridj.cpp.CPPRuntime$CPPTypeInfo.initialize(CPPRuntime.java:833)
    at org.bridj.cpp.CPPRuntime$CPPTypeInfo.initialize(CPPRuntime.java:760)
    at org.bridj.CRuntime$CTypeInfo.initialize(CRuntime.java:219)
    at org.bridj.BridJ.initialize(BridJ.java:969)
    at org.bridj.NativeObject.<init>(NativeObject.java:23)
    at org.bridj.StructObject.<init>(StructObject.java:14)
    at org.bridj.cpp.CPPObject.<init>(CPPObject.java:27)
    at com.github.sarxos.webcam.ds.buildin.natives.OpenIMAJGrabber.<init>(OpenIMAJGrabber.java:64)
    at com.github.sarxos.webcam.ds.buildin.WebcamDefaultDriver.<clinit>(WebcamDefaultDriver.java:35)
    ... 13 more
Caused by: java.lang.RuntimeException: Library 'OpenIMAJGrabber' was not loaded successfully from file '/home/pi/OpenIMAJGrabber.so'
    at org.bridj.BridJ.getNativeLibrary(BridJ.java:921)
    at org.bridj.BridJ.getNativeLibrary(BridJ.java:900)
    at org.bridj.BridJ.getNativeLibrary(BridJ.java:513)
    at org.bridj.cpp.CPPRuntime.newCPPInstance(CPPRuntime.java:627)
    ... 22 more

@He-Pin
Copy link
Author

He-Pin commented Feb 19, 2013

@sarxos @ochafik
I rebuild the so on pi,and now it's ok

@He-Pin
Copy link
Author

He-Pin commented Feb 19, 2013

@sarxos
Hi sarxos,i can now use it ,and i build it withoud the satic link with libv4l2,cause it can not found it ,even i config the ld path ,if i use the -L/usr/lib/arm-linux-gnueabihf/libv4l2.so,then i will cause an symble link error when run the test.

another question ,how to archive your ~250FPS?,

@sarxos
Copy link
Owner

sarxos commented Feb 19, 2013

OK, it would be good to pass this information to @jonhare so he is aware of the problem with his armhf *.so object.

I performed FPS test on my Windows XP SP3. I've tried to do the same on Linux, but v4l2 seems to have some bottlenecks which causes it to fetch images pretty slow (~10-15 FPS on my Ubuntu machine). Windows is using DirectShow for capture purpose - it is much faster - I have no problems to get ~50 FPS and more.

I think it would be a good idea to prepare some table which will show performance on all supported platforms since this general info I've put in description can be a little misleading. Will do that soon.

@He-Pin
Copy link
Author

He-Pin commented Feb 19, 2013

@sarxos Ok pi,with 302_240 nearly 7~ FPS,1024_768 nearly 2-4 FPS
,the v4l2 is what the lib used to handle the webcam?

@He-Pin
Copy link
Author

He-Pin commented Feb 19, 2013

I have found that on my ubuntu witch have 4 core ,can only archive 20~ FPS too.
And one more thing,the http://www.xuggle.com/xuggler is going stop....http://blog.xuggle.com/2013/02/05/on-hiatus/

@sarxos
Copy link
Owner

sarxos commented Feb 19, 2013

Yes, all capturing drivers which can be used in Webcam Capture (except ip-cam driver) use v4l2 on Linux. From what I found there is no alternative. On Windows there are two potential choices, i.e. DirectShow (all Windows versions supporting DirectX) or MF (this one only for Vista and above). On Mac OS there are also two potential choices, however both seems to use v4l2 finally. Those are Quicktime (via QTJava) and pure v4l2.

Damn, Xuggler was really good project :( I hope they release source code to the community.

@He-Pin
Copy link
Author

He-Pin commented Feb 19, 2013

@sarxos ,yes xuggler is an very good project ,and the source code is on the github.Thanks for the information about v4l2.

@sarxos
Copy link
Owner

sarxos commented Feb 19, 2013

@hepin1989

I used my build-in webcam to performed small experiment to check what aspects can possibly cause camera to work so dramatically slow.

The main problem in my case is a poor light. When camera do not have enough light, it automatically increase exposure time, which cause capturing rate to be reduced (so you don't get dark images), but when you take care of it and put more light on the scenario observed by the camera, it automatically decrease exposure time and images are taken very fast in effect.

In my experiment (performed on my Ubuntu Linux 64-bit) I used small program you've prepared and got 7 FPS in very dark place, about 10 FPS in grey light, and 30 FPS with normal bright light.

You can configure your camera to disable automated exposure setting, but you can get poor image quality as the effect of such operation.

@He-Pin
Copy link
Author

He-Pin commented Feb 20, 2013

@sarxos you know that ,i got this cause i test this code on pi,i think that may be the poor performance of raspberry pi.thanks for sharing this.thanks alot

@He-Pin
Copy link
Author

He-Pin commented Feb 20, 2013

@sarxos https://www.box.com/s/icvuyriv61ie45m6z44l my armhf version ,need to install the libv42l,i cant static link to it,i don't know why

@AtomicCactus
Copy link

Hey guys, I'm trying to use webcam-capture on the Beaglebone Black, running Ubuntu hard-float. I've build the OpenIMAJGrabber.so on the device, but now I'm getting the following error:

Java HotSpot(TM) Client VM warning: You have loaded library /tmp/BridJExtractedLibraries2631550482475098768/libbridj.so which might have disabled stack guard. The VM will try to fix the stack guard now.
It's highly recommended that you fix the library with 'execstack -c <libfile>', or link it with '-z noexecstack'.
Oct 13, 2013 3:10:47 AM org.bridj.BridJ log
INFO: Not enough args for null OpenIMAJGrabber.startSession(int, int, double)
Webcams:[Webcam UVC Camera (046d:0819) /dev/video0]
#
# A fatal error has been detected by the Java Runtime Environment:
#
#  SIGSEGV (0xb) at pc=0xab324762, pid=1235, tid=2872710256
#
# JRE version: Java(TM) SE Runtime Environment (8.0-b109) (build 1.8.0-ea-b109)
# Java VM: Java HotSpot(TM) Client VM (25.0-b51 mixed mode linux-arm )
# Problematic frame:
# C  [OpenIMAJGrabber.so+0x1762]  Device::getIdentifier()+0x9
#
# Failed to write core dump. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again
#
# An error report file with more information is saved as:
# /home/ubuntu/tracker/hs_err_pid1235.log
#
# If you would like to submit a bug report, please visit:
#   http://bugreport.sun.com/bugreport/crash.jsp
#
Aborted

@AtomicCactus
Copy link

Here's a more detailed output using -Dwebcam.debug=true -Dbridj.debug=true -Dbridj.veryVerbose=true -Dbridj.verbose=true

There's too much to paste here. Here's the java -version output:

java version "1.8.0-ea"
Java(TM) SE Runtime Environment (build 1.8.0-ea-b109)
Java HotSpot(TM) Client VM (build 25.0-b51, mixed mode)

@sarxos
Copy link
Owner

sarxos commented Oct 13, 2013

Hi,

Thank you for the report.

Can you please create separate issue for this? Please include the following:

  • What is the Webcam Capture version you are using,
  • Java version (from the above)
  • The newest hs_err_pid file
  • Verbose logs:
    • Set env variable OPENIMAJ_GRABBER_VERBOSE=true
    • Run your app with following JVM arguments -Dwebcam.debug=true -Dbridj.debug=true -Dbridj.veryVerbose=true -Dbridj.verbose=true
$ export OPENIMAJ_GRABBER_VERBOSE=true
$ java -Dwebcam.debug=true -Dbridj.debug=true -Dbridj.veryVerbose=true -Dbridj.verbose=true \
-cp [your.JARs.here] your.app.MainClass

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants