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

UnsatisfiedLinkError against OpenIMAJGrabber.startSession(IIILorg/bridj/Pointer;) #766

Open
sarxos opened this issue Mar 30, 2020 · 7 comments

Comments

@sarxos
Copy link
Owner

sarxos commented Mar 30, 2020

Opening Webcam cause this error on Linux machine:

21:02:21.519 [SwingWorker-pool-2-thread-1] DEBUG com.github.sarxos.webcam.Webcam - Webcam exception when opening
com.github.sarxos.webcam.WebcamException: Cannot execute task
	at com.github.sarxos.webcam.WebcamProcessor$AtomicProcessor.process(WebcamProcessor.java:72) ~[classes/:na]
	at com.github.sarxos.webcam.WebcamProcessor.process(WebcamProcessor.java:140) ~[classes/:na]
	at com.github.sarxos.webcam.WebcamTask.process(WebcamTask.java:46) ~[classes/:na]
	at com.github.sarxos.webcam.ds.cgt.WebcamOpenTask.open(WebcamOpenTask.java:20) ~[classes/:na]
	at com.github.sarxos.webcam.Webcam.open(Webcam.java:295) [classes/:na]
	at com.github.sarxos.webcam.Webcam.open(Webcam.java:250) [classes/:na]
	at com.github.sarxos.webcam.Webcam.open(Webcam.java:236) [classes/:na]
	at com.github.sarxos.webcam.WebcamPanel$1.doInBackground(WebcamPanel.java:840) [classes/:na]
	at com.github.sarxos.webcam.WebcamPanel$1.doInBackground(WebcamPanel.java:1) [classes/:na]
	at javax.swing.SwingWorker$1.call(SwingWorker.java:295) [na:1.8.0_201]
	at java.util.concurrent.FutureTask.run(FutureTask.java:266) [na:1.8.0_201]
	at javax.swing.SwingWorker.run(SwingWorker.java:334) [na:1.8.0_201]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [na:1.8.0_201]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [na:1.8.0_201]
	at java.lang.Thread.run(Thread.java:748) [na:1.8.0_201]
Caused by: java.lang.UnsatisfiedLinkError: com.github.sarxos.webcam.ds.buildin.natives.OpenIMAJGrabber.startSession(IIILorg/bridj/Pointer;)Z
	at com.github.sarxos.webcam.ds.buildin.natives.OpenIMAJGrabber.startSession(Native Method) ~[classes/:na]
	at com.github.sarxos.webcam.ds.buildin.WebcamDefaultDevice.open(WebcamDefaultDevice.java:332) ~[classes/:na]
	at com.github.sarxos.webcam.ds.cgt.WebcamOpenTask.handle(WebcamOpenTask.java:38) ~[classes/:na]
	at com.github.sarxos.webcam.WebcamProcessor$AtomicProcessor.run(WebcamProcessor.java:81) ~[classes/:na]
	... 3 common frames omitted
@sarxos
Copy link
Owner Author

sarxos commented Mar 30, 2020

Hi @kkieffer

This issue is caused by a method parameter signature being changed from double to int in your commit here:

https://github.com/sarxos/webcam-capture/pull/765/files#diff-492ecf2a3cddaf20cf2f0e1a230fa31d.

I initially thought it's a valid change since it's only normal to assume that FPS is int, but it looks like BridJ needs it to be double to link correct function exported in native library, thus I'm reverting it back to how it was before.

Can you please test newest 0.3.13-SNAPSHOT on your MacOS machine to verify if this change works well? I have no access to Apple boxes and can't verify it.

@kkieffer
Copy link
Contributor

It won't compile correctly if it's a double. The native code wants an int. See the native source here, where reqMillisPerFrame is an int:

image

@sarxos
Copy link
Owner Author

sarxos commented Mar 30, 2020

@kkieffer

Ok, I understand now why you had to change it. Let me check why it's not linking on my Linux box. I suppose there is a bug somewhere else in the code or pom since OpenIMAJ also have int in OpenIMAJGrabber class.

@sarxos
Copy link
Owner Author

sarxos commented Mar 30, 2020

@kkieffer

Nailed it. The so files for x64 and x86 Linux are outdated (others probably as well). I will update them and change double to int as it should be.

@sarxos
Copy link
Owner Author

sarxos commented Mar 30, 2020

@kkieffer Thank you for your help. Everything should be working now. Can I ask you one more time to verify if the 0.3.13-SNAPSHOT is working well on Mac? I suppose it should be working but better be safe than sorry :) The latest snapshot is already deployed in Sonatype and available here.

@kkieffer
Copy link
Contributor

Working!

@sarxos
Copy link
Owner Author

sarxos commented Apr 1, 2020

Great. Thank you!

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

No branches or pull requests

2 participants