如何检查共享库是否安装?

如何检查共享库是否安装?

我的问题源于我启动 ffmpeg 时遇到的问题。我已经安装了ffmpeg,显示已安装:

whereis ffmpeg 
ffmpeg: /usr/bin/ffmpeg /usr/bin/X11/ffmpeg /usr/share/ffmpeg /usr/share/man/man1/ffmpeg.1.gz

后来,我发现有些程序依赖于安装本身不附带的库,所以我用 ldd 命令检查了缺少的内容:

# ldd /usr/bin/ffmpeg
    linux-vdso.so.1 =>  (0x00007fff71fe9000)
    libavfilter.so.0 => not found
    libpostproc.so.51 => not found
    libswscale.so.0 => not found
    libavdevice.so.52 => not found
    libavformat.so.52 => not found
    libavcodec.so.52 => not found
    libavutil.so.49 => not found
    libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f5f20bdf000)
    libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f5f209c0000)
    libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f5f205fb000)
    /lib64/ld-linux-x86-64.so.2 (0x00007f5f20f09000)

事实证明我的 ffmpeg 也被 7 个库切断了。我首先认为必须安装每个库,但后来发现,可能安装了部分或全部库,但 ffmpeg 不知道它们的位置。我读到 /etc/ld.so.conf 和 /etc/ld.so.cache 包含库的路径,但我很困惑,因为,其中只有一行

/etc/ld.so.conf
 cat /etc/ld.so.conf
