Apt

告訴 APT 使用從源安裝的包作為依賴項

  • August 15, 2017

我在樹莓派上(我將它用作我的諮詢業務的網路伺服器),我正在嘗試安裝包 php7.0-dev。但是,如果我有這個問題:

sudo apt-get install php7.0-dev
Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
php7.0-dev : Depends: libtool (>= 2.4.6-0.1~) but 2.4.2-1.11 is to be installed
         Recommends: dh-php but it is not going to be installed
         Recommends: pkg-php-tools but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

問題似乎是 libtool 是 pi 儲存庫中的舊版本。為了解決這個問題,我剛剛下載了 libtool 2.4.6 的原始碼並安裝了它。但是,如果我再次執行上述內容,我仍然會遇到相同的錯誤。

有沒有辦法告訴 APT 使用我為該依賴項安裝的 libtool?

這是 libtool 的路徑

apt-cache showpkg libtool
Package: libtool
Versions:
2.4.6-2 (/var/lib/apt/lists/mirrordirector.raspbian.org_raspbian_dists_stretch_main_binary-armhf_Packages)
Description Language:
                File: /var/lib/apt/lists/mirrordirector.raspbian.org_raspbian_dists_jessie_main_binary-armhf_Packages
                 MD5: 40ea3da4a4ea75419ad95742898b3e52

2.4.2-1.11 (/var/lib/apt/lists/mirrordirector.raspbian.org_raspbian_dists_jessie_main_binary-armhf_Packages) (/var/lib/dpkg/status)
Description Language:
                File: /var/lib/apt/lists/mirrordirector.raspbian.org_raspbian_dists_jessie_main_binary-armhf_Packages
                 MD5: 40ea3da4a4ea75419ad95742898b3e52


Reverse Depends:
 dh-autoreconf,libtool 2.4.2
 xfce4-dev-tools,libtool
 wireshark-dev,libtool
 ui-auto,libtool 1.5.8
 slapos-node-unofficial,libtool
 shtool,libtool
 ruby-build,libtool
 proftpd-dev,libtool
 php7.0-dev,libtool 2.4.6-0.1~
 php5-dev,libtool 2.4.6
 php5-dev,libtool 2.2
 multimedia-devel,libtool
 mm-common,libtool
 mate-common,libtool
 libtool-bin,libtool 2.4.2-1.8~
 libtool-bin,libtool 2.4.6-2
 liblua5.1-0-dev,libtool
 libltdl-dev,libtool 1.5.20
 libltdl-dev,libtool 1.5.20
 libltdl-dev,libtool
 gnome-common,libtool
 gcc,libtool
 dh-lua,libtool
 dh-autoreconf,libtool 2.4.2
 autoconf,libtool
 anjuta,libtool
 xfce4-dev-tools,libtool
 wireshark-dev,libtool
 ui-auto,libtool 1.5.8
 slapos-node-unofficial,libtool
 shtool,libtool
 ruby-build,libtool
 proftpd-dev,libtool
 php5-dev,libtool 2.2
 php5-dev,libtool 2.2
 packaging-dev,libtool
 multimedia-devel,libtool
 mm-common,libtool 1.5
 mate-common,libtool
 lua5.1-policy-dev,libtool
 libtool-bin,libtool 2.4.2-1.8~
 libtool-bin,libtool 2.4.2-1.11
 libsidl-dev,libtool
 liblua5.2-dev,libtool
 liblua5.1-0-dev,libtool
 libltdl-dev,libtool 1.5.20
 libltdl-dev,libtool 1.5.20
 libltdl-dev,libtool
 libdune-common-dev,libtool
 grid-packaging-tools,libtool
 gnulib,libtool
 gnome-common,libtool
 gcc,libtool
 freehdl,libtool
 drizzle-plugin-dev,libtool
 dh-lua,libtool
 dh-autoreconf,libtool 2.4.2
 autoconf,libtool
 anjuta,libtool
Dependencies:
2.4.6-2 - gcc (16 (null)) c-compiler (0 (null)) cpp (0 (null)) libc6-dev (16 (null)) libc-dev (0 (null)) file (0 (null)) autotools-dev (0 (null)) libtool-doc (0 (null)) autoconf (4 2.50) automaken (0 (null)) gfortran (16 (null)) fortran95-compiler (0 (null)) gcj-jdk (0 (null)) libltdl-dev (0 (null)) autoconf (1 2.12) automake (1 1.3) libtool1.4 (0 (null))
2.4.2-1.11 - gcc (16 (null)) c-compiler (0 (null)) cpp (0 (null)) libc6-dev (16 (null)) libc-dev (0 (null)) file (0 (null)) autotools-dev (0 (null)) libtool-doc (0 (null)) autoconf (4 2.50) automaken (0 (null)) gfortran (16 (null)) fortran95-compiler (0 (null)) gcj-jdk (0 (null)) libltdl-dev (0 (null)) autoconf (1 2.12) automake (1 1.3) libtool1.4 (0 (null))
Provides:
2.4.6-2 -
2.4.2-1.11 -
Reverse Provides:

你沒有。apt 包依賴機製完全基於包名和版本。你應該做的是找到一個滿足依賴關係的更新包(或建構一個)並使用它。其他任何事情都是瘋狂的。您從中獲得的 repophp7.0-dev應該提供其所有依賴項(或者至少告訴您從哪裡獲取它們)。這並不意味著它不是優質的包裹來源,因此您正在涉足危險領域。如果那是你的事,那麼請繼續閱讀……

如果您想將霰彈槍綁在腳上並將扳機拉回羽毛狀,您可以使用一個名為的軟體包equivs來安裝一個“虛擬”軟體包,該軟體包本身沒有任何文件,但存在來滿足依賴。不過,正如我豐富多彩的比喻所暗示的那樣,這幾乎肯定會在未來再次給您帶來無法解決的問題,我認為在生產系統上執行此操作無異於疏忽。

引用自:https://serverfault.com/questions/868568