ubuntu/linux command line execution failures

Asked by Nathan

I've managed to install sikulix 1.1.0 on a very fresh ubuntu install and can edit and run scripts through the GUI IDE. I need to use keypress event handling to toggle my script on and off but I couldn't find a way to do that in Sikkuli, so I want to use AutoKey to execute the sikuli script using subprocess.Popen()
However, I can't get the sikuli script to execute in the terminal.
The command 'bash runsikulix -r "/home/Documents/auto-script.sikuli"' returns "[error] FileManager: Not a valid Sikuli script project"
After digging around I ran 'sudo apt-get install sikuli-ide' to get the sikuli-script and sikuli-ide that I read about but couldn't find.
However, the command 'java -jar /usr/share/java/sikuli-script.jar "/home/Documents/auto-script.sikuli"' gives the following:

Exception in thread "main" java.lang.NoClassDefFoundError: org/python/util/PythonInterpreter
    at org.sikuli.script.ScriptRunner.init(ScriptRunner.java:32)
    at org.sikuli.script.ScriptRunner.<init>(ScriptRunner.java:28)
    at org.sikuli.script.SikuliScript.main(SikuliScript.java:110)
Caused by: java.lang.ClassNotFoundException: org.python.util.PythonInterpreter
    at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    ... 3 more

and 'java -jar /usr/share/sikuli/sikuli-ide.jar -r "/home/Documents/auto-script.sikuli"' give the following:

Error: A JNI error has occured, please check your installation and try again
Exception in thread "main" java.lang.NoClassDefFoundError: org/jdesktop/swingx/JXTaskPaneContainer
    at java.lang.Class.getDeclaredMethods0(Native Method)
    at java.lang.Class.privateGetDeclaredMethods(Class.java:2701)
    at java.lang.Class.getMethod0(Class.java:3015)
    at java.lang.Class.getMethod(Class.java:1784)
    at sun.launcher.LauncherHelper.validateMainClass(LauncherHelper.java:544)
    at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:526)
Caused by: java.lang.ClassNotFoundException: org.jdesktop.swingx.JXTaskPaneContainer
    at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    ... 7 more

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
Best RaiMan (raimund-hocke) said :
#1

