ldd
在 Linux 上将给出给定二进制文件所依赖的所有共享库的列表。这通常比用于创建二进制文件的链接器命令行上列出的库要广泛得多:它将包括这些库的大多数(如果不是全部)依赖项。
是否可以仅确定显式链接的库列表(即直接依赖项),如果可以,如何确定?
ldd
在 Linux 上将给出给定二进制文件所依赖的所有共享库的列表。这通常比用于创建二进制文件的链接器命令行上列出的库要广泛得多:它将包括这些库的大多数(如果不是全部)依赖项。
是否可以仅确定显式链接的库列表(即直接依赖项),如果可以,如何确定?
sudo apt-get install samba samba-common
Reading package lists... Done
Building dependency tree... Done
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:
samba : Depends: python3-samba (= 2:4.17.10+dfsg-0+deb12u1) but it is not going to be installed
Depends: samba-common-bin (= 2:4.17.10+dfsg-0+deb12u1) but it is not installable
Depends: libc6 (>= 2.34) but 2.31-13+deb11u6 is to be installed
Depends: libldb2 (>= 2:2.6.1) but 2:2.2.3-2~deb11u2 is to be installed
Depends: libtalloc2 (>= 2.3.4~) but 2.3.1-2+b1 is to be installed
Depends: libtdb1 (>= 1.4.7~) but 1.4.3-1+b1 is to be installed
Depends: libtevent0 (>= 0.13.0~) but 0.10.2-1 is to be installed
Depends: samba-libs (= 2:4.17.10+dfsg-0+deb12u1) but 2:4.13.13+dfsg-1~deb11u5 is to be installed
Recommends: attr but it is not going to be installed
Recommends: python3-markdown but it is not going to be installed
Recommends: samba-dsdb-modules but it is not going to be installed
Recommends: samba-vfs-modules but it is not going to be installed
Recommends: samba-ad-provision but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
如何解决未满足的依赖关系?
政策状况:
sudo apt policy
Package files:
100 /var/lib/dpkg/status
release a=now
500 http://mirrors.ustc.edu.cn/debian-security stable-security/main amd64 Packages
release v=12,o=Debian,a=stable-security,n=bookworm-security,l=Debian-Security,c=main,b=amd64
origin mirrors.ustc.edu.cn
100 http://mirrors.163.com/debian bullseye-backports/contrib amd64 Packages
release o=Debian Backports,a=bullseye-backports,n=bullseye-backports,l=Debian Backports,c=contrib,b=amd64
origin mirrors.163.com
100 http://mirrors.163.com/debian bullseye-backports/non-free amd64 Packages
release o=Debian Backports,a=bullseye-backports,n=bullseye-backports,l=Debian Backports,c=non-free,b=amd64
origin mirrors.163.com
100 http://mirrors.163.com/debian bullseye-backports/main amd64 Packages
release o=Debian Backports,a=bullseye-backports,n=bullseye-backports,l=Debian Backports,c=main,b=amd64
origin mirrors.163.com
500 http://mirrors.163.com/debian bullseye-updates/main amd64 Packages
release v=11-updates,o=Debian,a=oldstable-updates,n=bullseye-updates,l=Debian,c=main,b=amd64
origin mirrors.163.com
500 http://mirrors.163.com/debian bullseye/contrib amd64 Packages
release v=11.7,o=Debian,a=oldstable,n=bullseye,l=Debian,c=contrib,b=amd64
origin mirrors.163.com
500 http://mirrors.163.com/debian bullseye/non-free amd64 Packages
release v=11.7,o=Debian,a=oldstable,n=bullseye,l=Debian,c=non-free,b=amd64
origin mirrors.163.com
500 http://mirrors.163.com/debian bullseye/main amd64 Packages
release v=11.7,o=Debian,a=oldstable,n=bullseye,l=Debian,c=main,b=amd64
origin mirrors.163.com
Pinned packages:
我的操作系统:
uname -a
Linux debian 5.10.0-22-amd64 #1 SMP Debian 5.10.178-3 (2023-04-22) x86_64 GNU/Linux
OracleLinux 8.6 包含 32 位软件包glibc-2.28-189.1.0.1.el8.i686.rpm
。这个包需要glibc-common
的正是那个版本:
$ rpm -qpv --requires glibc-2.28-189.1.0.1.el8.i686.rpm
...
manual: glibc-common = 2.28-189.1.0.1.el8
...
但是,存储库不包含glibc-common-2.28-189.1.0.1.el8.i686.rpm
,仅包含glibc-common-2.28-189.1.0.1.el8.x86_64.rpm
.
64位版本能否glibc-common
满足32位glibc
包的依赖需求?如果是这样,为什么不考虑它noarch
,以及 RPM 依赖解析器如何确定它必须引入 RPM 包的 64 位变体?
或者,是否有提供此版本的存储库glibc-common.i686
?我知道Koji存储glibc-common-2.28-189.el8.i686.rpm
库,但它只提供. 2.28-189.1.0.1.el8
Debian 软件包libreoffice-core
(在 Debian 存储库中被描述为包含“LibreOffice 的体系结构相关核心文件”,并且它本身是对libreoffice-writer
和类似软件包的依赖)具有绝对依赖关系(即,软件包的关系是depends
,而不是recommends
或suggests
) on libldap-2.4-2
(描述为“OpenLDAP(轻量级目录访问协议)服务器和客户端的运行时库”)。
为什么?迄今为止,最常见的用例是在运行它的同一台机器上编辑本地存储的文件的文字处理器如何依赖于访问远程目录的协议,如果后者不存在,它甚至无法配置?这只是一个依赖分类错误(即关系实际上应该是recommends
or suggests
),还是 libreoffice 实际上需要安装 OpenLDAP 才能运行?
我在 Debian 9.12 中遇到了以下 libc6 依赖问题。
sudo apt install libc6-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:
libc6-dev : Depends: libc6 (= 2.24-11+deb9u4) but 2.27-6 is to be installed
Depends: libc-dev-bin (= 2.24-11+deb9u4) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
我该如何解决?
EDIT1:apt策略libc6
libc6:
Installed: 2.27-6
Candidate: 2.27-6
Version table:
*** 2.27-6 100
100 /var/lib/dpkg/status
2.24-11+deb9u4 500
500 http://deb.debian.org/debian stretch/main amd64 Packages
2.24-11+deb9u1 500
500 http://security.debian.org/debian-security stretch/updates/main amd64 Packages
编辑2:
sudo apt install libc6/stable libc6-bin/stable locales/stable
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Release 'stable' for 'libc6' was not found
E: Unable to locate package libc6-bin
E: Release 'stable' for 'locales' was not found
我想安装evolution-ews
在Debian 10
. 我已经安装了进化,它没有错误。尝试安装evolution-ews
时,我收到以下错误:
$ sudo apt install evolution-ews
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:
evolution-ews : Depends: libecal-1.2-19 (>= 3.22.6) but it is not going to be installed
Depends: libedata-cal-1.2-28 (>= 3.22.6) but it is not going to be installed
Depends: libevolution (>= 3.22.6) but it is not going to be installed
Depends: libevolution (< 3.23) but it is not going to be installed
Depends: evolution (>= 3.22) but it is not going to be installed
Depends: evolution (< 3.23) but it is not going to be installed
Depends: evolution-data-server (>= 3.22) but it is not going to be installed
Depends: evolution-data-server (< 3.23) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
$ sudo apt install libecal-1.2-19
Reading package lists... Done
Building dependency tree
Reading state information... Done
libecal-1.2-19 is already the newest version (3.30.5-1).
0 upgraded, 0 newly installed, 0 to remove and 3 not upgraded.
$ sudo apt install libedata-cal-1.2-28
Reading package lists... Done
Building dependency tree
Reading state information... Done
libedata-cal-1.2-28 is already the newest version (3.22.7-1).
0 upgraded, 0 newly installed, 0 to remove and 3 not upgraded.
$ sudo apt install libevolution
Reading package lists... Done
Building dependency tree
Reading state information... Done
libevolution is already the newest version (3.30.5-1.1).
0 upgraded, 0 newly installed, 0 to remove and 3 not upgraded.
$ sudo apt install evolution
Reading package lists... Done
Building dependency tree
Reading state information... Done
evolution is already the newest version (3.30.5-1.1).
0 upgraded, 0 newly installed, 0 to remove and 3 not upgraded.
$ sudo apt install evolution-data-server
Reading package lists... Done
Building dependency tree
Reading state information... Done
evolution-data-server is already the newest version (3.30.5-1).
0 upgraded, 0 newly installed, 0 to remove and 3 not upgraded.
$
如您所见,evolution-ews
软件包所需的所有依赖项都已安装,其版本要么较新,要么至少与evolution-ews
所需内容保持同步。
$ dpkg -l | grep ^..r
$ sudo apt-get check
Reading package lists... Done
Building dependency tree
Reading state information... Done
$ dpkg-query -W -f='${db:Status-Abbrev} ${binary:Package}\n' | grep -E ^.[^nci]
$ dpkg --audit
$
如您所见,所有这些命令的输出都是干净的。没有破损的包裹。
的输出apt-mark showhold
指示没有保留的包。
所以这让我在这个阶段想知道:evolution-ews
看起来是一个损坏的包怎么会进入 Debian 存储库 - Debian 应该是“稳定的发行版”。或者我在这里错过了什么?
我在使用 yum 解决我的项目的依赖项时遇到问题,该项目由我们自己构建的多个 RPM 组成。我已经建立了一个 RPM:
Requires: Database-devel = 1.0.0
但是当我运行时:
$ yum deplist Release/ConfigLoader-devel-4.0.1-0.191128.123053.g83eb.b.d.el7.x86_64.rpm
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
* epel: epel.besthosting.ua
package: ConfigLoader-devel.x86_64 4.0.1-0.191128.123053.g83eb.b.d.el7
dependency: /bin/sh
provider: bash.x86_64 4.2.46-31.el7
dependency: Database-devel = 1.0.0
provider: Database-devel.x86_64 2.0.0-0.191126.123742.gb769.r
它表示该依赖项的提供者(最后一行)的版本为 2.0.0。以下附加信息确认 Database-devel 软件包的版本在 yum 存储库中设置正确,并且有 1.0.0 版本可供 yum 选择:
$ yum info Database-devel
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
* epel: epel.besthosting.ua
Available Packages
Name : Database-devel
Arch : x86_64
Version : 2.0.0
Release : 0.191126.123742.gb769.r
Size : 13 k
Repo : localrepo-oel7
$ yum info Database-devel-1.0.0-1
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
* epel: epel.besthosting.ua
Available Packages
Name : Database-devel
Arch : x86_64
Version : 1.0.0
Release : 1
Size : 13 k
Repo : localrepo-oel7
问题是当我尝试安装 ConfigLoader-devel RPM 时,它会尝试拉下 Database-devel 2.0.0 包并安装它,这会破坏我的构建。
我的百胜版本是:
$ yum --version
3.4.3
Installed: rpm-4.11.3-35.el7.x86_64 at 2019-05-21 13:14
Built : CentOS BuildSystem <http://bugs.centos.org> at 2018-10-30 19:27
Committed: Pavlina Moravcova Varekova <[email protected]> at 2018-06-19
Installed: yum-3.4.3-161.0.1.el7.noarch at 2019-06-05 11:27
Built : None at 2018-11-01 10:10
Committed: EL Errata <[email protected]> at 2018-10-31
Installed: yum-plugin-fastestmirror-1.1.31-50.el7.noarch at 2019-05-21 13:15
Built : CentOS BuildSystem <http://bugs.centos.org> at 2018-10-30 22:58
Committed: Michal Domonkos <[email protected]> at 2018-08-24
我该如何进一步诊断?
在这个systemd 单元文件的例子中:
# systemd-timesyncd.service
...
Before=time-sync.target sysinit.target shutdown.target
Conflicts=shutdown.target
Wants=time-sync.target
systemd-timesyncd.service
应该开始之前 time-sync.target
。这定义了一个排序依赖。
但同时systemd-timesyncd.service
想要 time-sync.target
。time-sync.target
它的需求依赖也是如此
这种关系的用例是什么?为什么它们之间没有冲突?
我已经使用 构建了一个 rpm 包rpmbuild
,该包具有以下依赖项:
51f32ecb00b7:/rpm # rpm -qpR pkg.rpm
libc.so.6()(64bit)
libc.so.6(GLIBC_2.14)(64bit)
libc.so.6(GLIBC_2.17)(64bit)
libc.so.6(GLIBC_2.2.5)(64bit)
libc.so.6(GLIBC_2.3)(64bit)
libc.so.6(GLIBC_2.5)(64bit)
libc.so.6(GLIBC_2.7)(64bit)
libcrypto.so.1.0.0()(64bit)
libcurl.so.4()(64bit)
libdl.so.2()(64bit)
libdl.so.2(GLIBC_2.2.5)(64bit)
libjson-c.so.2()(64bit)
libpthread.so.0()(64bit)
libpthread.so.0(GLIBC_2.2.5)(64bit)
libpthread.so.0(GLIBC_2.3.2)(64bit)
libssl.so.1.0.0()(64bit)
rpmlib(CompressedFileNames) <= 3.0.4-1
rpmlib(FileDigests) <= 4.6.0-1
rpmlib(PayloadFilesHavePrefix) <= 4.0-1
rpmlib(PayloadIsXz) <= 5.2-1
我正在尝试在运行 openSUSE 的机器上构建它。但是,我收到以下依赖错误:
51f32ecb00b7:/rpm # rpm -U pkg.rpm
error: Failed dependencies:
libcrypto.so.1.0.0()(64bit) is needed by pkg.noarch
libjson-c.so.2()(64bit) is needed by pkg.noarch
libssl.so.1.0.0()(64bit) is needed by pkg.noarch
我的问题是关于 libssl 依赖项。我的系统中存在以下共享对象:
51f32ecb00b7:/rpm # find / | grep libssl*.so
/lib64/libss.so.2
/lib64/libss.so.2.0
/usr/lib64/libss.so.2
/usr/lib64/libss.so.2.0
/usr/lib64/libssl.so.1.1
libssl.so.1.1
我的问题是:如果我已安装,为什么 RPM 会给我错误?我的 RPM 包依赖libssl.so.1.0.0
,所以不应该兼容吗?据我所知,第一个数字定义了共享对象之间的 ABI 兼容性,因此1.1
应该可以正常使用1.0
dependency 。
最后,如果我运行:
51f32ecb00b7:/rpm # zypper install libopenssl1_0_0
51f32ecb00b7:/rpm # find / | grep libssl*.so
/lib64/libss.so.2
/lib64/libss.so.2.0
/usr/lib64/libss.so.2
/usr/lib64/libss.so.2.0
/usr/lib64/libssl.so.1.1
/usr/lib64/libssl.so.1.0.0
现在,有了/usr/lib64/libssl.so.1.0.0
,它的工作原理:
51f32ecb00b7:/rpm # rpm -U pkg.rpm
error: Failed dependencies:
libjson-c.so.2()(64bit) is needed by pkg.noarch