我正在尝试从源代码安装 plexmediaplayer。这涉及编译 libmpv.so.1,我已经完成并安装在 /usr/local/lib 下
当我运行 plexmediaplayer 时,出现以下错误:
$ plexmediaplayer
plexmediaplayer: error while loading shared libraries: libmpv.so.1: cannot open shared object file: No such file or directory
ldconfig 正确找到库:
$ ldconfig -v | grep libmpv
libmpv.so.1 -> libmpv.so.1.24.0
plexmiediaplayer 二进制文件上的 ldd 显示 libmpv:
$ ldd plexmediaplayer | grep libmpv
libmpv.so.1 => /usr/local/lib/libmpv.so.1 (0x00007f2fe4f33000)
这是一个符号链接:
ls -l /usr/local/lib/libmpv.so.1
lrwxrwxrwx 1 root root 16 Feb 9 20:37 /usr/local/lib/libmpv.so.1 -> libmpv.so.1.24.0
共享对象和可执行文件都是针对 x86_64 编译的,并且可由尝试运行 plexmediaplayer 的非 root 用户读取:
$ file /usr/local/lib/libmpv.so.1.24.0
/usr/local/lib/libmpv.so.1.24.0: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, BuildID[sha1]=855d9cbf952c76e3c0c1c1a162c4c94ea5a12b91, not stripped
$ file /usr/local/bin/plexmediaplayer
/usr/local/bin/plexmediaplayer: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 2.6.32, BuildID[sha1]=dc92ac026c5ac7bc3e5554a591321de81a3f4576, not stripped
这些都符合我的机器架构:
$ uname -a
Linux hostname 4.4.0-66-generic #87-Ubuntu SMP Fri Mar 3 15:29:05 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
在 plexmediaplayer 上运行 strace 会得到以下结果:
$ strace -o lotsalogs -ff -e trace=file plexmediaplayer
open("/opt/Qt5.8.0/5.8/gcc_64//lib/tls/x86_64/libmpv.so.1", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
open("/opt/Qt5.8.0/5.8/gcc_64//lib/tls/libmpv.so.1", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
open("/opt/Qt5.8.0/5.8/gcc_64//lib/x86_64/libmpv.so.1", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
open("/opt/Qt5.8.0/5.8/gcc_64//lib/libmpv.so.1", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
open("/usr/local/lib/libmpv.so.1", O_RDONLY|O_CLOEXEC) = -1 EACCES (Permission denied)
open("/lib/x86_64-linux-gnu/tls/x86_64/libmpv.so.1", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
open("/lib/x86_64-linux-gnu/tls/libmpv.so.1", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
open("/lib/x86_64-linux-gnu/x86_64/libmpv.so.1", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
open("/lib/x86_64-linux-gnu/libmpv.so.1", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
open("/usr/lib/x86_64-linux-gnu/tls/x86_64/libmpv.so.1", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
open("/usr/lib/x86_64-linux-gnu/tls/libmpv.so.1", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
open("/usr/lib/x86_64-linux-gnu/x86_64/libmpv.so.1", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
open("/usr/lib/x86_64-linux-gnu/libmpv.so.1", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
open("/lib/tls/x86_64/libmpv.so.1", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
open("/lib/tls/libmpv.so.1", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
open("/lib/x86_64/libmpv.so.1", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
open("/lib/libmpv.so.1", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
open("/usr/lib/tls/x86_64/libmpv.so.1", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
open("/usr/lib/tls/libmpv.so.1", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
open("/usr/lib/x86_64/libmpv.so.1", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
open("/usr/lib/libmpv.so.1", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
包括:
open("/usr/local/lib/libmpv.so.1", O_RDONLY|O_CLOEXEC) = -1 EACCES (Permission denied)
但通过符号链接对文件的权限是:
ls -l /usr/local/lib/libmpv.so.1.24.0
-rwxr-xr-x 1 root root 27872856 Mar 22 22:17 /usr/local/lib/libmpv.so.1.24.0
有什么想法为什么我的二进制文件找不到这个吗?
编辑:我擦除了 下的所有 libmpv/usr/local/lib
和 plexmediaplayer 下的所有内容/usr/local/bin
,并按源目录删除,然后在虚拟机中并排重新安装。虚拟机中的构建有效,而我的主机上的构建无效。我还在两台机器上对 ld 进行了哈希处理,并且(毫不奇怪)它们匹配。
答案1
事实证明,我(糟糕?)几个月前为 plexmediaplayer 配置了 apparmor,这导致了更新和重新编译时出现问题。
答案2
我能够通过运行解决这个问题sudo cp /usr/local/lib/libmpv*.so /usr/lib32
ldd plexmediaplayer
显示出相同的结果,尽管有库,但它们没有工作。