When launching a JavaFX application, the following error occurs:
GraphicsPipeline.createPipeline failed for com.sun.prism.es2.ES2Pipeline
java.lang.UnsatisfiedLinkError: /opt/jdk/jdk1.8.0_181/jre/lib/amd64/libprism_es2.so: libgtk-x11-2.0.so.0: cannot open shared object file: No such file or directory
But at the same time, I have the libgtk-x11-2.0.so.0 library installed.
find / -name "libgdk-x11*" 2> /dev/null:
result
ldd /opt/jdk/jdk1.8.0_181/jre/lib/amd64/libprism_es2.so:
result
java version "1.8.0_181"
I don't know what should I do. I'm new to Linux
Related
I am attempting to load a native library using JNA, using this line:
MPV INSTANCE = Native.load("mpv", MPV.class, Map.of(Library.OPTION_STRING_ENCODING, "UTF-8"));
This works absolutely fine on an Ubuntu 20.04 that I installed in a Hyper-V VM on my main machine, but for some reason fails on an Ubuntu 20.04 native install.
The logs where it fails look like this:
Looking in classpath from {0} for {1}
Found library resource at {0}
Extracting library to {0}
Trying {0}
Found jnidispatch at {0}
Looking for library 'mpv'
Adding paths from jna.library.path: null
Trying libmpv.so
Loading failed with message: libmpv.so: cannot open shared object file: No such file or directory
Adding system paths: [/usr/lib/x86_64-linux-gnu, /lib/x86_64-linux-gnu, /usr/lib64, /lib64, /usr/lib, /lib, /lib/i386-linux-gnu, /usr/lib/x86_64-linux-gnu/libfakeroot]
Trying libmpv.so
Loading failed with message: libmpv.so: cannot open shared object file: No such file or directory
Looking for version variants
Trying /usr/lib/x86_64-linux-gnu/libmpv.so.1.107.0
Loading failed with message: /lib/x86_64-linux-gnu/libavfilter.so.7: undefined symbol: av_sscanf, version LIBAVUTIL_56
Looking in classpath from {0} for {1}
Loading failed with message: Native library (linux-x86-64/libmpv.so) not found in resource path ([file:/home/xxx/yyy/mpv.jar])
Exception in thread "JavaFX Application Thread"
java.lang.UnsatisfiedLinkError: Unable to load library 'mpv':
libmpv.so: cannot open shared object file: No such file or directory
libmpv.so: cannot open shared object file: No such file or directory
/lib/x86_64-linux-gnu/libavfilter.so.7: undefined symbol: av_sscanf, version LIBAVUTIL_56
Native library (linux-x86-64/libmpv.so) not found in resource path ([file:/home/xxx/yyy/mpv.jar])
at com.sun.jna.NativeLibrary.loadLibrary(NativeLibrary.java:302)
at com.sun.jna.NativeLibrary.getInstance(NativeLibrary.java:455)
at com.sun.jna.Library$Handler.<init>(Library.java:192)
at com.sun.jna.Native.load(Native.java:596)
at hs.mediasystem.ext.mpv.MPV.<clinit>(MPV.java:12)
at hs.mediasystem.ext.mpv.MPVPlayer.<init>(MPVPlayer.java:47)
(... snipped 50 lines ...)
at com.sun.glass.ui.View.handleKeyEvent(View.java:547)
at com.sun.glass.ui.View.notifyKey(View.java:971)
at com.sun.glass.ui.gtk.GtkApplication._runLoop(Native Method)
at com.sun.glass.ui.gtk.GtkApplication.lambda$runLoop$11(GtkApplication.java:277)
at java.base/java.lang.Thread.run(Thread.java:834)
Suppressed: java.lang.UnsatisfiedLinkError: libmpv.so: cannot open shared object file: No such file or directory
at com.sun.jna.Native.open(Native Method)
at com.sun.jna.NativeLibrary.loadLibrary(NativeLibrary.java:191)
... 70 more
Suppressed: java.lang.UnsatisfiedLinkError: libmpv.so: cannot open shared object file: No such file or directory
at com.sun.jna.Native.open(Native Method)
at com.sun.jna.NativeLibrary.loadLibrary(NativeLibrary.java:204)
... 70 more
Suppressed: java.lang.UnsatisfiedLinkError: /lib/x86_64-linux-gnu/libavfilter.so.7: undefined symbol: av_sscanf, version LIBAVUTIL_56
at com.sun.jna.Native.open(Native Method)
at com.sun.jna.NativeLibrary.loadLibrary(NativeLibrary.java:235)
... 70 more
Suppressed: java.io.IOException: Native library (linux-x86-64/libmpv.so) not found in resource path ([file:/home/john/Downloads/MediaSystem/ui-plugins/mpv-plugin/mpv.jar])
at com.sun.jna.Native.extractFromResourcePath(Native.java:1095)
at com.sun.jna.NativeLibrary.loadLibrary(NativeLibrary.java:276)
... 70 more
For some reason it cannot find some symbol av_sscanf in a dependent library. The wierd thing however is that this exact same code works in the Ubuntu installed in the VM.
Its output is:
Looking in classpath from {0} for {1}
Found library resource at {0}
Extracting library to {0}
Trying {0}
Found jnidispatch at {0}
Looking for library 'mpv'
Adding paths from jna.library.path: null
Trying libmpv.so
Loading failed with message: libmpv.so: cannot open shared object file: No such file or directory
Adding system paths: [/usr/lib/x86_64-linux-gnu, /lib/x86_64-linux-gnu, /usr/lib64, /lib64, /usr/lib, /lib]
Trying libmpv.so
Loading failed with message: libmpv.so: cannot open shared object file: No such file or directory
Looking for version variants
Trying /usr/lib/x86_64-linux-gnu/libmpv.so.1.107.0
Found library 'mpv' at /usr/lib/x86_64-linux-gnu/libmpv.so.1.107.0
I checked the versions and sizes of the libraries involved, and they seem to be all exactly the same:
john#Artec:~$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 20.04 LTS
Release: 20.04
Codename: focal
john#Artec:~$ apt-cache policy libmpv1
libmpv1:
Installed: 0.32.0-1ubuntu1
Candidate: 0.32.0-1ubuntu1
Version table:
*** 0.32.0-1ubuntu1 500
500 http://nl.archive.ubuntu.com/ubuntu focal/universe amd64 Packages
100 /var/lib/dpkg/status
john#Artec:~$ apt-cache policy libavfilter7
libavfilter7:
Installed: 7:4.2.2-1ubuntu1
Candidate: 7:4.2.2-1ubuntu1
Version table:
*** 7:4.2.2-1ubuntu1 500
500 http://nl.archive.ubuntu.com/ubuntu focal/universe amd64 Packages
100 /var/lib/dpkg/status
john#Artec:~$ ll /usr/lib/x86_64-linux-gnu/libmpv.so.1.107.0
-rw-r--r-- 1 root root 2153952 jan 31 19:11 /usr/lib/x86_64-linux-gnu/libmpv.so.1.107.0
john#Artec:~$ ll /usr/lib/x86_64-linux-gnu/libavfilter.so.7
-rw-r--r-- 1 root root 3647472 mrt 7 09:39 /usr/lib/x86_64-linux-gnu/libavfilter.so.7.57.100
Any tips on how to debug this further would be much appreciated.
More Info
This turns out to be a problem where two libraries are loaded, but requiring different versions of a shared dependent library (in this case the libavfilter library is used by both opencv/ffmpeg and libmpv, but they need a slightly different version...).
brew install leiningen
I got
Compiling joy.gui.DynaFrame
Could not locate joy/gui/DynaFrame__init.class or joy/gui/DynaFrame.clj on classpath:
Exception in thread "main" java.io.FileNotFoundException: Could not locate joy/gui/DynaFrame__init.class or joy/gui/DynaFrame.clj on classpath: , compiling:(/private/var/folders/zm/swyymlvn4l7__d1rln_n391r0000gn/T/form-init7580966196782799989.clj:1:124)
at clojure.lang.Compiler.load(Compiler.java:7142)
at clojure.lang.Compiler.loadFile(Compiler.java:7086)
at clojure.main$load_script.invoke(main.clj:274)
at clojure.main$init_opt.invoke(main.clj:279)
at clojure.main$initialize.invoke(main.clj:307)
at clojure.main$null_opt.invoke(main.clj:342)
at clojure.main$main.doInvoke(main.clj:420)
at clojure.lang.RestFn.invoke(RestFn.java:421)
at clojure.lang.Var.invoke(Var.java:383)
at clojure.lang.AFn.applyToHelper(AFn.java:156)
at clojure.lang.Var.applyTo(Var.java:700)
at clojure.main.main(main.java:37)
Caused by: java.io.FileNotFoundException: Could not locate joy/gui/DynaFrame__init.class or joy/gui/DynaFrame.clj on classpath:
at clojure.lang.RT.load(RT.java:443)
at clojure.lang.RT.load(RT.java:411)
at clojure.core$load$fn__5066.invoke(core.clj:5641)
at clojure.core$load.doInvoke(core.clj:5640)
at clojure.lang.RestFn.invoke(RestFn.java:408)
at clojure.core$load_one.invoke(core.clj:5446)
at clojure.core$compile$fn__5071.invoke(core.clj:5652)
at clojure.core$compile.invoke(core.clj:5651)
at user$eval20$fn__29.invoke(form-init7580966196782799989.clj:1)
at user$eval20.invoke(form-init7580966196782799989.clj:1)
at clojure.lang.Compiler.eval(Compiler.java:6703)
at clojure.lang.Compiler.eval(Compiler.java:6693)
at clojure.lang.Compiler.eval(Compiler.java:6693)
at clojure.lang.Compiler.load(Compiler.java:7130)
... 11 more
Compilation failed: Subprocess failed
I tried to reinstall but the issue does not solved.
When I type,
lein version
I got this:
Leiningen 2.9.1 on Java 12 Java HotSpot(TM) 64-Bit Server VM
I installed Java correctly but not sure where to start to fix this problem.
I looked around and it seems you are trying to run an old example from The Joy of Clojure, right?
The example needed a minor touch-up for me to be able to run it.
I created a new Leiningen project first with lein new app dynademo.
Inside the new project folder, I created the directories for the namespace: mkdir -p src/joy/gui
Created the file src/joy/gui/DynaFrame.clj
The Leiningen project that we just created with lein new ... uses Clojure 1.10, which doesn't seem to like one thing:
Replace the line with :prefix df- with :prefix "df-" (eg. wrap the value df- in quotes)
Save the file, and now you can launch the window from the REPL, like this:
$ lein repl
nREPL server started on port 44037 on host 127.0.0.1 - nrepl://127.0.0.1:44037
REPL-y 0.4.3, nREPL 0.6.0
Clojure 1.10.0
OpenJDK 64-Bit Server VM 1.8.0_191-8u191-b12-2ubuntu0.18.04.1-b12
Docs: (doc function-name-here)
(find-doc "part-of-name-here")
Source: (source function-name-here)
Javadoc: (javadoc java-object-or-class-here)
Exit: Control+D or (exit) or (quit)
Results: Stored in vars *1, *2, *3, an exception in *e
dynaframe.core=> (compile 'joy.gui.DynaFrame)
joy.gui.DynaFrame
dynaframe.core=> (def hello-frame (joy.gui.DynaFrame. "Hello"))
#'dynaframe.core/hello-frame
dynaframe.core=> (.show hello-frame)
nil
It looks like this:
(you will need to move/resize the window a bit, but you get the idea). Note: I'm using Java 8 (JDK 1.8.0_191) but it should work the same in JDK 12.
I'm trying to use JPL with SWI-Prolog on macOS High Sierra and I'm having troubles. In fact, at first the libjpl.dylib was not found so I added the path to it to java.library.path via
java -Djava.library.path=/Applications/SWI-Prolog.app/Contents/swipl/lib/x86_64-darwin15.6.0/
Now the library is found but I get another error:
java.lang.UnsatisfiedLinkError: /Applications/SWI-Prolog.app/Contents/swipl/lib/x86_64-darwin15.6.0/libjpl.dylib: dlopen(/Applications/SWI-Prolog.app/Contents/swipl/lib/x86_64-darwin15.6.0/libjpl.dylib, 1): Library not loaded: #executable_path/../swipl/lib/x86_64-darwin15.6.0/libswipl.dylib
Referenced from: /Applications/SWI-Prolog.app/Contents/swipl/lib/x86_64-darwin15.6.0/libjpl.dylib
Reason: image not found
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1941)
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1857)
at java.lang.Runtime.loadLibrary0(Runtime.java:870)
at java.lang.System.loadLibrary(System.java:1122)
...
From what I understand, this is caused by this version of SWI-Prolog being relocatable (and thus having path relative to the executable).
The output of otool -L of the libjpl.dylib give me this output:
/Applications/SWI-Prolog.app/Contents/swipl/lib/x86_64-darwin15.6.0/libjpl.dylib:
#rpath/libjsig.dylib (compatibility version 1.0.0, current version 1.0.0)
#rpath/libjvm.dylib (compatibility version 1.0.0, current version 1.0.0)
#executable_path/../swipl/lib/x86_64-darwin15.6.0/libswipl.dylib (compatibility version 0.0.0, current version 7.6.4)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1226.10.1)
So one way of fixing it would be to install a not relocatable version via macport or homebrew.
The thing is, neither the MacPorts nor the Homebrew version of SWI-Prolog contains the libjpl.dylib library :/
Am I missing something here? What can I do to make this work?
On macOS 10.13.6 (High Sierra), I regularly compile the SWI-Prolog 7.x sources using:
$ make distclean && ./build && swipl -g "jpl_config_dylib" -t halt
The jpl_config_dylib/0 finds and fixes the Java paths. You should also be able to call it from the top-level after you start the SWI-Prolog.app application.
To whomever this might be useful, as it is not a 100% match to the content of the question asked, but is a 100% match to the title of the question asked.
When installing (at least a recent version of) SWI-Prolog using Homebrew, attempting to use_module(library(jpl)) will result in an error:
ERROR: /usr/local/Cellar/swi-prolog/8.4.0/libexec/lib/swipl/library/jpl.pl:5428: Initialization goal raised exception:
ERROR: source_sink `jar('jpl.jar')' does not exist
ERROR: In:
ERROR: [48] throw(error(existence_error(source_sink,...),_109418))
ERROR: [44] jpl:add_jpl_to_classpath at /usr/local/Cellar/swi-prolog/8.4.0/libexec/lib/swipl/library/jpl.pl:3979
ERROR: [43] jpl:setup_jvm at /usr/local/Cellar/swi-prolog/8.4.0/libexec/lib/swipl/library/jpl.pl:4168
ERROR: [42] '$run_init_goal'(jpl:setup_jvm) at /usr/local/Cellar/swi-prolog/8.4.0/libexec/lib/swipl/boot/init.pl:796
ERROR: [41] catch(system:'$run_init_goal'(...),error(existence_error(source_sink,...),context(_109584,_109586)),system:'$initialization_error'(...,...,...)) at /usr/local/Cellar/swi-prolog/8.4.0/libexec/lib/swipl/boot/init.pl:546
ERROR: [40] catch_with_backtrace(system:'$run_init_goal'(...),error(existence_error(source_sink,...),context(_109660,_109662)),system:'$initialization_error'(...,...,...)) at /usr/local/Cellar/swi-prolog/8.4.0/libexec/lib/swipl/boot/init.pl:614
ERROR:
ERROR: Note: some frames are missing due to last-call optimization.
ERROR: Re-run your program in debug mode (:- debug.) to get more detail.
ERROR: Exported procedure jpl:jpl_c_lib_version/1 is not defined
true.
Also, executing the goal jpl_config_dylib results in an error:
?- jpl_config_dylib.
ERROR: Unknown procedure: jpl_config_dylib/0 (DWIM could not correct goal)
The MacPorts version of SWI-Prolog does not have this problem. The solution is to copy the relevant files from under the MacPorts version to under the Homebrew version of SWI Prolog:
$ cp /Applications/SWI-Prolog.app/Contents/swipl/lib/jpl.jar /usr/local/Cellar/swi-prolog/8.4.0/libexec/lib/swipl/lib/
$ cp /Applications/SWI-Prolog.app/Contents/swipl/lib/x86_64-darwin/libjpl.dylib /usr/local/Cellar/swi-prolog/8.4.0/libexec/lib/swipl/lib/x86_64-darwin/
$ cp /Applications/SWI-Prolog.app/Contents/swipl/library/jpl.pl /usr/local/Cellar/swi-prolog/8.4.0/libexec/lib/swipl/library/
$ cp /Applications/SWI-Prolog.app/Contents/swipl/library/jpl_config.pl /usr/local/Cellar/swi-prolog/8.4.0/libexec/lib/swipl/library/
After which loading library(jpl) will work fine:
?- use_module(library(jpl)).
true.
?- jpl_new('java.lang.Object', [], JRef).
JRef = <jref>(0x7fbefb086318).
I'm trying to load the "openNLP" library in RStudio and I'm getting the following error. I get a similar error when I try to install the "RWeka" package.
How do I troubleshoot this?
library(openNLP)
Error : .onLoad failed in loadNamespace() for 'openNLPdata', details:
call: .jinit()
error: JNI_GetCreatedJavaVMs returned -1
Error: package or namespace load failed for ‘openNLP’
JavaVM: requested Java version ((null)) not available. Using Java at "" instead.
JavaVM: Failed to load JVM: /bundle/Libraries/libserver.dylib
JavaVM FATAL: Failed to load the jvm library.
Found a solution to my issue. This is what worked for me. Please see below:
Launch R at the command line (to test the solution):
sudo R CMD javareconf
export LD_LIBRARY_PATH=$JAVA_LD_LIBRARY_PATH
LD_LIBRARY_PATH=$(/usr/libexec/java_home)/jre/lib/server: open -a RStudio
Now within RStudio:
install.packages("rJava", type = "source")
install.packages("openNLP")
require(rJava)
require(openNLP)
To launch RStudio from finder (El Capitan), you have to link libjvm.dylib to /usr/lib.
sudo ln -s $(/usr/libexec/java_home)/jre/lib/server/libjvm.dylib /usr/local/lib
I'm trying to use the SWI-Prolog JPL library, but I'm having problems.
I'm trying to let my Eclipse project access JPL, but when I try to start the program, I get the following error:
Exception in thread "AWT-EventQueue-0" java.lang.UnsatisfiedLinkError: no jpl in java.library.path
I copied the jpl.jar into my project directory, and I set it on the build path. Additionally, I pass the following VM arguments:
-Djava.library.path="C:\Program Files\Prolog\bin"
(That's the directory where Prolog was installed).
What am I doing wrong?
EDIT: I don't seem to have the libpl.dll anywhere on my computer. Could this be causing my problem?
The jvm.dll of your running JDK/JRE must be available in your system PATH so that jpl.dll from java.library.path loads properly.
You have to take care to 32 bits / 64 bits consistency between your JPL installation and your running JVM - so do not try any mix.
Here is information from an old installation doc.
For such installation support, you should use the JPL mailing list.
You should set the java.library.path to the folder where the jpl.dll file is located. As far as I know it is the Prolog\bin folder.
A system-wide solution in a Mac environment (SWI-Prolog version 7.1.4 for x86_64-darwin13.1.0) would be to create the following symlink:
ln -s /usr/local/Cellar/swi-prolog/7.1.4/libexec/lib/swipl-7.1.4/lib/x86_64-darwin13.1.0/libjpl.jnilib /Library/Java/Extensions/libjpl.jnilib
Could be rather
ln -s
/Applications/SWI-Prolog.app/Contents/swipl/lib/x86_64-darwin/libjpl.dylib
/Library/Java/Extensions/libjpl.dylib
? (no .inilib was found under darwin folder)
In my case still error on mojave (SWI-Prolog (threaded, 64 bits, version 8.0.2)):
Jan 03, 2020 12:10:55 AM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet [ACTIONS] in context with path [/SVIZ] threw exception [Servlet execution threw an exception] with root cause
java.lang.UnsatisfiedLinkError: /Applications/SWI-Prolog.app/Contents/swipl/lib/x86_64-darwin/libjpl.dylib: dlopen(/Applications/SWI-Prolog.app/Contents/swipl/lib/x86_64-darwin/libjpl.dylib, 1): Library not loaded: #rpath/libswipl.8.dylib
Referenced from: /Applications/SWI-Prolog.app/Contents/swipl/lib/x86_64-darwin/libjpl.dylib
Reason: image not found