edu.mit.csail.uid has to be replaced by org.sikuli.script when using sikuli-script.jar in Java

Asked by Kristian Karl

Hi,

I get an UnsatisfiedLinkError when I'm using the sikuli-script.jar in my java program. In my program I do:
screen.wait("image.png", 30);
and there it stops...

Here's some info:
The stack trace
Caused by: java.lang.UnsatisfiedLinkError: edu.mit.csail.uid.VisionProxyJNI.Vision_initOCR(Ljava/lang/String;)V
 at edu.mit.csail.uid.VisionProxyJNI.Vision_initOCR(Native Method)
 at edu.mit.csail.uid.Vision.initOCR(Vision.java:47)
 at edu.mit.csail.uid.TextRecognizer.init(TextRecognizer.java:40)
 at edu.mit.csail.uid.TextRecognizer.<init>(TextRecognizer.java:24)
 at edu.mit.csail.uid.TextRecognizer.getInstance(TextRecognizer.java:45)
 at edu.mit.csail.uid.TextRecognizer.<clinit>(TextRecognizer.java:16)
 at edu.mit.csail.uid.Finder.<clinit>(Finder.java:22)
 at edu.mit.csail.uid.Region.findNow(Region.java:554)
 at edu.mit.csail.uid.Region.wait(Region.java:257)
 at com.spotify.qa.common.gui.Login.verifyInitial(Login.java:11)
 at com.spotify.qa.test.LoginCrashTest.v_LoginPrompted(LoginCrashTest.java:125)
 ... 12 more

Sikuli version: Sikuli-X-1.0rc1-linux 64-bit

Operation system: Linux 64-bit, Kubuntu 10.10

I have opencv 2.1 installed.
$ ls -l /usr/lib/libcv*
lrwxrwxrwx 1 root root 17 2010-10-11 09:35 /usr/lib/libcvaux.so.2.1 -> libcvaux.so.2.1.0
-rw-r--r-- 1 root root 1219696 2010-09-25 22:32 /usr/lib/libcvaux.so.2.1.0
lrwxrwxrwx 1 root root 14 2010-10-11 09:35 /usr/lib/libcv.so.2.1 -> libcv.so.2.1.0
-rw-r--r-- 1 root root 2596856 2010-09-25 22:32 /usr/lib/libcv.so.2.1.0

Question information

Language:
English Edit question
Status:
Solved
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Solved by:
Kristian Karl
Solved:
Last query:
Last reply:
Revision history for this message
RaiMan (raimund-hocke) said :
#1

seems to be a problem with the NativeLoader in the situation, when using sikuli-script.jar in the standalone version (e.g. directly from Java)

Revision history for this message
Kristian Karl (kristian-hermann-karl) said :
#2

I tried the proposed solution in Bug #694771, renaming the .so libraries in META-INF/lib (in the sikuli-script.jar) to either .jnilib or dynlib, but it did not work. :-(
I think I'll need solution to that bug.

Revision history for this message
RaiMan (raimund-hocke) said :
#3
Revision history for this message
Tsung-Hsiang Chang (vgod) said :
#4

I'm not sure why this happens on Linux. Can you help me to identify the problem?

Can you try to add the path to "the-path-to-sikuli/Sikuli-IDE/libs" to LD_LIBRARY_PATH and see if it works?
If not, try another way: in the working directory of your java program, create a symlink named "libs" pointing to the-path-to-sikuli/Sikuli-IDE/libs.

Let me know if any of these methods works for you.

Revision history for this message
Kristian Karl (kristian-hermann-karl) said :
#5

I tried adding LD_LIBRARY_PATH, but it did not work..
LD_LIBRARY_PATH=/opt/sikuli/X/Sikuli-IDE/libs java -cp /opt/sikuli/X/Sikuli-IDE/sikuli-script.jar:target/foo.jar com.spotify.qa.foo.App
Sikuli vision engine loaded.
Text Recgonizer inited.
Exception in thread "main" java.lang.UnsatisfiedLinkError: edu.mit.csail.uid.VisionProxyJNI.Vision_initOCR(Ljava/lang/String;)V
 at edu.mit.csail.uid.VisionProxyJNI.Vision_initOCR(Native Method)
 at edu.mit.csail.uid.Vision.initOCR(Vision.java:47)
 at edu.mit.csail.uid.TextRecognizer.init(TextRecognizer.java:40)
 at edu.mit.csail.uid.TextRecognizer.<init>(TextRecognizer.java:24)
 at edu.mit.csail.uid.TextRecognizer.getInstance(TextRecognizer.java:45)
 at edu.mit.csail.uid.TextRecognizer.<clinit>(TextRecognizer.java:16)
 at edu.mit.csail.uid.Finder.<clinit>(Finder.java:22)
 at edu.mit.csail.uid.Region.findNow(Region.java:554)
 at edu.mit.csail.uid.Region.wait(Region.java:257)
 at edu.mit.csail.uid.Region.find(Region.java:215)
 at com.spotify.qa.foo.App.main(App.java:13)

