Closed left4dead closed 4 years ago
Where do the shared libraries get installed when you use a snap?
I found the files here: /snap/vlc/current/usr/lib
Also, it might also be a good idea to add /snap/vlc/current/usr/lib
into Linux's well-known paths for VLCJ. Currently, I had to specify -Djna.library.path
to get past the VLCJ.
it might also be a good idea to add /snap/vlc/current/usr/lib into Linux's well-known paths for VLCJ
That was precisely the reason I asked :-)
Can you tell me where exactly all of VLC's plugins are installed by your snap package?
It seems like this: /snap/vlc/current/usr/lib/vlc/plugins
aro@Demo:/snap/vlc/current/usr/lib/vlc/plugins$ ll
total 305
drwxrwxr-x 31 root root 567 Dec 16 13:47 ./
drwxrwxr-x 4 root root 339 Dec 16 13:47 ../
drwxrwxr-x 2 root root 1099 Dec 16 13:47 access/
drwxrwxr-x 2 root root 254 Dec 16 13:47 access_output/
drwxrwxr-x 2 root root 843 Dec 16 13:47 audio_filter/
drwxrwxr-x 2 root root 81 Dec 16 13:47 audio_mixer/
drwxrwxr-x 2 root root 169 Dec 16 13:47 audio_output/
drwxrwxr-x 2 root root 1611 Dec 16 13:47 codec/
drwxrwxr-x 2 root root 236 Dec 16 13:47 control/
drwxrwxr-x 2 root root 1214 Dec 16 13:47 demux/
drwxrwxr-x 2 root root 93 Dec 16 13:47 gui/
drwxrwxr-x 2 root root 140 Dec 16 13:47 keystore/
drwxrwxr-x 2 root root 109 Dec 16 13:47 logger/
drwxrwxr-x 2 root root 39 Dec 16 13:47 lua/
drwxrwxr-x 2 root root 69 Dec 16 13:47 meta_engine/
drwxrwxr-x 2 root root 392 Dec 16 13:47 misc/
drwxrwxr-x 2 root root 270 Dec 16 13:47 mux/
drwxrwxr-x 2 root root 537 Dec 16 13:47 packetizer/
-rw-rw-r-- 1 root root 312226 Dec 16 13:45 plugins.dat
drwxrwxr-x 2 root root 285 Dec 16 13:47 services_discovery/
drwxrwxr-x 2 root root 247 Dec 16 13:47 spu/
drwxrwxr-x 2 root root 43 Dec 16 13:47 stream_extractor/
drwxrwxr-x 2 root root 266 Dec 16 13:47 stream_filter/
drwxrwxr-x 2 root root 749 Dec 16 13:47 stream_out/
drwxrwxr-x 2 root root 95 Dec 16 13:47 text_renderer/
drwxrwxr-x 2 root root 49 Dec 16 13:47 vaapi/
drwxrwxr-x 2 root root 221 Dec 16 13:47 vdpau/
drwxrwxr-x 2 root root 595 Dec 16 13:47 video_chroma/
drwxrwxr-x 2 root root 1191 Dec 16 13:47 video_filter/
drwxrwxr-x 2 root root 411 Dec 16 13:47 video_output/
drwxrwxr-x 2 root root 96 Dec 16 13:47 video_splitter/
drwxrwxr-x 2 root root 98 Dec 16 13:47 visualization/
But the question is, why JNA is not able to find libvlccore.so.9
while trying to load libvlc.so
as both are present in /snap/vlc/current/usr/lib
.
I think I found the issue.
I copied libvlccore.so (symlink to libvlccore.so.9.0.0)
, libvlccore.so.9 (symlink to libvlccore.so.9.0.0)
and libvlccore.so.9.0.0 (actual shared object)
to /usr/lib/
directory which is also a well known path for Linux. Now, JNA was able to load the library. See the logs:
Feb 10, 2020 11:34:51 AM com.sun.jna.NativeLibrary loadLibrary
INFO: Looking for library 'vlc'
Feb 10, 2020 11:34:51 AM com.sun.jna.NativeLibrary loadLibrary
INFO: Adding paths from jna.library.path: /snap/vlc/current/usr/lib
Feb 10, 2020 11:34:51 AM com.sun.jna.NativeLibrary loadLibrary
INFO: Trying /snap/vlc/current/usr/lib/libvlc.so
Feb 10, 2020 11:34:51 AM com.sun.jna.NativeLibrary loadLibrary
INFO: Found library 'vlc' at /snap/vlc/current/usr/lib/libvlc.so
Feb 10, 2020 11:34:51 AM com.sun.jna.NativeLibrary loadLibrary
INFO: Looking for library 'X11'
Feb 10, 2020 11:34:51 AM com.sun.jna.NativeLibrary loadLibrary
INFO: Adding paths from jna.library.path: /snap/vlc/current/usr/lib
Feb 10, 2020 11:34:51 AM com.sun.jna.NativeLibrary loadLibrary
INFO: Trying libX11.so
Feb 10, 2020 11:34:51 AM com.sun.jna.NativeLibrary loadLibrary
INFO: Found library 'X11' at libX11.so
Feb 10, 2020 11:34:52 AM com.sun.jna.NativeLibrary loadLibrary
INFO: Looking for library 'vlc'
Feb 10, 2020 11:34:52 AM com.sun.jna.NativeLibrary loadLibrary
INFO: Adding paths from jna.library.path: /snap/vlc/current/usr/lib
Feb 10, 2020 11:34:52 AM com.sun.jna.NativeLibrary loadLibrary
INFO: Trying /snap/vlc/current/usr/lib/libvlc.so
Feb 10, 2020 11:34:52 AM com.sun.jna.NativeLibrary loadLibrary
INFO: Found library 'vlc' at /snap/vlc/current/usr/lib/libvlc.so
While trying to load libvlc.so
, it also tries to load libvlccore.so
. I suspect, libvlc
also has hard coded values for well known paths for where to look for its dependency i.e. libvlccore.so
and do not honor the current directory which is basically a jna.library.path
.
I haven't investigated the libvlc codebase for the above statement. Can you confirm and fix if that's the case?
May be just adding /snap/vlc/current/usr/lib
to Linux well known paths in VLCJ will work.
Adding the snap lib folder to the default well-known locations seems reasonable but will it solve the libvlccore issue? I don't use snap so I can't easily/quickly test right now.
On the other hand the discovery mechanism was designed in such a way to as to be easily extensible - you can write a single class that contributes directory locations to the discovery mechanism and it will be loaded via Java's standard ServiceLoader.
Found a workaround for now:
Set the LD_LIBRARY_PATH environment variable in Linux to /snap/vlc/current/usr/lib
and it worked.
However, the issue still exists in LibVlc which tries to find libvlccore.so in /usr/lib
directory and ignores the current directory where libvlc.so was found.
But then isn't that some problem with the Snap package?
Surely any application that used LibVLC from a Snap package would have the same problem.
@caprica Yea, that seems right
I'm going to close this since I think the problem really was something inherent in the snap package rather than vlcj.
It can be reopened if there really is a problem with vlcj.
Error Log: