Linux

如何檢查是否安裝了共享庫?

  • October 5, 2020

我的問題源於我在啟動 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:

在 /usr/lib 和 /usr/lib64 中查找這些庫。如果您發現其中一個 ffmpeg 失去,請對其進行符號連結,使其存在於另一個目錄中。

您還可以查找“libm.so.6”並查看該文件的位置。ffmpeg 很有可能在同一目錄中查找失去的目錄。找到它們後,將它們符號連結到那裡。

如果它們在您的伺服器上不存在,請安裝包含它們的軟體包。如果它們包含在 ffmpeg 包中但您沒有看到它們,請嘗試重新安裝 ffmpeg。

您可以使用:

ldconfig -p | grep libavfilter

如果沒有輸出庫則不安裝。我不確定這是否 100% 可靠。

至少在ldconfig選項 -p 的手冊頁中:

列印儲存在目前記憶體中的目錄和候選庫列表。

引用自:https://unix.stackexchange.com/questions/194088