And I just repeated the same error on a Windows box. (running under cygwin). Go figure...
I used the same version as for Linux, that is X-1.0rc1

Could it be that the method Vision_initOCR is getting an empty string?

Revision history for this message
Tsung-Hsiang Chang (vgod) said :
#6

Oh, I see the problem. The java package in X have been changed to org.sikuli.script. So you need to replace all "edu.mit.csail.uid" to "org.sikuli.script".
Sorry we haven't updated the java doc yet.

Revision history for this message
Kristian Karl (kristian-hermann-karl) said :
#7

Yupp! That's it! Changing to org.sikuli made it work.

But, why did it compile using edu.mit.csail.uid?

Revision history for this message
Tsung-Hsiang Chang (vgod) said :
#8

I guess the JAR in your CLASSPATH is not cleaned. It still has the old class files.

Revision history for this message
Kristian Karl (kristian-hermann-karl) said :
#9

Hmm, if you look in the sikuli-script.jar, there actually exists /edu/mit/csail/uid/*.class files. I guess that's the old stuff?

Revision history for this message
Tsung-Hsiang Chang (vgod) said :
#10

yeah, they are the old things and should not be there. We will fix this in the next release.

Revision history for this message
Kristian Karl (kristian-hermann-karl) said :
#11

Anyways, thanx for all help!!

Revision history for this message
thomas kessler (thomas-kessler) said :
#12

Am running Sikuli on EL6 Linux 64 and recorded something to start. Went to playback and got a link error:

[sikuli] Stopped
[sikuli] An error occurs at line 1
[sikuli] Error message:
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/home/fahome/tkessler/sikuli/sikuli-script.jar/Lib/sikuli/Sikuli.py", line 18, in <module>
java.lang.UnsatisfiedLinkError: /home/fahome/tkessler/sikuli/tmplib/libScreenMatchProxy.so: libcv.so.4: cannot open shared object file: No such file or directory
 at java.lang.ClassLoader$NativeLibrary.load(Native Method)
 at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1803)
 at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1699)
 at java.lang.Runtime.load0(Runtime.java:770)
 at java.lang.System.load(System.java:1003)
 at com.wapmx.nativeutils.jniloader.NativeLoader.loadLibrary(NativeLoader.java:44)
 at edu.mit.csail.uid.Finder.<clinit>(Finder.java:16)
 at java.lang.Class.forName0(Native Method)
 at java.lang.Class.forName(Class.java:169)
 at org.python.core.SyspathJavaLoader.loadClass(SyspathJavaLoader.java:107)
 at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
 at org.python.core.Py.findClassEx(Py.java:817)
 at org.python.core.packagecache.SysPackageManager.findClass(SysPackageManager.java:133)
 at org.python.core.packagecache.PackageManager.findClass(PackageManager.java:28)
 at org.python.core.packagecache.SysPackageManager.findClass(SysPackageManager.java:122)
 at org.python.core.PyJavaPackage.__findattr_ex__(PyJavaPackage.java:137)
 at org.python.core.PyObject.__findattr__(PyObject.java:869)
 at org.python.core.imp.import_name(imp.java:771)
 at org.python.core.imp.importName(imp.java:806)
 at org.python.core.ImportFunction.__call__(__builtin__.java:1232)
 at org.python.core.PyObject.__call__(PyObject.java:367)
 at org.python.core.__builtin__.__import__(__builtin__.java:1202)
 at org.python.core.imp.importFromAs(imp.java:884)
 at org.python.core.imp.importFrom(imp.java:860)
 at sikuli.Sikuli$py.f$0(/home/fahome/tkessler/sikuli/sikuli-script.jar/Lib/sikuli/Sikuli.py:165)
 at sikuli.Sikuli$py.call_function(/home/fahome/tkessler/sikuli/sikuli-script.jar/Lib/sikuli/Sikuli.py)
 at org.python.core.PyTableCode.call(PyTableCode.java:165)
 at org.python.core.PyCode.call(PyCode.java:18)
 at org.python.core.imp.createFromCode(imp.java:326)
 at org.python.core.util.importer.importer_load_module(importer.java:109)
 at org.python.modules.zipimport.zipimporter.zipimporter_load_module(zipimporter.java:161)
 at org.python.modules.zipimport.zipimporter$zipimporter_load_module_exposer.__call__(Unknown Source)
 at org.python.core.PyBuiltinMethodNarrow.__call__(PyBuiltinMethodNarrow.java:47)
 at org.python.core.imp.loadFromLoader(imp.java:451)
 at org.python.core.imp.find_module(imp.java:408)
 at org.python.core.PyModule.impAttr(PyModule.java:109)
 at org.python.core.imp.import_next(imp.java:637)
 at org.python.core.imp.import_logic(imp.java:699)
 at org.python.core.imp.import_name(imp.java:761)
 at org.python.core.imp.importName(imp.java:806)
 at org.python.core.ImportFunction.__call__(__builtin__.java:1232)
 at org.python.core.PyObject.__call__(PyObject.java:367)
 at org.python.core.__builtin__.__import__(__builtin__.java:1202)
 at org.python.core.__builtin__.__import__(__builtin__.java:1185)
 at org.python.core.imp.importAll(imp.java:904)
 at org.python.pycode._pyx2.f$0(<string>:1)
 at org.python.pycode._pyx2.call_function(<string>)
 at org.python.core.PyTableCode.call(PyTableCode.java:165)
 at org.python.core.PyCode.call(PyCode.java:18)
 at org.python.core.Py.runCode(Py.java:1204)
 at org.python.core.Py.exec(Py.java:1248)
 at org.python.util.PythonInterpreter.exec(PythonInterpreter.java:172)
 at edu.mit.csail.uid.ScriptRunner.runPython(ScriptRunner.java:52)
 at edu.mit.csail.uid.SikuliIDE$ButtonRun.runPython(SikuliIDE.java:1238)
 at edu.mit.csail.uid.SikuliIDE$ButtonRun$1.run(SikuliIDE.java:1336)

java.lang.UnsatisfiedLinkError: java.lang.UnsatisfiedLinkError: /home/fahome/tkessler/sikuli/tmplib/libScreenMatchProxy.so: libcv.so.4: cannot open shared object file: No such file or directory

~~~~~~~~~~~~

Opened up the /home/fahome/tkessler/sikuli/sikuli-script.jar/Lib/sikuli/Sikuli.py file in Ark and noticed all kinds of edu.nit.csail references. Do I need to replace these to "org.sikuli.script" like you mentioned above?

Revision history for this message
thomas kessler (thomas-kessler) said :
#13

Hmm, tried that and it didn't work... downloaded the X-1.0rc1 version and now get this instead and stuck:

[debug] [Linux] install hotkey: CTRL+SHIFT+2 for onQuickCapture
[debug] [Linux] install hotkey: ALT+SHIFT+C for onStopRunning
Exception in thread "AWT-EventQueue-0" java.lang.UnsatisfiedLinkError: /home/fahome/tkessler/sikuli/Sikuli-X-1.0rc1-linux/Sikuli-IDE/libs/libVisionProxy.so: libml.so.2.1: cannot open shared object file: No such file or directory
 at java.lang.ClassLoader$NativeLibrary.load(Native Method)
 at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1803)
 at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1699)
 at java.lang.Runtime.load0(Runtime.java:770)
 at java.lang.System.load(System.java:1003)
 at com.wapmx.nativeutils.jniloader.NativeLoader.loadLibrary(NativeLoader.java:44)
 at org.sikuli.script.TextRecognizer.<clinit>(TextRecognizer.java:15)
 at org.sikuli.ide.NamingPane.getFilenameFromImage(NamingPane.java:50)
 at org.sikuli.ide.CaptureButton.update(CaptureButton.java:141)
 at org.sikuli.script.CapturePrompt.notifyObserver(CapturePrompt.java:39)
 at org.sikuli.script.CapturePrompt$1.mouseReleased(CapturePrompt.java:190)
 at java.awt.Component.processMouseEvent(Component.java:6267)
 at java.awt.Component.processEvent(Component.java:6032)
 at java.awt.Container.processEvent(Container.java:2041)
 at java.awt.Window.processEvent(Window.java:1836)
 at java.awt.Component.dispatchEventImpl(Component.java:4630)
 at java.awt.Container.dispatchEventImpl(Container.java:2099)
 at java.awt.Window.dispatchEventImpl(Window.java:2478)
 at java.awt.Component.dispatchEvent(Component.java:4460)
 at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)
 at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
 at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
 at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
 at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
 at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
 at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)

Revision history for this message
RaiMan (raimund-hocke) said :
#14

You need openCV 2.1 installed as mentioned in the prerequisites.

Revision history for this message
RaiMan (raimund-hocke) said :
#15

and you have to remove all 10.2 stuff completely!

BTW: when posting a comment to an exisiting question, subscribe yourself to the question, to be notified when commented.

Revision history for this message
thomas kessler (thomas-kessler) said :
#16

I deleted the directory from my previous installation. Checked to be emailed for future discussion too...

Found OpenCV and downloaded it. Looks like lots of source code and I don't see how to install it or installation instructions for Sikuli Linux anywhere on the site am I missing it?

Can you help me step by step of what I need to do to get Sikuli to work on Linux 64?

Thanks,

Tom

Revision history for this message
RaiMan (raimund-hocke) said :
#17

Uuups, I do not have Linux (only Mac and Windows, no need to install openCV, it is in distribution).

A few month ago I tried to install openCV on my Mac (at least Unix like) and finally succeeded. all I had was the information at: http://opencv.willowgarage.com/wiki/FullOpenCVWiki.
I used the cmake approach using the source. On Linux this is definitely easier than on Mac ;-)

And you need the actual Java JRE, but I guess you have it already.

Then sikuli-ide.sh should bring up Sikuli IDE. Good luck.

Revision history for this message
RaiMan (raimund-hocke) said :
#18

If you really need help, you should post a new question with as many information about your environment and situation as possible. More than 300 downloads of the Linux 64-Bit version are out there now.