UnsatisfiedLinkError when running Sikuli-IDE built by myself

Asked by viewrain

My computer is Mac 10.5.8, java version is "1.5.0_24".
I download the code via Bazaar(bzr branch lp:sikuli). And build it according to the "build-mac.txt" in "sikuli" directory (before building it, I uncomment the "openURL" method in "sikuli-ide/src/main/java/edu/mit/csail/uid/SikuliIDE.java" for Mac OS X 10.5 (Java5)). Then I get the "Sikuli-IDE-osx-10.5-0.10.2.zip".
 I run the built Sikuli-IDE, the GUI works fine, I click the "click" button on the left, then select a region successfully, but when I run it, it cannot find the image:
[sikuli] Stopped
[sikuli] An error occurs at line 1
[sikuli] Error message:
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/Applications/Sikuli-IDE.app/Contents/Resources/Java/sikuli-script.jar/Lib/sikuli/Sikuli.py", line 18, in <module>
java.lang.UnsatisfiedLinkError: /Applications/Sikuli-IDE.app/Contents/Frameworks/libScreenMatchProxy.jnilib: Library not loaded: @executable_path/../Frameworks/libdirac_decoder.0.dylib Referenced from: /Applications/Sikuli-IDE.app/./Contents/MacOS/../Frameworks/libavutil.dylib Reason: image not found
 at java.lang.ClassLoader$NativeLibrary.load(Native Method)
 at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1824)
 at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1704)
 at java.lang.Runtime.load0(Runtime.java:769)
 at java.lang.System.load(System.java:968)
 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:164)
 at org.python.core.SyspathJavaLoader.loadClass(SyspathJavaLoader.java:107)
 at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
 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(/Applications/Sikuli-IDE.app/Contents/Resources/Java/sikuli-script.jar/Lib/sikuli/Sikuli.py:166)
 at sikuli.Sikuli$py.call_function(/Applications/Sikuli-IDE.app/Contents/Resources/Java/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:1214)
 at edu.mit.csail.uid.SikuliIDE$ButtonRun$1.run(SikuliIDE.java:1312)

java.lang.UnsatisfiedLinkError: java.lang.UnsatisfiedLinkError: /Applications/Sikuli-IDE.app/Contents/Frameworks/libScreenMatchProxy.jnilib: Library not loaded: @executable_path/../Frameworks/libdirac_decoder.0.dylib Referenced from: /Applications/Sikuli-IDE.app/./Contents/MacOS/../Frameworks/libavutil.dylib Reason: image not found

Is there anyone know how to solve this? Thanks very much~

Question information

Language:
English Edit question
Status:
Solved
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Solved by:
Tsung-Hsiang Chang
Solved:
Last query:
Last reply:
Revision history for this message
niknah (hankin0) said :
#1

I don't have a mac but I noticed that you've got java 1.5, in the front page of sikuli it says you need java 6.

Revision history for this message
viewrain (viewrain) said :
#2

Thanks for you information. I've changed to java 6. But the problem still exists. Does anyone build the source code?

Revision history for this message
viewrain (viewrain) said :
#3

Finally I've solved this problem by a very strange solution.
I change the name "Sikuli-IDE.app" to another name, such as "Sikuli-IDE2.app". And it works!!!
Something special is that after double-click the "Sikuli-IDE2.app", there's a "tmplib" directory generated automatically.

Is anyone know why it happens?

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

Your own build included a library libavutil.dylib, which depends on libdirac_decoder.0.dylib that was not packed into Sikuli-IDE.app. Maybe it's our script's fault, but I am not sure. (See the app-frameworks target in sikuli-ide/Makefile.Darwin.)

After you changed the app name, Sikuli-IDE couldn't find the libs in Sikuli-IDE.app/Contents/Frameworks/ anymore, so it extracted the jnilibs it needed from sikuli-script.jar to tmplib/ automatically. Note these self-extracted libs depend on more libs on your machine but not the libs that were packed into the Sikuli-IDE.app. In other words, you own Sikuli-IDE.app can't be ported to the other machines unless they have the same dependent libs in the same paths. (Use otool -L tmplib/*.jnilib to see their dependencies.)

Revision history for this message
viewrain (viewrain) said :
#5

 Thanks very much. After I copy all the dependent "dylib"s into "Content/Framework", it works fine and the "tmplib" doesn't appear any more. I think it's the fault of "Makefile.Darwin". Because it doesn't find the dependencies recursively. In Makefile.Darwin, it adds the dependencies of "Sikuli-IDE.app/Contents/Frameworks/*.dylib" into "Frameworks", so "libavutil.dylib"( which is one of the dependencies) is added into "Frameworks". But "libavutil.dylib" has its own dependencies which are not packed.

Revision history for this message
viewrain (viewrain) said :
#6

Thanks Tsung-Hsiang Chang, that solved my question.