Running selenium+sikuli scripts through Jenkins - Library not loaded: /usr/local/lib/libopencv_core.2.2.dylib

Asked by Josiah Lau

Setup:
Jenkins running on Mac Mini
Sikuli images stored under project/resources/*.png
Jenkins grabs code from github, runs selenium scripts via ant

My scripts run fine locally through Eclipse, but when Jenkins run them, I'm getting the following error:

Exception java.lang.UnsatisfiedLinkError

Message: /private/var/folders/5V/5VV1-qk6EmKH-FJgZYs3+k+++TI/-Tmp-/tmplib/libVisionProxy.jnilib: Library not loaded: /usr/local/lib/libopencv_core.2.2.dylib Referenced from: /private/var/folders/5V/5VV1-qk6EmKH-FJgZYs3+k+++TI/-Tmp-/tmplib/libVisionProxy.jnilib Reason: image not found

Stacktrace:

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.wait(Region.java:478)
at com.pictela.unitTesterPage.findImage(Unknown Source)
at com.pictela.pmc2Tests.PMC2Backup160x600(Unknown Source)
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.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:76)
at org.testng.internal.Invoker.invokeMethod(Invoker.java:673)
at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:846)
at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1170)
at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:125)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:109)
at org.testng.TestRunner.runWorkers(TestRunner.java:1147)
at org.testng.TestRunner.privateRun(TestRunner.java:749)
at org.testng.TestRunner.run(TestRunner.java:600)
at org.testng.SuiteRunner.runTest(SuiteRunner.java:317)
at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:312)
at org.testng.SuiteRunner.privateRun(SuiteRunner.java:274)
at org.testng.SuiteRunner.run(SuiteRunner.java:223)
at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
at org.testng.TestNG.runSuitesSequentially(TestNG.java:1039)
at org.testng.TestNG.runSuitesLocally(TestNG.java:964)
at org.testng.TestNG.run(TestNG.java:900)
at org.testng.TestNG.privateMain(TestNG.java:1182)
at org.testng.TestNG.main(TestNG.java:1146)

I found a similar question on https://answers.launchpad.net/sikuli/+question/197408. Will the solution for that work if I install Sikuli into the Mac Mini and store my images in a sikuli file?

Question information

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

This is a weakness of the current native library implementation:
If Sikuli finds a folder /Application/Sikuli-IDE.app/Contents/Frameworks, it assumes a standard Sikuli installation and loads its native libraries from this folder, that in turn find the dependent libraries in the same folder, because they are provided with the Sikuli bundle and the loader parameters are set accordingly.

If this folder is not found (which seems to be the case in your situation), the Sikuli own native libraries are copied to a temp folder from inside sikuli-script.jar, loaded from there and it is assumed, that the needed dependent libraries (like OpenCV) will be found in there standard locations (/usr/local/lib) in your case.

The workaround:
Take care, that on the system, your script is running on, the folder
/Application/Sikuli-IDE.app/Contents/Frameworks
exists and contains the stuff from the standard installed local Sikuli app on your local system.

Revision history for this message
James Lloyd (jameson-lloyd) said :
#2

Thanks Raiman!

For those not using Sikuli-IDE, perhaps on a automated test node, another simple workaround is to copy the needed set of files including ibopencv_core.2.2.dylib into /usr/local/lib.

Can you help with this problem?

Provide an answer of your own, or ask Josiah Lau for more information if necessary.

To post a message you must log in.