-- 1. you should purge everything from your system, that you installed after the successful setup of 1.1.0. You have run your self in some mixup of different versions and artefacts. Even the best would be, to purge everything related to Sikuli and start over fresh with the latest 1.1.1 nightly build (http://sikulix.com)

-- 2. /home/Documents/auto-script.sikuli not a valid script
... with 1.1.x it is so, that a you_name_it.sikuli has to contain a you_name_it.py. I guess you renamed the .sikuli outside the IDE.
names .sikuli should not contain any special characters, just letters and numbers (valid Python name).

--3. to create a valid command to run scripts ...
... you have to use:
java -jar <path-to>sikulix.jar -r <path-to>some.sikuli

Revision history for this message
Nathan (nbanyan) said :
#2

Thank you for the reply. #3 fixed the problem, but then I saw that highlighting in linux was added so I decided to reinstall ubuntu and install 1.1.1

However, the sukulixsetup-1.1.1-20160527.231304-37-forsetup.jar doesn't continue after downloading sikulixlibslux.jar. When running it in the terminal, installation freezes at "checking usability of bundled/provided libs.

Revision history for this message
Nathan (nbanyan) said :
#3

Ok, silly me for not checking the SetupLog first. I was missing JDK, xdotools, and g++. But it still doesn't get any further. It might be a problem with building libVisionProxy.so, but I don't see any helpful errors anymore. Here's the latest log:

[debug (28/05/16 22:12:58)] Debug: setLogFile: /home/mate/Downloads/SikuliUpdate/SikuliX-1.1.1-SetupLog.txt
[debug (28/05/16 22:12:58)] RunSetup: ... starting with no args given
[debug (28/05/16 22:12:58)] RunSetup: Setup: 1.1.1 2016-05-28_01:00nightly in folder:
/home/mate/Downloads/SikuliUpdate
[debug (28/05/16 22:12:58)] RunSetup: RunningSystem: Linux 4.4.0-22-generic (0 Ubuntu 16.04)
[debug (28/05/16 22:12:58)] RunSetup: parent of jar/classes: /home/mate/Downloads/SikuliUpdate
[debug (28/05/16 22:12:58)] RunSetup: RunningJava: Java 8 (amd64) 1.8.0_91-8u91-b14-0ubuntu4~16.04.1-b14
[debug (28/05/16 22:12:58)] init user preferences
[debug (28/05/16 22:13:02)] RunSetup:
popAsk: --------------------
The following file(s) will be downloaded to
/home/mate/Downloads/SikuliUpdate
--- Native support libraries for Linux (sikulixlibs...)
--- Package 1 ---
sikulixsetupIDE-1.1.1-20160527.231644-35-forsetup.jar (IDE/Scripting)
sikulixsetupAPI-1.1.1-20160527.231510-37-forsetup.jar (Java API)
 - with Jython
--- Additions ---
tessdata-eng (Tesseract)
Only click NO, if you want to terminate setup now!
Click YES even if you want to use local copies in Downloads!
--------------------
[debug (28/05/16 22:13:06)] RunSetup:
popAsk: --------------------
You have for Linux native libs
/home/mate/.Sikulix/SikulixDownloads_201605280100/sikulixlibslux-1.1.1-20160527.230943-45.jar
Click YES, if you want to use this for setup processing
... or click NO, to ignore it and download a fresh copy
--------------------
[debug (28/05/16 22:13:08)] RunSetup: Copied from Downloads: sikulixlibslux
[debug (28/05/16 22:13:08)] RunTimeSETUP: addToClasspath:
file:/home/mate/Downloads/SikuliUpdate/sikulixlibslux.jar
*** classpath dump sikulix
  0: /home/mate/Downloads/SikuliUpdate/sikulixsetup-1.1.1-20160527.231304-37-forsetup.jar
  1: /home/mate/Downloads/SikuliUpdate/sikulixlibslux.jar
*** classpath dump end
[debug (28/05/16 22:13:08)] RunSetup: checking usability of bundled/provided libs
[debug (28/05/16 22:13:08)] RunTimeSETUP: exists libs folder at: /home/mate/.Sikulix/SikulixLibs_201605280100
[error (28/05/16 22:13:08)] RunTimeSETUP: loadLib: libVisionProxy.so not usable:
java.lang.UnsatisfiedLinkError: /home/mate/.Sikulix/SikulixLibs_201605280100/libVisionProxy.so: libtesseract.so.3: cannot open shared object file: No such file or directory
[error (28/05/16 22:13:08)] RunTimeSETUP: loadLib: libVisionProxy.so not usable:
java.lang.UnsatisfiedLinkError: /home/mate/.Sikulix/SikulixLibs_201605280100/libVisionProxy.so: libtesseract.so.3: cannot open shared object file: No such file or directory
[debug (28/05/16 22:13:08)] LinuxSupport: we have to build libVisionProxy.so
[debug (28/05/16 22:13:08)] LinuxSupport: checking: availability of OpenCV and Tesseract
[debug (28/05/16 22:13:08)] LinuxSupport: checking: scanning loader cache (ldconfig -p)
[debug (28/05/16 22:13:08)] RunTimeSETUP: ldconfig -p
[debug (28/05/16 22:13:08)] LinuxSupport: checking: found OpenCV libs:
/usr/lib/x86_64-linux-gnu/libopencv_core.so.2.4
/usr/lib/x86_64-linux-gnu/libopencv_highgui.so.2.4
/usr/lib/x86_64-linux-gnu/libopencv_imgproc.so.2.4
[debug (28/05/16 22:13:08)] LinuxSupport: checking: found Tesseract lib:

[debug (28/05/16 22:13:08)] RunTimeSETUP: wmctrl -m
[debug (28/05/16 22:13:08)] LinuxSupport: checking: wmctrl seems to be available
[debug (28/05/16 22:13:08)] RunTimeSETUP: xdotool version
[debug (28/05/16 22:13:08)] LinuxSupport: checking: xdotool seems to be available
[debug (28/05/16 22:13:08)] LinuxSupport: buildVision: starting inline build: libVisionProxy.so
[debug (28/05/16 22:13:08)] LinuxSupport: buildVision: java.home from java props: /usr/lib/jvm/java-8-openjdk-amd64/jre
[debug (28/05/16 22:13:08)] LinuxSupport: buildVision: JAVA_HOME from environment: null
[debug (28/05/16 22:13:08)] LinuxSupport: buildVision: JDK: found at: /usr/lib/jvm/java-8-openjdk-amd64
[debug (28/05/16 22:13:08)] LinuxSupport: buildVision: opencv-include: not found - using the bundled include files
[debug (28/05/16 22:13:08)] LinuxSupport: buildVision: tesseract-include: not found - using the bundled include files
[debug (28/05/16 22:13:08)] RunTimeSETUP: resourceList: enter
[debug (28/05/16 22:13:08)] RunTimeSETUP: resourceLocation: (class org.sikuli.setup.RunSetup) /srcnativelibs/Vision
[debug (28/05/16 22:13:08)] RunTimeSETUP: resourceList: having jar: jar:file:/home/mate/Downloads/SikuliUpdate/sikulixlibslux.jar!/srcnativelibs/Vision
[debug (28/05/16 22:13:08)] RunTimeSETUP: files exported: 16 from: /srcnativelibs/Vision to:
 /home/mate/.Sikulix/sikulixlibs/linux/Build/Source
[debug (28/05/16 22:13:08)] RunTimeSETUP: resourceList: enter
[debug (28/05/16 22:13:08)] RunTimeSETUP: resourceLocation: (class org.sikuli.setup.RunSetup) /srcnativelibs/Include/OpenCV
[debug (28/05/16 22:13:08)] RunTimeSETUP: resourceList: having jar: jar:file:/home/mate/Downloads/SikuliUpdate/sikulixlibslux.jar!/srcnativelibs/Include/OpenCV
[debug (28/05/16 22:13:09)] RunTimeSETUP: files exported: 145 from: /srcnativelibs/Include/OpenCV to:
 /home/mate/.Sikulix/sikulixlibs/linux/Build/Include
[debug (28/05/16 22:13:09)] RunTimeSETUP: resourceList: enter
[debug (28/05/16 22:13:09)] RunTimeSETUP: resourceLocation: (class org.sikuli.setup.RunSetup) /srcnativelibs/Include/Tesseract
[debug (28/05/16 22:13:09)] RunTimeSETUP: resourceList: having jar: jar:file:/home/mate/Downloads/SikuliUpdate/sikulixlibslux.jar!/srcnativelibs/Include/Tesseract
[debug (28/05/16 22:13:09)] RunTimeSETUP: files exported: 27 from: /srcnativelibs/Include/Tesseract to:
 /home/mate/.Sikulix/sikulixlibs/linux/Build/Include
[debug (28/05/16 22:13:09)] LinuxSupport: **** content of build script:
#jdkdir=/usr/lib/jvm/java-7-openjdk-amd64
jdkdir=/usr/lib/jvm/java-8-openjdk-amd64

opencvinclude=
#opencvlib=/usr/lib/x86_64-linux-gnu
#opencvcore=$opencvlib/libopencv_core.so.2.4
opencvcore=/usr/lib/x86_64-linux-gnu/libopencv_core.so.2.4
#opencvimgproc=$opencvlib/libopencv_imgproc.so.2.4
opencvimgproc=/usr/lib/x86_64-linux-gnu/libopencv_imgproc.so.2.4
#opencvhighgui=$opencvlib/libopencv_highgui.so.2.4
opencvhighgui=/usr/lib/x86_64-linux-gnu/libopencv_highgui.so.2.4

tesseractinclude=
#tesseractlib=/usr/lib/libtesseract.so.3
tesseractlib=

#work=`pwd`
work=/home/mate/.Sikulix/sikulixlibs/linux/Build
source=$work/Source
buildinclude=$work/Include
build=$work/Target
stuff=$build/Stuff
rm -R -f $build
mkdir $build
mkdir $stuff

if [ "$opencvinclude" != "" ]; then
  includeplus="-I$opencvinclude "
fi
if [ "$tesseractinclude" != "" ]; then
  includeplus="$includeplus -I$tesseractinclude "
fi
includefinal="-I/usr/include -I/usr/local/include $includeplus -I$buildinclude"

echo ----------- COMPILING
for mod in cvgui.cpp finder.cpp pyramid-template-matcher.cpp sikuli-debug.cpp \
  tessocr.cpp vision.cpp visionJAVA_wrap.cxx
do
  echo ----- $mod
  g++ -c -O3 -fPIC -MMD -MP \
    -I$jdkdir/include \
    -I$jdkdir/include/linux \
    $includefinal \
    -MF $stuff/$mod.o.d \
    -o $stuff/$mod.o \
    $source/$mod
  mods="$mods $stuff/$mod.o "
done

echo ----------- LINKING
g++ -shared -s -fPIC -dynamic $mods \
  $opencvcore \
  $opencvimgproc \
  $opencvhighgui \
  $tesseractlib \
  -o $build/libVisionProxy.so

**** content end
[debug (28/05/16 22:13:09)] LinuxSupport: buildVision: running build script
[debug (28/05/16 22:13:09)] RunTimeSETUP: /home/mate/.Sikulix/sikulixlibs/linux/runBuild
[debug (28/05/16 22:13:53)] LinuxSupport: buildVision: checking created libVisionProxy.so
[debug (28/05/16 22:13:53)] RunTimeSETUP: ldd -r /home/mate/.Sikulix/sikulixlibs/linux/Build/Target/libVisionProxy.so
[error (28/05/16 22:13:54)] LinuxSupport: checking: might not work, has undefined symbols: libVisionProxy.so
[debug (28/05/16 22:13:54)] LinuxSupport: _ZN9tesseract11TessBaseAPID1Ev:
[error (28/05/16 22:13:54)] LinuxSupport: ------- output of the build run
0
----------- COMPILING
----- cvgui.cpp
----- finder.cpp
----- pyramid-template-matcher.cpp
----- sikuli-debug.cpp
----- tessocr.cpp
----- vision.cpp
----- visionJAVA_wrap.cxx
----------- LINKING

[error (28/05/16 22:13:54)] RunTimeSETUP: Problematic lib: /home/mate/.Sikulix/SikulixLibs_201605280100/libVisionProxy.so (...TEMP...)
[error (28/05/16 22:13:54)] RunTimeSETUP: libVisionProxy.so loaded, but it might be a problem with needed dependent libraries
ERROR: ...TEMP...: libtesseract.so.3: cannot open shared object file: No such file or directory
[error (28/05/16 22:13:54)] RunTimeSETUP: *** terminating: problem with native library: libVisionProxy.so
[debug (28/05/16 22:13:54)] RunTimeSETUP: final cleanup
[error (28/05/16 22:13:54)] RunTimeSETUP: loadLib: libVisionProxy.so not usable:
java.lang.UnsatisfiedLinkError: /home/mate/.Sikulix/SikulixLibs_201605280100/libVisionProxy.so: libtesseract.so.3: cannot open shared object file: No such file or directory
[error (28/05/16 22:13:54)] RunTimeSETUP: Problematic lib: /home/mate/.Sikulix/SikulixLibs_201605280100/libVisionProxy.so (...TEMP...)
[error (28/05/16 22:13:54)] RunTimeSETUP: libVisionProxy.so loaded, but it might be a problem with needed dependent libraries
ERROR: ...TEMP...: libtesseract.so.3: cannot open shared object file: No such file or directory
[error (28/05/16 22:13:54)] RunTimeSETUP: *** terminating: problem with native library: libVisionProxy.so

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

using the created build script, you have to check, what is going on.
Seems, that tesseract is not available on your system.

Revision history for this message
Nathan (nbanyan) said :
#5

Thanks RaiMan, that solved my question.

Revision history for this message
Nathan (nbanyan) said :
#6

Thanks, it installed without errors after I installed tesseract. I though the setup downloaded and installed tesseract if that option was selected and so I didn't expect to have to manually install the tesseract package even if I wasn't going to use it.

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

yep,the problem is, that the "ancient" C++ code in VisionProxy has hardcoded references to tesseract.
This will only be changed with version 2.