include /etc/ld.so.conf.d/*.conf

但很长/etc/ld.so.cache

我现在正处于一个不知如何进一步调查的地步,弄清楚如何确定给定的库是否确实已安装(即使 ffmpeg 未知其位置)可能会很有帮助。

---------Output---of----apt-cache-policy-----request---------
apt-cache policy
Package files:
 100 /var/lib/dpkg/status
     release a=now
 500 http://archive.canonical.com/ubuntu/ trusty/partner Translation-en
 500 http://archive.canonical.com/ubuntu/ trusty/partner i386 Packages
     release v=14.04,o=Canonical,a=trusty,n=trusty,l=Partner archive,c=partner
     origin archive.canonical.com
 500 http://archive.canonical.com/ubuntu/ trusty/partner amd64 Packages
     release v=14.04,o=Canonical,a=trusty,n=trusty,l=Partner archive,c=partner
     origin archive.canonical.com
 500 http://security.ubuntu.com/ubuntu/ trusty-security/universe Translation-en
 500 http://security.ubuntu.com/ubuntu/ trusty-security/restricted Translation-en
 500 http://security.ubuntu.com/ubuntu/ trusty-security/multiverse Translation-en
 500 http://security.ubuntu.com/ubuntu/ trusty-security/main Translation-en
 500 http://security.ubuntu.com/ubuntu/ trusty-security/multiverse i386 Packages
     release v=14.04,o=Ubuntu,a=trusty-security,n=trusty,l=Ubuntu,c=multiverse
     origin security.ubuntu.com
 500 http://security.ubuntu.com/ubuntu/ trusty-security/universe i386 Packages
     release v=14.04,o=Ubuntu,a=trusty-security,n=trusty,l=Ubuntu,c=universe
     origin security.ubuntu.com
 500 http://security.ubuntu.com/ubuntu/ trusty-security/restricted i386 Packages
     release v=14.04,o=Ubuntu,a=trusty-security,n=trusty,l=Ubuntu,c=restricted
     origin security.ubuntu.com
 500 http://security.ubuntu.com/ubuntu/ trusty-security/main i386 Packages
     release v=14.04,o=Ubuntu,a=trusty-security,n=trusty,l=Ubuntu,c=main
     origin security.ubuntu.com
 500 http://security.ubuntu.com/ubuntu/ trusty-security/multiverse amd64 Packages
     release v=14.04,o=Ubuntu,a=trusty-security,n=trusty,l=Ubuntu,c=multiverse
     origin security.ubuntu.com
 500 http://security.ubuntu.com/ubuntu/ trusty-security/universe amd64 Packages
     release v=14.04,o=Ubuntu,a=trusty-security,n=trusty,l=Ubuntu,c=universe
     origin security.ubuntu.com
 500 http://security.ubuntu.com/ubuntu/ trusty-security/restricted amd64 Packages
     release v=14.04,o=Ubuntu,a=trusty-security,n=trusty,l=Ubuntu,c=restricted
     origin security.ubuntu.com
 500 http://security.ubuntu.com/ubuntu/ trusty-security/main amd64 Packages
     release v=14.04,o=Ubuntu,a=trusty-security,n=trusty,l=Ubuntu,c=main
     origin security.ubuntu.com
 500 http://archive.ubuntu.com/ubuntu/ trusty-updates/universe Translation-en
 500 http://archive.ubuntu.com/ubuntu/ trusty-updates/restricted Translation-en
 500 http://archive.ubuntu.com/ubuntu/ trusty-updates/multiverse Translation-en
 500 http://archive.ubuntu.com/ubuntu/ trusty-updates/main Translation-en
 500 http://archive.ubuntu.com/ubuntu/ trusty-updates/multiverse i386 Packages
     release v=14.04,o=Ubuntu,a=trusty-updates,n=trusty,l=Ubuntu,c=multiverse
     origin archive.ubuntu.com
 500 http://archive.ubuntu.com/ubuntu/ trusty-updates/universe i386 Packages
     release v=14.04,o=Ubuntu,a=trusty-updates,n=trusty,l=Ubuntu,c=universe
     origin archive.ubuntu.com
 500 http://archive.ubuntu.com/ubuntu/ trusty-updates/restricted i386 Packages
     release v=14.04,o=Ubuntu,a=trusty-updates,n=trusty,l=Ubuntu,c=restricted
     origin archive.ubuntu.com
 500 http://archive.ubuntu.com/ubuntu/ trusty-updates/main i386 Packages
     release v=14.04,o=Ubuntu,a=trusty-updates,n=trusty,l=Ubuntu,c=main
     origin archive.ubuntu.com
 500 http://archive.ubuntu.com/ubuntu/ trusty-updates/multiverse amd64 Packages
     release v=14.04,o=Ubuntu,a=trusty-updates,n=trusty,l=Ubuntu,c=multiverse
     origin archive.ubuntu.com
 500 http://archive.ubuntu.com/ubuntu/ trusty-updates/universe amd64 Packages
     release v=14.04,o=Ubuntu,a=trusty-updates,n=trusty,l=Ubuntu,c=universe
     origin archive.ubuntu.com
 500 http://archive.ubuntu.com/ubuntu/ trusty-updates/restricted amd64 Packages
     release v=14.04,o=Ubuntu,a=trusty-updates,n=trusty,l=Ubuntu,c=restricted
     origin archive.ubuntu.com
 500 http://archive.ubuntu.com/ubuntu/ trusty-updates/main amd64 Packages
     release v=14.04,o=Ubuntu,a=trusty-updates,n=trusty,l=Ubuntu,c=main
     origin archive.ubuntu.com
 500 http://archive.ubuntu.com/ubuntu/ trusty/universe Translation-en
 500 http://archive.ubuntu.com/ubuntu/ trusty/restricted Translation-en
 500 http://archive.ubuntu.com/ubuntu/ trusty/multiverse Translation-en
 500 http://archive.ubuntu.com/ubuntu/ trusty/main Translation-en
 500 http://archive.ubuntu.com/ubuntu/ trusty/multiverse i386 Packages
     release v=14.04,o=Ubuntu,a=trusty,n=trusty,l=Ubuntu,c=multiverse
     origin archive.ubuntu.com
 500 http://archive.ubuntu.com/ubuntu/ trusty/universe i386 Packages
     release v=14.04,o=Ubuntu,a=trusty,n=trusty,l=Ubuntu,c=universe
     origin archive.ubuntu.com
 500 http://archive.ubuntu.com/ubuntu/ trusty/restricted i386 Packages
     release v=14.04,o=Ubuntu,a=trusty,n=trusty,l=Ubuntu,c=restricted
     origin archive.ubuntu.com
 500 http://archive.ubuntu.com/ubuntu/ trusty/main i386 Packages
     release v=14.04,o=Ubuntu,a=trusty,n=trusty,l=Ubuntu,c=main
     origin archive.ubuntu.com
 500 http://archive.ubuntu.com/ubuntu/ trusty/multiverse amd64 Packages
     release v=14.04,o=Ubuntu,a=trusty,n=trusty,l=Ubuntu,c=multiverse
     origin archive.ubuntu.com
 500 http://archive.ubuntu.com/ubuntu/ trusty/universe amd64 Packages
     release v=14.04,o=Ubuntu,a=trusty,n=trusty,l=Ubuntu,c=universe
     origin archive.ubuntu.com
 500 http://archive.ubuntu.com/ubuntu/ trusty/restricted amd64 Packages
     release v=14.04,o=Ubuntu,a=trusty,n=trusty,l=Ubuntu,c=restricted
     origin archive.ubuntu.com
 500 http://archive.ubuntu.com/ubuntu/ trusty/main amd64 Packages
     release v=14.04,o=Ubuntu,a=trusty,n=trusty,l=Ubuntu,c=main
     origin archive.ubuntu.com
 700 http://extra.linuxmint.com/ rebecca/main i386 Packages
     release v=17.1,o=linuxmint,a=rebecca,n=rebecca,l=linuxmint,c=main
     origin extra.linuxmint.com
 700 http://extra.linuxmint.com/ rebecca/main amd64 Packages
     release v=17.1,o=linuxmint,a=rebecca,n=rebecca,l=linuxmint,c=main
     origin extra.linuxmint.com
 700 http://packages.linuxmint.com/ rebecca/import i386 Packages
     release v=17.1,o=linuxmint,a=rebecca,n=rebecca,l=linuxmint,c=import
     origin packages.linuxmint.com
 700 http://packages.linuxmint.com/ rebecca/upstream i386 Packages
     release v=17.1,o=linuxmint,a=rebecca,n=rebecca,l=linuxmint,c=upstream
     origin packages.linuxmint.com
 700 http://packages.linuxmint.com/ rebecca/main i386 Packages
     release v=17.1,o=linuxmint,a=rebecca,n=rebecca,l=linuxmint,c=main
     origin packages.linuxmint.com
 700 http://packages.linuxmint.com/ rebecca/import amd64 Packages
     release v=17.1,o=linuxmint,a=rebecca,n=rebecca,l=linuxmint,c=import
     origin packages.linuxmint.com
 700 http://packages.linuxmint.com/ rebecca/upstream amd64 Packages
     release v=17.1,o=linuxmint,a=rebecca,n=rebecca,l=linuxmint,c=upstream
     origin packages.linuxmint.com
 700 http://packages.linuxmint.com/ rebecca/main amd64 Packages
     release v=17.1,o=linuxmint,a=rebecca,n=rebecca,l=linuxmint,c=main
     origin packages.linuxmint.com
Pinned packages:

答案1

您可以使用:

ldconfig -p | grep libavfilter

如果没有输出库则说明没有安装。我不确定这是否100%可靠。
至少在ldconfigfor 选项 -p 的手册页中:

打印当前缓存中存储的目录和候选库的列表。

答案2

在 /usr/lib 和 /usr/lib64 中查找这些库。如果您发现其中一个 ffmpeg 丢失,请对其进行符号链接,以便它存在于另一个目录中。

您还可以运行“libm.so.6”查找并查看该文件所在的位置。 ffmpeg 很有可能在同一目录中查找丢失的文件。一旦找到它们,就将它们符号链接到那里。

如果您的服务器上不存在它们,请安装包含它们的软件包。如果它们包含在 ffmpeg 软件包中但您没有看到它们,请尝试重新安装 ffmpeg。

答案3

使用该命令file `which ffmpeg`确定是ffmpeg针对 64 位还是 32 位进行编译。如果是 64 位,请查找/usr/lib64.如果是 32 位,则在/usr/lib.如果ffmpeg是静态链接的,那么没关系...它不会使用任何共享库,并且 的输出file也会告诉您这一点。

不要在/usr/lib和之间进行符号链接库/usr/lib64。这对您没有帮助,因为 64 位程序将需要 64 位库(在 参考资料中找到/usr/lib64),而 32 位程序将需要 32 位库(在 参考资料中找到/usr/lib32)。

如果您的服务器上不存在这些库,请安装提供它们的软件包(如果 ffmpeg 是 32 位,请确保选择 32 位软件包等)。

答案4

您可以使用 find 命令来搜索软件包,例如以下命令将返回您系统上可用的所有 libavfilter.so。

sudo find / -iname "libavfilter.so.*"

请注意,如果您刚刚安装了该软件包并且尚未将其加载到 ldd,则 ldconfig 命令可能对您不起作用。所以更完整的答案是:

sudo ldconfig
ldconfig -p | grep libavfilter

相关内容