rpmbuild 失败 |缺少依赖项(但是安装了缺少的依赖项)

rpmbuild 失败 |缺少依赖项(但是安装了缺少的依赖项)

我正在尝试为我公司使用的各种代理构建 RPM 和 Repo。这个特定的包有一个私有库,我无法弄清楚问题是什么。

该包似乎构建得很好,但是我收到以下错误:

[root@test ~]# rpm -ivh rpmbuild/RPMS/x86_64/ir-agent-1-1.el8.x86_64.rpm
error: Failed dependencies:
        libc.so.6 is needed by ir-agent-1-1.el8.x86_64
        libc.so.6(GLIBC_2.0) is needed by ir-agent-1-1.el8.x86_64
        libc.so.6(GLIBC_2.1.3) is needed by ir-agent-1-1.el8.x86_64
        libdl.so.2 is needed by ir-agent-1-1.el8.x86_64

glib-2.28-164.el8.x86_64 安装在系统上,所以我不清楚问题是什么。

以下是我正在使用的规格文件:

[root@test ~]# cat rpmbuild/SPECS/ir-agent-1.0.spec
Name:           ir-agent
Version:        1
Release:        1%{?dist}
Summary:        Rapid7 Insight Agent
Group:          Application/Other
License:        BSD
URL:            www.rapid7.com
Source0:        %{name}-%{version}.tar.gz
BuildArch:      x86_64
BuildRequires:  systemd
Requires:  glibc
 
 
%description
Aires installation of Rapid7 Insight Agent.
 
%global debug_package %{nil}
%global __provides_exclude_from $RPM_BUILD_ROOT/opt/rapid7/ir_agent/components/insight_agent/3.1.3.80/lib/.*\\.so$
 
%prep
%setup -q
 
%build
 
%install
#%{__mkdir} -p %{buildroot}%{base_install_dir}
#%{__install} -D -m 755 %{SOURCE0}
rm -rf $RPM_BUILD_ROOT
mkdir -p $RPM_BUILD_ROOT/usr/lib/systemd/{system,system-preset}
mkdir -p $RPM_BUILD_ROOT/opt/rapid7/ir_agent/components/network_sensor/{0,common}
mkdir -p $RPM_BUILD_ROOT/opt/rapid7/ir_agent/components/insight_agent/{3.1.3.80,common}
mkdir -p $RPM_BUILD_ROOT/opt/rapid7/ir_agent/components/bootstrap/{2.4.0.5,common,ssl}
 
cp 90-ir-agent.preset $RPM_BUILD_ROOT/usr/lib/systemd/system-preset/
cp ir-agent.service $RPM_BUILD_ROOT/usr/lib/systemd/system/
cp config.json $RPM_BUILD_ROOT/opt/rapid7/ir_agent/components/insight_agent/common/
cp client.{key,crt} $RPM_BUILD_ROOT/opt/rapid7/ir_agent/components/bootstrap/ssl/
cp cafile.pem $RPM_BUILD_ROOT/opt/rapid7/ir_agent/components/bootstrap/ssl/
cp -r local/* $RPM_BUILD_ROOT/opt/rapid7/ir_agent/components/insight_agent/3.1.3.80/
cp local/bootstrap $RPM_BUILD_ROOT/opt/rapid7/ir_agent
mv local/bootstrap $RPM_BUILD_ROOT/opt/rapid7/ir_agent/components/insight_agent/3.1.3.80/ir_agent
ln -s /opt/rapid7/ir_agent/components/insight_agent/3.1.3.80/ir_agent $RPM_BUILD_ROOT/opt/rapid7/ir_agent/components/insight_agent/insight_agent
 
%clean
rm -rf $RPM_BUILD_ROOT
 
%post
%systemd_post ir-agent.service
 
%preun
%systemd_preun ir-agent.service
 
%postun
%systemd_postun_with_restart ir-agent.service
 
%files
%defattr(600,root,root,751)
%dir /opt/rapid7/ir_agent
%config %attr(600, root, root) /opt/rapid7/ir_agent/components/insight_agent/common/config.json
%attr(600, root, root) /opt/rapid7/ir_agent/*
%ghost /opt/rapid7/ir_agent/components/insight_agent/insight_agent
%attr(700, root, root) /opt/rapid7/ir_agent/components/insight_agent/3.1.3.80/bootstrap
%attr(700, root, root) /opt/rapid7/ir_agent/components/insight_agent/3.1.3.80/bootstrap_upgrader
%attr(700, root, root) /opt/rapid7/ir_agent/components/insight_agent/3.1.3.80/connectivity_test
%attr(700, root, root) /opt/rapid7/ir_agent/components/insight_agent/3.1.3.80/get_proxy
%attr(700, root, root) /opt/rapid7/ir_agent/components/insight_agent/3.1.3.80/ir_agent
%attr(700, root, root) /opt/rapid7/ir_agent/components/insight_agent/3.1.3.80/token_handler
%attr(700, root, root) /opt/rapid7/ir_agent/components/insight_agent/3.1.3.80/upgrade_agent
%attr(644, root, root) /usr/lib/systemd/system/ir-agent.service
%attr(644, root, root) /usr/lib/systemd/system-preset/90-ir-agent.preset
 
%doc
 
%changelog
* Sat Mar 5 2022 
- release 1.0 - initial release
 

我没有在构建 RPM 方面做太多工作,所以我不清楚除了定义“需要”之外还可以做什么。

答案1

看来你的包ir-agent需要glibc.i686版本。您可以使用以下命令安装它

dnf install glibc.i686

如果 x86 架构(此 64 位)需要缺少的模块,则需要libdl.so.2()(64bit).注意(64位)那里。

使用

dnf provides \*libbdl.so\*

会给你正是这样的。

要回答有关如何显式指定i686版本的问题,您可以完全使用该版本(包名称不变)。例如

Requires:  glibc.i686

这也是可能的:

Requires: /lib/libc.so.6

其工作方式与您使用yumdnf安装软件包的方式相同。例如

dnf install */bin/lsof

.. 将安装.rpm提供此二进制文件的包。

提示:mock如果您正在构建 rpm 软件包,请使用。

想了解更多关于rpm打包的信息:https://www.redhat.com/sysadmin/create-rpm-package

相关内容