【问题标题】:CentOS7: rpmbuild - Unable to recognise the format of the input fileCentOS7:rpmbuild - 无法识别输入文件的格式
【发布时间】:2019-06-10 06:26:30
【问题描述】:

我正在尝试在 centos7 上构建一个极其简单的 rpm。 我只是将一些预编译的可执行文件从 tar.gz 复制到 /usr/bin/my_rpms/rpm1。 这是我的安装部分:

%install
mkdir -p %{buildroot}/usr/bin/my_rpms/rpm1/
install -D prog prog.o -t %{buildroot}/usr/bin/my_rpms/rpm1/

它过去大部分时间都在寻找。 但是今天当我对 prog 进行了一些更改并重新编译后,它不断收到这些错误:

+ mkdir -p /root/rpmbuild/BUILDROOT/rpm1.x86_64/usr/bin/my_rpms/rpm1/
+ install -D prog prog.o -t /root/rpmbuild/BUILDROOT/rpm1.x86_64/usr/bin/my_rpms/rpm1/
+ /usr/lib/rpm/check-buildroot
+ /usr/lib/rpm/redhat/brp-compress
+ /usr/lib/rpm/redhat/brp-strip /usr/bin/strip
/usr/bin/strip: Unable to recognise the format of the input file `/root/rpmbuild/BUILDROOT/rpm1.x86_64/usr/bin/drivertest_rpms/rpm1/prog.o'

【问题讨论】:

  • 听起来文件已损坏; objdump 认得吗?
  • 是的。文件没有改变。我什至尝试重新构建此 RPM 的先前版本,但以同样的方式失败了。
  • 你没有交叉编译? file 报告了正确的架构等?

标签: centos7 rpmbuild rpm-spec


【解决方案1】:

正如您在错误日志中看到的,问题在于二进制文件条带化,这是install 命令的默认行为。我认为您的构建环境可能与 rpm 环境不同。交叉编译?正如@aaron-d-marasco 所建议的那样

所以我建议从项目源构建 rpm。即将构建命令移动到 .spec 文件的 %build 部分。

或者在你构建它们的同一个地方剥离你的文件,然后在 rpm 中使用%install 部分中的cp 命令而不是install 命令将你的文件移动到目标目录。

【讨论】:

    猜你喜欢
    • 2013-06-12
    • 1970-01-01
    • 2014-10-05
    • 2018-02-15
    • 1970-01-01
    • 1970-01-01
    • 2021-01-13
    • 1970-01-01
    • 2011-05-25
    相关资源
    最近更新 更多