告诉 APT 使用从源代码安装的包作为依赖项

告诉 APT 使用从源代码安装的包作为依赖项

我在使用 raspberry pi(我将其用作咨询业务的 Web 服务器),并尝试安装 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:

答案1

你不需要。apt 软件包依赖机制完全基于软件包名称和版本。你应该做的是找到一个满足依赖关系的较新的软件包(或构建一个)并使用它。其他任何事情都是疯狂的。你从中获得的 repophp7.0-dev应该提供其所有依赖项(或至少告诉你从哪里获取它们)。它没有提供,这表明它不是软件包的优质来源,因此你正在进入危险的领域。如果这是你的爱好,那么请继续阅读...

如果您想用胶带将猎枪绑在脚上,并将扳机拉力调整到轻柔的程度,则可以使用名为 的软件包equivs来安装“虚拟”软件包,该软件包本身不包含任何文件,但存在是为了满足依赖关系。不过,正如我丰富多彩的比喻所暗示的那样,这种事情几乎肯定会在未来给您带来难以言喻的问题,我认为在生产系统上这样做无异于疏忽大意。

相关内容