(Mac) About "NativeLibrary - libopencv_core.2.2.dylib"

Asked by Yang

Env: Mac 10.6.8
IDE: Eclipse Java EE

Setup my Java project by following http://sikuli.org/wiki/How%20to%20use%20Sikuli%20Script%20in%20your%20JAVA%20programs

Then,

"Image not found" was reported and "libopencv_core.2.2.dylib" couldn't be found in "/usr/loca/lib". But the directory was not existing in my mac book.

Then I followed Id_179273 to copy all native lib to the same directory with sikuli_scripts.jar, but didn't work.

Finally, I manually created the "lib" folder in my "/usr/local", and copy all lib into it, it fixed the problem.

In Id_179273, it was said the lib should be at the same directory with sikuli_scripts.jar. But it looks sikuli didn't go to that directory to find the native lib.

Question information

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

Below is the stack dump when error happened. For your reference.

java.lang.UnsatisfiedLinkError: /private/var/folders/Hr/Hr2lC+vpFE42INyuPBhilE+++TI/-Tmp-/tmplib/libVisionProxy.jnilib: Library not loaded: /usr/local/lib/libopencv_core.2.2.dylib Referenced from: /private/var/folders/Hr/Hr2lC+vpFE42INyuPBhilE+++TI/-Tmp-/tmplib/libVisionProxy.jnilib Reason: image not found
 at java.lang.ClassLoader$NativeLibrary.load(Native Method)
 at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1827)
 at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1703)
 at java.lang.Runtime.load0(Runtime.java:770)
 at java.lang.System.load(System.java:1020)
 at com.wapmx.nativeutils.jniloader.NativeLoader.loadLibrary(NativeLoader.java:44)
 at org.sikuli.script.Finder.<clinit>(Finder.java:33)
 at org.sikuli.script.Region.doFind(Region.java:1029)
 at org.sikuli.script.Region$RepeatableFind.run(Region.java:1232)
 at org.sikuli.script.Region$Repeatable.repeat(Region.java:1203)
 at org.sikuli.script.Region.wait(Region.java:497)
 at org.sikuli.script.Region.find(Region.java:381)
 at org.sikuli.script.Region.getLocationFromPSRML(Region.java:1129)
 at org.sikuli.script.Region.click(Region.java:606)
 at sy.parameter.AdvancedSearch.testAdvancedSearch(AdvancedSearch.java:54)
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
 at java.lang.reflect.Method.invoke(Method.java:597)
 at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:45)
 at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
 at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:42)
 at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
 at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
 at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:30)
 at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:263)
 at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:68)
 at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:47)
 at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231)
 at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60)
 at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229)
 at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50)
 at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222)
 at org.junit.runners.ParentRunner.run(ParentRunner.java:300)
 at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
 at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
 at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
 at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
 at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
 at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)

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

Even when programming in Java, it is recommended to have the normal install of Sikuli IDE in the /Applications folder.

Every thing, that is needed comes with Sikuli's Mac package and will then be found in its standard location in
/Applications/Sikuli-IDE.app/Contents/Framework

In your Eclipse project, you only need a library reference to
/Applications/Sikuli-IDE.app/Contents/Resources/Java/sikuli-script.jar
(do not copy it into your project, just a reference using a path variable, since Eclipse cannot step into app bundles, when defining jar library references)

Revision history for this message
Yang (yang-shen2011) said :
#3

Thanks for the prompt response.

I did install Sikuli-IDE, but after the installation, the IDE looks always appearing as a virtual drive. In Eclipse, I couldn't include any external JAR from the drive. That's why I copied the jar out to my local Macintosh drive.

I guess there should be some way to install Sikuli IDE as a normal Mac App, but I didn't find it out.

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

On Mac Sikuli uses the standard "application install".

What you download, is a .dmg (disk image). If you open it, you have Sikuli-IDE.app.

Just drag it to the Programs folder and you have it "installed".

Then you might close the dmg and even delete it.

Revision history for this message
Yang (yang-shen2011) said :
#5

I did what you told, but from my practicing, Eclipse looks not identify "Sikuli-IDE.app" as a normal folder, I copied a folder with exact contents with "Sikuli-IDE.app", but I changed its name to "Sikuli-IDE", anyway, cut off the ".app" so as to Eclipse can see it as a folder, then the method is working.

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

Yes, that's the problem: the Eclipse "Finder" cannot step into an app bundle as can be done with the Mac Finder by opening the bundle.

You should in all cases avoid copying the Sikuli stuff elsewhere.

For these cases Eclipse has the option to define variables, that can be used to build paths in the settings by using ${sikuli}, where sikuli is defined as /Applications/.... .

To get the path string, just open the bundle in finder, navigate to the spot needed and use cmd-I to open the file information. In the upper part you can copy the path string.

Another easy option (since I always have Terminal session open): just drag something from the Finder to the Terminal and you will get the path string in the Terminal window, where you can copy it.

Revision history for this message
Yang (yang-shen2011) said :
#7

Thanks RaiMan, that solved my question.