VLCJ - 在 64 位上捆绑本机 VLC 库 Linux
VLCJ - Bundling native VLC libraries on 64 bit Linux
背景:
我正在 Java 中编写跨平台音频播放器。在 Linux 上,我以 appimage (https://appimage.org/) 的形式分发它。我使用 VLC/VLCJ 作为解码引擎。
appimages 的基本准则是将所有必要的库包含在 appimage 中,这些库不能合理地期望默认包含在分发版中。这样做是为了让用户不需要解决依赖关系 and/or 与库和程序之间的版本差异作斗争。他们还建议针对少数 Linux 发行版的 previous 版本进行测试,以确认一切正常。
Ubuntu 16.04 和 Fedora 27.16 默认不安装 libvlc。我相信这对于许多其他发行版来说很常见。因此,我想在我的 appimage 中打包 libvlc 库。
问题:
在 Linux 上,我无法将 vlcj 获取到 recognize/find libvlc.so
和 libvlccore.so
,除非它们是通过发行版安装的。
设置:
我通过我的发行版和我的程序 运行s 安装了 VLC 并且工作正常。
我将 libvlc.so
、libvlccore.so
和其他相关库从我的发行版中的默认位置复制到我的项目中的一个文件夹中。
我将该文件夹添加到本机库搜索路径(参见下面的代码)。
我卸载了VLC。
我试着 运行 我的程序。它因下面粘贴的错误而崩溃。
注意:我在 Windows 中使用了相同的基本方法,并且在那里工作得很好。
简化代码:
String nativeVLCLibPath = Hypnos.getRootDirectory().resolve( "lib/nix/vlc/" ).toAbsolutePath().toString();
System.out.println ( "Trying to look for libraries in: " + nativeVLCLibPath );
NativeLibrary.addSearchPath( RuntimeUtil.getLibVlcLibraryName(), nativeVLCLibPath );
错误信息:
Trying to look for libraries in:
/d/programming/workspace/MusicPlayer/stage/lib/nix/vlc SLF4J: Failed
to load class "org.slf4j.impl.StaticLoggerBinder". SLF4J: Defaulting
to no-operation (NOP) logger implementation SLF4J: See
http://www.slf4j.org/codes.html#StaticLoggerBinder for further
details. Aug 5, 2018 22:14:32 PM net.joshuad.hypnos.Hypnos start
SEVERE: class java.lang.RuntimeException: Exception caught at top
level of Hypnos. Exiting. java.lang.RuntimeException: Failed to load
the native library.
The error was "Unable to load library 'vlc': JNA native support
(linux-amd64/libvlc.so) not found in resource path
(/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/resources.jar:/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/rt.jar:/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/jsse.jar:/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/jce.jar:/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/charsets.jar:/usr/share/java/openjfx/jre/lib/ext/jfxrt.jar:/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/ext/dnsns.jar:/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/ext/sunjce_provider.jar:/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/ext/localedata.jar:/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/ext/jaccess.jar:/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/ext/sunec.jar:/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/ext/icedtea-sound.jar:/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/ext/sunpkcs11.jar:/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/ext/zipfs.jar:/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/ext/cldrdata.jar:/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/ext/nashorn.jar:/usr/share/java/java-atk-wrapper.jar:/d/programming/workspace/MusicPlayer/stage/bin:/d/programming/workspace/MusicPlayer/stage/lib/commons-cli-1.4.jar:/d/programming/workspace/MusicPlayer/stage/lib/fuzzywuzzy-1.1.8.jar:/d/programming/workspace/MusicPlayer/stage/lib/jaudiotagger-2.2.6-SNAPSHOT.jar:/d/programming/workspace/MusicPlayer/stage/lib/commons-io-2.5.jar:/d/programming/workspace/MusicPlayer/stage/lib/jsoup-1.11.2.jar:/d/programming/workspace/MusicPlayer/stage/lib/commons-text-1.1.jar:/d/programming/workspace/MusicPlayer/stage/lib/commons-lang3-3.7.jar:/d/programming/workspace/MusicPlayer/stage/lib/jnativehook-2.0.2.jar:/d/programming/workspace/MusicPlayer/stage/lib/jlastfm.jar:/usr/lib/jvm/java-8-openjdk-amd64/lib/javafx-mx.jar:/d/programming/workspace/MusicPlayer/stage/lib/jna-3.5.2.jar:/d/programming/workspace/MusicPlayer/stage/lib/platform-3.5.2.jar:/d/programming/workspace/MusicPlayer/stage/lib/slf4j-api-1.7.10.jar:/d/programming/workspace/MusicPlayer/stage/lib/vlcj-3.10.1.jar)".
The required native libraries are named "libvlc.so" and
"libvlccore.so".
In the text below represents the name of the directory
containing "libvlc.so" and "libvlccore.so"...
There are a number of different ways to specify where to find the
native libraries:
1. Include NativeLibrary.addSearchPath("vlc", ""); at the start of your application code.
2. Include System.setProperty("jna.library.path", ""); at the start of your application code.
3. Specify -Djna.library.path= on the command-line when starting your application.
4. Add to the system search path (and reboot).
If this still does not work, then it may be necessary to explicitly
add the native library directory to the operating system configuration
- e.g. on Linux this might mean setting the LD_LIBRARY_PATH environment variable, or adding configuration to the "/etc/ld.so.conf"
file or the "/etc/ld.so.conf.d" directory. Of these options, setting
LD_LIBRARY_PATH is the only one that would not require root
privileges.
Finally, it is not possible to mix CPU architectures - it is not
possible for a 64-bit Java Virtual Machine to load 32-bit native
libraries.
More information may be available in the log.
at
uk.co.caprica.vlcj.binding.LibVlcFactory.create(LibVlcFactory.java:198)
at
uk.co.caprica.vlcj.player.MediaPlayerFactory.(MediaPlayerFactory.java:259)
at
uk.co.caprica.vlcj.component.AudioMediaPlayerComponent.onGetMediaPlayerFactory(AudioMediaPlayerComponent.java:177)
at
uk.co.caprica.vlcj.component.AudioMediaPlayerComponent.(AudioMediaPlayerComponent.java:109)
at
net.joshuad.hypnos.audio.VLCAudioPlayer.(VLCAudioPlayer.java:75)
at net.joshuad.hypnos.audio.AudioSystem.(AudioSystem.java:85)
at net.joshuad.hypnos.Hypnos.start(Hypnos.java:726) at
com.sun.javafx.application.LauncherImpl.lambda$launchApplication1(LauncherImpl.java:863)
at
com.sun.javafx.application.PlatformImpl.lambda$runAndWait(PlatformImpl.java:326)
at
com.sun.javafx.application.PlatformImpl.lambda$null(PlatformImpl.java:295)
at java.security.AccessController.doPrivileged(Native Method) at
com.sun.javafx.application.PlatformImpl.lambda$runLater(PlatformImpl.java:294)
at
com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)
at com.sun.glass.ui.gtk.GtkApplication._runLoop(Native Method) at
com.sun.glass.ui.gtk.GtkApplication.lambda$null(GtkApplication.java:139)
at java.lang.Thread.run(Thread.java:748)
Aug 5, 2018 22:14:32 PM net.joshuad.hypnos.Hypnos exit INFO: Exit
requested: UNKNOWN_ERROR
Exception in Application start method Aug 5, 2018 22:14:32 PM
net.joshuad.hypnos.Hypnos exit INFO: Exit requested: NORMAL
Exception in Application stop method
java.lang.reflect.InvocationTargetException at
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498) at
com.sun.javafx.application.LauncherImpl.launchApplicationWithArgs(LauncherImpl.java:389)
at
com.sun.javafx.application.LauncherImpl.launchApplication(LauncherImpl.java:328)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498) at
sun.launcher.LauncherHelper$FXHelper.main(LauncherHelper.java:767)
Caused by: java.lang.RuntimeException: Exception in Application start
method at
com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:917)
at
com.sun.javafx.application.LauncherImpl.lambda$launchApplication(LauncherImpl.java:182)
at java.lang.Thread.run(Thread.java:748) Caused by:
java.lang.NullPointerException at
net.joshuad.hypnos.Hypnos.exit(Hypnos.java:692) at
net.joshuad.hypnos.Hypnos.start(Hypnos.java:872) at
com.sun.javafx.application.LauncherImpl.lambda$launchApplication1(LauncherImpl.java:863)
at
com.sun.javafx.application.PlatformImpl.lambda$runAndWait(PlatformImpl.java:326)
at
com.sun.javafx.application.PlatformImpl.lambda$null(PlatformImpl.java:295)
at java.security.AccessController.doPrivileged(Native Method) at
com.sun.javafx.application.PlatformImpl.lambda$runLater(PlatformImpl.java:294)
at
com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)
at com.sun.glass.ui.gtk.GtkApplication._runLoop(Native Method) at
com.sun.glass.ui.gtk.GtkApplication.lambda$null(GtkApplication.java:139)
... 1 more Exception running application net.joshuad.hypnos.Hypnos
搜索到的文件夹内容(显示有libvlc.so和其他):
joshua @Joshua-PC /d/programming/workspace/MusicPlayer/stage/lib/nix/vlc
$ ls -l
total 2.5M
-rwxr-xr-x 1 joshua joshua 1.1M May 15 00:26 libvlccore.so
-rwxr-xr-x 1 joshua joshua 1.1M May 15 00:26 libvlccore.so.9.0.0
lrwxrwxrwx 1 joshua joshua 21 Aug 2 22:57 libvlc_pulse.so -> libvlc_pulse.so.0.0.0
lrwxrwxrwx 1 joshua joshua 21 Aug 2 22:57 libvlc_pulse.so.0 -> libvlc_pulse.so.0.0.0
-rwxr-xr-x 1 joshua joshua 14K May 15 00:26 libvlc_pulse.so.0.0.0
-rwxr-xr-x 1 joshua joshua 150K May 15 00:26 libvlc.so
-rwxr-xr-x 1 joshua joshua 150K May 15 00:26 libvlc.so.5.6.0
lrwxrwxrwx 1 joshua joshua 21 Aug 2 22:57 libvlc_vdpau.so -> libvlc_vdpau.so.0.0.0
lrwxrwxrwx 1 joshua joshua 21 Aug 2 22:57 libvlc_vdpau.so.0 -> libvlc_vdpau.so.0.0.0
-rwxr-xr-x 1 joshua joshua 18K May 15 00:26 libvlc_vdpau.so.0.0.0
lrwxrwxrwx 1 joshua joshua 26 Aug 2 22:57 libvlc_xcb_events.so -> libvlc_xcb_events.so.0.0.0
lrwxrwxrwx 1 joshua joshua 26 Aug 2 22:57 libvlc_xcb_events.so.0 -> libvlc_xcb_events.so.0.0.0
-rwxr-xr-x 1 joshua joshua 9.9K May 15 00:26 libvlc_xcb_events.so.0.0.0
drwxr-xr-x 1 joshua joshua 4.0K Aug 2 22:57 lua
drwxr-xr-x 1 joshua joshua 4.0K Aug 2 22:57 plugins
-rwxr-xr-x 1 joshua joshua 11K May 15 00:26 vlc-cache-gen
我敢打赌发行版的本机库是使用硬编码路径构建的,可能是绝对路径。不幸的是,编写库来要求这些并不罕见——它们通常在构建时作为标志传递到 ./configure 脚本或 makefile 或其他任何内容。唯一的解决方法是自己构建库,或者在目标系统上的发行版库的预期系统目录中安装并行 symlinks/hardlinks,以指向您的库。或者在 chroot 下执行,但这是一个极端的选择,对您来说可能不切实际。
我可以看到使用 appimage 的吸引力,但我所做的是创建一个分发包(.deb 或其他),其中包含我的应用程序和 vlcj,并且依赖于 LibVLC(和 jdk).
我通过下载 appimage of vlc 解决了这个问题,使用 --appimage-extract
cli 选项将其解包,去除我不需要的东西,然后将其重新打包到我的应用程序图像中。
背景:
我正在 Java 中编写跨平台音频播放器。在 Linux 上,我以 appimage (https://appimage.org/) 的形式分发它。我使用 VLC/VLCJ 作为解码引擎。
appimages 的基本准则是将所有必要的库包含在 appimage 中,这些库不能合理地期望默认包含在分发版中。这样做是为了让用户不需要解决依赖关系 and/or 与库和程序之间的版本差异作斗争。他们还建议针对少数 Linux 发行版的 previous 版本进行测试,以确认一切正常。
Ubuntu 16.04 和 Fedora 27.16 默认不安装 libvlc。我相信这对于许多其他发行版来说很常见。因此,我想在我的 appimage 中打包 libvlc 库。
问题:
在 Linux 上,我无法将 vlcj 获取到 recognize/find libvlc.so
和 libvlccore.so
,除非它们是通过发行版安装的。
设置:
我通过我的发行版和我的程序 运行s 安装了 VLC 并且工作正常。
我将
libvlc.so
、libvlccore.so
和其他相关库从我的发行版中的默认位置复制到我的项目中的一个文件夹中。我将该文件夹添加到本机库搜索路径(参见下面的代码)。
我卸载了VLC。
我试着 运行 我的程序。它因下面粘贴的错误而崩溃。
注意:我在 Windows 中使用了相同的基本方法,并且在那里工作得很好。
简化代码:
String nativeVLCLibPath = Hypnos.getRootDirectory().resolve( "lib/nix/vlc/" ).toAbsolutePath().toString();
System.out.println ( "Trying to look for libraries in: " + nativeVLCLibPath );
NativeLibrary.addSearchPath( RuntimeUtil.getLibVlcLibraryName(), nativeVLCLibPath );
错误信息:
Trying to look for libraries in: /d/programming/workspace/MusicPlayer/stage/lib/nix/vlc SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder". SLF4J: Defaulting to no-operation (NOP) logger implementation SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details. Aug 5, 2018 22:14:32 PM net.joshuad.hypnos.Hypnos start SEVERE: class java.lang.RuntimeException: Exception caught at top level of Hypnos. Exiting. java.lang.RuntimeException: Failed to load the native library.
The error was "Unable to load library 'vlc': JNA native support (linux-amd64/libvlc.so) not found in resource path (/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/resources.jar:/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/rt.jar:/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/jsse.jar:/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/jce.jar:/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/charsets.jar:/usr/share/java/openjfx/jre/lib/ext/jfxrt.jar:/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/ext/dnsns.jar:/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/ext/sunjce_provider.jar:/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/ext/localedata.jar:/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/ext/jaccess.jar:/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/ext/sunec.jar:/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/ext/icedtea-sound.jar:/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/ext/sunpkcs11.jar:/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/ext/zipfs.jar:/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/ext/cldrdata.jar:/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/ext/nashorn.jar:/usr/share/java/java-atk-wrapper.jar:/d/programming/workspace/MusicPlayer/stage/bin:/d/programming/workspace/MusicPlayer/stage/lib/commons-cli-1.4.jar:/d/programming/workspace/MusicPlayer/stage/lib/fuzzywuzzy-1.1.8.jar:/d/programming/workspace/MusicPlayer/stage/lib/jaudiotagger-2.2.6-SNAPSHOT.jar:/d/programming/workspace/MusicPlayer/stage/lib/commons-io-2.5.jar:/d/programming/workspace/MusicPlayer/stage/lib/jsoup-1.11.2.jar:/d/programming/workspace/MusicPlayer/stage/lib/commons-text-1.1.jar:/d/programming/workspace/MusicPlayer/stage/lib/commons-lang3-3.7.jar:/d/programming/workspace/MusicPlayer/stage/lib/jnativehook-2.0.2.jar:/d/programming/workspace/MusicPlayer/stage/lib/jlastfm.jar:/usr/lib/jvm/java-8-openjdk-amd64/lib/javafx-mx.jar:/d/programming/workspace/MusicPlayer/stage/lib/jna-3.5.2.jar:/d/programming/workspace/MusicPlayer/stage/lib/platform-3.5.2.jar:/d/programming/workspace/MusicPlayer/stage/lib/slf4j-api-1.7.10.jar:/d/programming/workspace/MusicPlayer/stage/lib/vlcj-3.10.1.jar)".
The required native libraries are named "libvlc.so" and "libvlccore.so".
In the text below represents the name of the directory containing "libvlc.so" and "libvlccore.so"...
There are a number of different ways to specify where to find the native libraries: 1. Include NativeLibrary.addSearchPath("vlc", ""); at the start of your application code. 2. Include System.setProperty("jna.library.path", ""); at the start of your application code. 3. Specify -Djna.library.path= on the command-line when starting your application. 4. Add to the system search path (and reboot).
If this still does not work, then it may be necessary to explicitly add the native library directory to the operating system configuration - e.g. on Linux this might mean setting the LD_LIBRARY_PATH environment variable, or adding configuration to the "/etc/ld.so.conf" file or the "/etc/ld.so.conf.d" directory. Of these options, setting LD_LIBRARY_PATH is the only one that would not require root privileges.
Finally, it is not possible to mix CPU architectures - it is not possible for a 64-bit Java Virtual Machine to load 32-bit native libraries.
More information may be available in the log.
at uk.co.caprica.vlcj.binding.LibVlcFactory.create(LibVlcFactory.java:198) at uk.co.caprica.vlcj.player.MediaPlayerFactory.(MediaPlayerFactory.java:259) at uk.co.caprica.vlcj.component.AudioMediaPlayerComponent.onGetMediaPlayerFactory(AudioMediaPlayerComponent.java:177) at uk.co.caprica.vlcj.component.AudioMediaPlayerComponent.(AudioMediaPlayerComponent.java:109) at net.joshuad.hypnos.audio.VLCAudioPlayer.(VLCAudioPlayer.java:75) at net.joshuad.hypnos.audio.AudioSystem.(AudioSystem.java:85) at net.joshuad.hypnos.Hypnos.start(Hypnos.java:726) at com.sun.javafx.application.LauncherImpl.lambda$launchApplication1(LauncherImpl.java:863) at com.sun.javafx.application.PlatformImpl.lambda$runAndWait(PlatformImpl.java:326) at com.sun.javafx.application.PlatformImpl.lambda$null(PlatformImpl.java:295) at java.security.AccessController.doPrivileged(Native Method) at com.sun.javafx.application.PlatformImpl.lambda$runLater(PlatformImpl.java:294) at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95) at com.sun.glass.ui.gtk.GtkApplication._runLoop(Native Method) at com.sun.glass.ui.gtk.GtkApplication.lambda$null(GtkApplication.java:139) at java.lang.Thread.run(Thread.java:748)
Aug 5, 2018 22:14:32 PM net.joshuad.hypnos.Hypnos exit INFO: Exit requested: UNKNOWN_ERROR
Exception in Application start method Aug 5, 2018 22:14:32 PM net.joshuad.hypnos.Hypnos exit INFO: Exit requested: NORMAL
Exception in Application stop method java.lang.reflect.InvocationTargetException at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at com.sun.javafx.application.LauncherImpl.launchApplicationWithArgs(LauncherImpl.java:389) at com.sun.javafx.application.LauncherImpl.launchApplication(LauncherImpl.java:328) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at sun.launcher.LauncherHelper$FXHelper.main(LauncherHelper.java:767) Caused by: java.lang.RuntimeException: Exception in Application start method at com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:917) at com.sun.javafx.application.LauncherImpl.lambda$launchApplication(LauncherImpl.java:182) at java.lang.Thread.run(Thread.java:748) Caused by: java.lang.NullPointerException at net.joshuad.hypnos.Hypnos.exit(Hypnos.java:692) at net.joshuad.hypnos.Hypnos.start(Hypnos.java:872) at com.sun.javafx.application.LauncherImpl.lambda$launchApplication1(LauncherImpl.java:863) at com.sun.javafx.application.PlatformImpl.lambda$runAndWait(PlatformImpl.java:326) at com.sun.javafx.application.PlatformImpl.lambda$null(PlatformImpl.java:295) at java.security.AccessController.doPrivileged(Native Method) at com.sun.javafx.application.PlatformImpl.lambda$runLater(PlatformImpl.java:294) at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95) at com.sun.glass.ui.gtk.GtkApplication._runLoop(Native Method) at com.sun.glass.ui.gtk.GtkApplication.lambda$null(GtkApplication.java:139) ... 1 more Exception running application net.joshuad.hypnos.Hypnos
搜索到的文件夹内容(显示有libvlc.so和其他):
joshua @Joshua-PC /d/programming/workspace/MusicPlayer/stage/lib/nix/vlc
$ ls -l
total 2.5M
-rwxr-xr-x 1 joshua joshua 1.1M May 15 00:26 libvlccore.so
-rwxr-xr-x 1 joshua joshua 1.1M May 15 00:26 libvlccore.so.9.0.0
lrwxrwxrwx 1 joshua joshua 21 Aug 2 22:57 libvlc_pulse.so -> libvlc_pulse.so.0.0.0
lrwxrwxrwx 1 joshua joshua 21 Aug 2 22:57 libvlc_pulse.so.0 -> libvlc_pulse.so.0.0.0
-rwxr-xr-x 1 joshua joshua 14K May 15 00:26 libvlc_pulse.so.0.0.0
-rwxr-xr-x 1 joshua joshua 150K May 15 00:26 libvlc.so
-rwxr-xr-x 1 joshua joshua 150K May 15 00:26 libvlc.so.5.6.0
lrwxrwxrwx 1 joshua joshua 21 Aug 2 22:57 libvlc_vdpau.so -> libvlc_vdpau.so.0.0.0
lrwxrwxrwx 1 joshua joshua 21 Aug 2 22:57 libvlc_vdpau.so.0 -> libvlc_vdpau.so.0.0.0
-rwxr-xr-x 1 joshua joshua 18K May 15 00:26 libvlc_vdpau.so.0.0.0
lrwxrwxrwx 1 joshua joshua 26 Aug 2 22:57 libvlc_xcb_events.so -> libvlc_xcb_events.so.0.0.0
lrwxrwxrwx 1 joshua joshua 26 Aug 2 22:57 libvlc_xcb_events.so.0 -> libvlc_xcb_events.so.0.0.0
-rwxr-xr-x 1 joshua joshua 9.9K May 15 00:26 libvlc_xcb_events.so.0.0.0
drwxr-xr-x 1 joshua joshua 4.0K Aug 2 22:57 lua
drwxr-xr-x 1 joshua joshua 4.0K Aug 2 22:57 plugins
-rwxr-xr-x 1 joshua joshua 11K May 15 00:26 vlc-cache-gen
我敢打赌发行版的本机库是使用硬编码路径构建的,可能是绝对路径。不幸的是,编写库来要求这些并不罕见——它们通常在构建时作为标志传递到 ./configure 脚本或 makefile 或其他任何内容。唯一的解决方法是自己构建库,或者在目标系统上的发行版库的预期系统目录中安装并行 symlinks/hardlinks,以指向您的库。或者在 chroot 下执行,但这是一个极端的选择,对您来说可能不切实际。
我可以看到使用 appimage 的吸引力,但我所做的是创建一个分发包(.deb 或其他),其中包含我的应用程序和 vlcj,并且依赖于 LibVLC(和 jdk).
我通过下载 appimage of vlc 解决了这个问题,使用 --appimage-extract
cli 选项将其解包,去除我不需要的东西,然后将其重新打包到我的应用程序图像中。