我尝试在 FC 12 上从 *.src.rpm 文件进行构建,这样文件就会像普通二进制构建一样分布在我的系统中(在这种情况下,*.h 文件最终位于 /usr/include 中)。当我运行 rpmbuild 时,头文件不存在。这是我的 rpmbuild 命令:
[root@localhost sphirewalld]# rpm -ivv /home/dan/Downloads/gtest-1.3.0-2.20090601svn257.fc12.src.rpm
============== /home/dan/Downloads/gtest-1.3.0-2.20090601svn257.fc12.src.rpm
Expected size: 489395 = lead(96)+sigs(180)+pad(4)+data(489115)
Actual size: 489395
loading keyring from pubkeys in /var/lib/rpm/pubkeys/*.key
couldn't find any keys in /var/lib/rpm/pubkeys/*.key
loading keyring from rpmdb
opening db environment /var/lib/rpm/Packages cdb:mpool:joinenv
opening db index /var/lib/rpm/Packages rdonly mode=0x0
locked db index /var/lib/rpm/Packages
opening db index /var/lib/rpm/Name rdonly mode=0x0
read h# 931 Header sanity check: OK
added key gpg-pubkey-57bbccba-4a6f97af to keyring
read h# 1327 Header sanity check: OK
added key gpg-pubkey-7fac5991-4615767f to keyring
read h# 1420 Header sanity check: OK
added key gpg-pubkey-16ca1a56-4a100959 to keyring
read h# 1896 Header sanity check: OK
added key gpg-pubkey-a3a882c1-4a1009ef to keyring
Using legacy gpg-pubkey(s) from rpmdb
/home/dan/Downloads/gtest-1.3.0-2.20090601svn257.fc12.src.rpm: Header SHA1 digest: OK (3e98ed9b1631395d417e00f35c83ebe588ea9d3b)
added source package [0]
found 1 source and 0 binary packages
Expected size: 489395 = lead(96)+sigs(180)+pad(4)+data(489115)
Actual size: 489395
InstallSourcePackage at: psm.c:232: Header SHA1 digest: OK (3e98ed9b1631395d417e00f35c83ebe588ea9d3b)
gtest-1.3.0-2.20090601svn257.fc12
========== Directories not explicitly included in package:
0 /root/rpmbuild/SOURCES/
1 /root/rpmbuild/SPECS/
==========
warning: user mockbuild does not exist - using root
warning: group mockbuild does not exist - using root
fini 100664 1 ( 0, 0) 478034 /root/rpmbuild/SOURCES/gtest-1.3.0.tar.bz2;4ba93ce1 unknown
warning: user mockbuild does not exist - using root
warning: group mockbuild does not exist - using root
fini 100644 1 ( 0, 0) 30505 /root/rpmbuild/SOURCES/gtest-svnr257.patch;4ba93ce1 unknown
warning: user mockbuild does not exist - using root
warning: group mockbuild does not exist - using root
fini 100644 1 ( 0, 0) 2732 /root/rpmbuild/SPECS/gtest.spec;4ba93ce1 unknown
GZDIO: 63 reads, 511788 total bytes in 0.005930 secs
closed db index /var/lib/rpm/Name
closed db index /var/lib/rpm/Packages
closed db environment /var/lib/rpm/Packages
感谢您的帮助。
答案1
抱歉,我没有使用 Fedora,所以我不能确定,但我发现这个问题已经有一段时间没有得到解答了。我确实构建了大量的 RPM,但针对的是不同的发行版 (PLD)。
您的输出没有说明生成了什么。您确定没有与主二进制 rpm 一起生成 -devel 子包吗?您是否查看了 src.rpm 包内的文件并确保您要查找的文件在其中?您的 rpmbuild 脚本是否有任何标志来表示“包含 devel 文件”或类似内容?
答案2
我的答案很可能不再相关,但rpm -i(vv)
不能用于从源 RPM 包构建二进制 RPM 包。这需要使用rpmbuild
,例如rpmbuild --rebuild /<…>/gtest-1.3.0-2.20090601svn257.fc12.src.rpm
。对于源 RPM 包,实际发生的一切rpm -i(vv)
是将源 RPM 包的内容提取到 rpmbuild 目录结构中,具体来说,/root/rpmbuild/{SOURCES,SPECS}/
在这种情况下。要构建这个填充的 rpmbuild 目录结构,cd /root/rpmbuild/SPECS/
后面rpmbuild -ba gtest.spec
可以使用(我不建议这样做,因为不应以特权用户身份构建 RPM 包,因为软件和/或 spec 文件中的错误或错误可能会在意外引用构建环境之外的路径时损坏您的操作系统)。