在 CentOS 5.10 上从 src RPM 构建 gcc 4.1.2

在 CentOS 5.10 上从 src RPM 构建 gcc 4.1.2

我需要有关如何在 CentOS 5.10 上编译 gcc 4.1.2 的建议。

长话短说:

我有一个 Citrix XenServer Creedence beta 1,运行正常。它实际上以 CentOS 5.10 作为 dom0。这可以这样解决:

[admin@xenserver ~]$ rpm -q centos-release
centos-release-5-10.el5.centos 

我需要重新编译 dom0 的内核以包含一些选项。它没有安装 gcc。有一个包含所有源代码的 ISO,我可以在那里找到 gcc 和内核的 src RPM。

在我看来,我必须先编译 gcc,然后构建自定义内核。我完全不是 RedHat 和 CentOS 的粉丝,但我想把所有事情都做好。让我困惑的是那些源 RPM。

gcc RPM 有很多文件,包括补丁:

[admin@xenserver 1]$ l
total 39M
drwxrwxr-x 2 admin admin  12K Sep 13 22:09 ./
drwxrwxr-x 3 admin admin 4.0K Sep 13 22:08 ../
-rwxr-xr-x 1 admin admin 1.7K May 31  2012 dummylib.sh*
-rw-rw-r-- 1 admin admin  37M Sep 17  2008 gcc-4.1.2-20080825.tar.bz2
-rw-r--r-- 1 admin admin  346 May 31  2012 gcc41-ada-pr18302.patch
-rw-r--r-- 1 admin admin 2.5K May 31  2012 gcc41-ada-tweaks.patch
-rw-r--r-- 1 admin admin 149K May 31  2012 gcc41-artificial-attrib.patch
-rw-r--r-- 1 admin admin 3.6K May 31  2012 gcc41-c++-builtin-redecl.patch
-rw-r--r-- 1 admin admin 2.1K May 31  2012 gcc41-c++-gnu-inline-redecl.patch
-rw-r--r-- 1 admin admin  47K May 31  2012 gcc41-CVE-2008-5659.patch
-rw-r--r-- 1 admin admin 6.8K May 31  2012 gcc41-CVE-2009-3736.patch
-rw-r--r-- 1 admin admin 3.0K May 31  2012 gcc41-CVE-2010-0831.patch
-rw-r--r-- 1 admin admin 1.3K May 31  2012 gcc41-debug-fortran-array.patch
-rw-r--r-- 1 admin admin  745 May 31  2012 gcc41-dsohandle.patch
-rw-r--r-- 1 admin admin  16K May 31  2012 gcc41-eh-backport.patch
-rw-r--r-- 1 admin admin  12K May 31  2012 gcc41-error-attrib.patch
-rw-r--r-- 1 admin admin  491 May 31  2012 gcc41-fastjar-filename0.patch
-rw-r--r-- 1 admin admin 1.5K May 31  2012 gcc41-gnuc-rh-release.patch
-rw-r--r-- 1 admin admin 5.4K May 31  2012 gcc41-hash-style-gnu.patch
-rw-r--r-- 1 admin admin  878 May 31  2012 gcc41-i386-libgomp.patch
-rw-r--r-- 1 admin admin  17K May 31  2012 gcc41-ia64-libunwind.patch
-rw-r--r-- 1 admin admin 8.1K May 31  2012 gcc41-ice-hack.patch
-rw-r--r-- 1 admin admin 2.5K May 31  2012 gcc41-java-libdotdotlib.patch
-rw-r--r-- 1 admin admin  641 May 31  2012 gcc41-java-nomulti.patch
-rw-r--r-- 1 admin admin  521 May 31  2012 gcc41-java-slow_pthread_self.patch
-rw-r--r-- 1 admin admin  91K May 31  2012 gcc41-libgomp-speedup.patch
-rw-r--r-- 1 admin admin  16K May 31  2012 gcc41-libjava-anonverscript.patch
-rw-r--r-- 1 admin admin 3.6K May 31  2012 gcc41-omp-outer-ctx.patch
-rw-r--r-- 1 admin admin 1.9K May 31  2012 gcc41-ppc32-retaddr.patch
-rw-r--r-- 1 admin admin 3.0K May 31  2012 gcc41-ppc64-ia64-GNU-stack.patch
-rw-r--r-- 1 admin admin 1014 May 31  2012 gcc41-ppc64-libffi-unwind.patch
-rw-r--r-- 1 admin admin 1.1K May 31  2012 gcc41-ppc64-m32-m64-multilib-only.patch
-rw-r--r-- 1 admin admin 2.1K May 31  2012 gcc41-pr20297-test.patch
-rw-r--r-- 1 admin admin 1.5K May 31  2012 gcc41-pr20880.patch
-rw-r--r-- 1 admin admin 6.5K May 31  2012 gcc41-pr23848.patch
-rw-r--r-- 1 admin admin 1.7K May 31  2012 gcc41-pr25507.patch
-rw-r--r-- 1 admin admin  11K May 31  2012 gcc41-pr27144.patch
-rw-r--r-- 1 admin admin 1.7K May 31  2012 gcc41-pr33844.patch
-rw-r--r-- 1 admin admin 2.2K May 31  2012 gcc41-pr33890.patch
-rw-r--r-- 1 admin admin 1.1K May 31  2012 gcc41-pr33962.patch
-rw-r--r-- 1 admin admin 2.0K May 31  2012 gcc41-pr34070.patch
-rw-r--r-- 1 admin admin 1.3K May 31  2012 gcc41-pr34089.patch
-rw-r--r-- 1 admin admin 3.2K May 31  2012 gcc41-pr34146.patch
-rw-r--r-- 1 admin admin 3.2K May 31  2012 gcc41-pr34178.patch
-rw-r--r-- 1 admin admin 1.9K May 31  2012 gcc41-pr34213.patch
-rw-r--r-- 1 admin admin  935 May 31  2012 gcc41-pr34275.patch
-rw-r--r-- 1 admin admin 1.1K May 31  2012 gcc41-pr34364.patch
-rw-r--r-- 1 admin admin  980 May 31  2012 gcc41-pr34369.patch
-rw-r--r-- 1 admin admin  651 May 31  2012 gcc41-pr34394.patch
-rw-r--r-- 1 admin admin 3.1K May 31  2012 gcc41-pr34506.patch
-rw-r--r-- 1 admin admin 1.8K May 31  2012 gcc41-pr34513.patch
-rw-r--r-- 1 admin admin 2.9K May 31  2012 gcc41-pr36189.patch
-rw-r--r-- 1 admin admin 1.5K May 31  2012 gcc41-pr36237.patch
-rw-r--r-- 1 admin admin 2.6K May 31  2012 gcc41-pr36449.patch
-rw-r--r-- 1 admin admin 2.4K May 31  2012 gcc41-pr37014.patch
-rw-r--r-- 1 admin admin 1.4K May 31  2012 gcc41-pr37731.patch
-rw-r--r-- 1 admin admin 4.3K May 31  2012 gcc41-pr39431.patch
-rw-r--r-- 1 admin admin 1.3K May 31  2012 gcc41-pr39563.patch
-rw-r--r-- 1 admin admin  18K May 31  2012 gcc41-pr39865.patch
-rw-r--r-- 1 admin admin 2.4K May 31  2012 gcc41-pr40057.patch
-rw-r--r-- 1 admin admin 1.3K May 31  2012 gcc41-pr40088.patch
-rw-r--r-- 1 admin admin  954 May 31  2012 gcc41-pr40473.patch
-rw-r--r-- 1 admin admin 1.3K May 31  2012 gcc41-pr41063.patch
-rw-r--r-- 1 admin admin 1.7K May 31  2012 gcc41-pr41646.patch
-rw-r--r-- 1 admin admin 1.2K May 31  2012 gcc41-pr44367.patch
-rw-r--r-- 1 admin admin 2.0K May 31  2012 gcc41-pr46815.patch
-rw-r--r-- 1 admin admin 2.2K May 31  2012 gcc41-pr48481-1.patch
-rw-r--r-- 1 admin admin 1.9K May 31  2012 gcc41-pr48481-2.patch
-rw-r--r-- 1 admin admin 3.5K May 31  2012 gcc41-pr48481-3.patch
-rw-r--r-- 1 admin admin 1.3K May 31  2012 gcc41-pr50055.patch
-rw-r--r-- 1 admin admin 5.3K May 31  2012 gcc41-pr519519.patch
-rw-r--r-- 1 admin admin 8.7K May 31  2012 gcc41-pr7081.patch
-rw-r--r-- 1 admin admin  674 May 31  2012 gcc41-rh184446.patch
-rw-r--r-- 1 admin admin 3.2K May 31  2012 gcc41-rh235008.patch
-rw-r--r-- 1 admin admin 1.2K May 31  2012 gcc41-rh247256.patch
-rw-r--r-- 1 admin admin 2.7K May 31  2012 gcc41-rh251682.patch
-rw-r--r-- 1 admin admin 8.4K May 31  2012 gcc41-rh317051.patch
-rw-r--r-- 1 admin admin  24K May 31  2012 gcc41-rh364001.patch
-rw-r--r-- 1 admin admin 2.1K May 31  2012 gcc41-rh369541-1.patch
-rw-r--r-- 1 admin admin 2.0K May 31  2012 gcc41-rh369541-2.patch
-rw-r--r-- 1 admin admin 5.7K May 31  2012 gcc41-rh407281.patch
-rw-r--r-- 1 admin admin  17K May 31  2012 gcc41-rh426846.patch
-rw-r--r-- 1 admin admin 2.0K May 31  2012 gcc41-rh462397.patch
-rw-r--r-- 1 admin admin 3.4K May 31  2012 gcc41-rh578382.patch
-rw-r--r-- 1 admin admin 1.5K May 31  2012 gcc41-rh605803.patch
-rw-r--r-- 1 admin admin  594 May 31  2012 gcc41-rh630893.patch
-rw-r--r-- 1 admin admin 7.3K May 31  2012 gcc41-rh735304.patch
-rw-r--r-- 1 admin admin 1.5K May 31  2012 gcc41-rh746405.patch
-rw-r--r-- 1 admin admin  803 May 31  2012 gcc41-rh750545.patch
-rw-r--r-- 1 admin admin 2.1K May 31  2012 gcc41-rh797938.patch
-rw-r--r-- 1 admin admin 132K May 31  2012 gcc41.spec
-rw-r--r-- 1 admin admin 259K May 31  2012 gcc41-sse5.patch
-rw-r--r-- 1 admin admin 5.1K May 31  2012 gcc41-sse5-pperm.patch
-rw-r--r-- 1 admin admin 1.3K May 31  2012 gcc41-unwind-cmp.patch
-rw-r--r-- 1 admin admin 2.4K May 31  2012 gcc41-unwind-restore-state.patch
-rw-r--r-- 1 admin admin  574 May 31  2012 gcc41-unwind-swap.patch
-rw-r--r-- 1 admin admin  30K May 31  2012 gcc41-virtual-inline-backtrace.patch
-rw-r--r-- 1 admin admin  16K May 31  2012 libgcc_post_upgrade.c
-rw-r--r-- 1 admin admin  12K May 31  2012 protoize.1
-rw-r--r-- 1 admin admin 2.4K May 31  2012 README.libgcjwebplugin.so

所以我想问为什么所有这些补丁都在这里?如何以及按照什么顺序应用它们?

而让我完全困惑的是这里没有安装任何 gcc。

有人能给我一些关于如何使用这个 src RPM 编译 gcc 的建议吗?

谢谢。

更新关于 rpmbuild 的另一个问题,我将谈谈rpmbuild。在 Citrix XenServer 中,所有标准yum存储库均已禁用。并且必须启用存储库才能安装软件包。因此,当我尝试安装软件包时,rpm-build我得到了我不太理解的输出:

[admin@xenserver 1]$ sudo yum --enablerepo=base --disablerepo=citrix install rpm-build                                                                                                                          
[sudo] password for admin: 
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirror.majorhost.net
base                                                                                                                                                                                     | 1.1 kB     00:00     
Excluding Packages from CentOS-5 - Base
Finished
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package rpm-build.x86_64 0:4.4.2.3-34.el5 set to be updated
--> Processing Dependency: elfutils for package: rpm-build
--> Running transaction check
---> Package elfutils.x86_64 0:0.137-3.el5 set to be updated
--> Processing Dependency: elfutils-libs-x86_64 = 0.137-3.el5 for package: elfutils
--> Processing Dependency: elfutils-libelf-x86_64 = 0.137-3.el5 for package: elfutils
--> Processing Dependency: libdw.so.1(ELFUTILS_0.130)(64bit) for package: elfutils
--> Processing Dependency: libdw.so.1(ELFUTILS_0.126)(64bit) for package: elfutils
--> Processing Dependency: libdw.so.1(ELFUTILS_0.127)(64bit) for package: elfutils
--> Processing Dependency: libasm.so.1(ELFUTILS_1.0)(64bit) for package: elfutils
--> Processing Dependency: libdw.so.1(ELFUTILS_0.122)(64bit) for package: elfutils
--> Processing Dependency: libdw.so.1()(64bit) for package: elfutils
--> Processing Dependency: libasm.so.1()(64bit) for package: elfutils
--> Running transaction check
---> Package elfutils.x86_64 0:0.137-3.el5 set to be updated
--> Processing Dependency: elfutils-libelf-x86_64 = 0.137-3.el5 for package: elfutils
---> Package elfutils-libs.x86_64 0:0.137-3.el5 set to be updated
--> Processing Dependency: elfutils-libelf-x86_64 = 0.137-3.el5 for package: elfutils-libs
--> Finished Dependency Resolution
elfutils-libs-0.137-3.el5.x86_64 from base has depsolving problems
  --> Missing Dependency: elfutils-libelf-x86_64 = 0.137-3.el5 is needed by package elfutils-libs-0.137-3.el5.x86_64 (base)
elfutils-0.137-3.el5.x86_64 from base has depsolving problems
  --> Missing Dependency: elfutils-libelf-x86_64 = 0.137-3.el5 is needed by package elfutils-0.137-3.el5.x86_64 (base)
Error: Missing Dependency: elfutils-libelf-x86_64 = 0.137-3.el5 is needed by package elfutils-0.137-3.el5.x86_64 (base)
Error: Missing Dependency: elfutils-libelf-x86_64 = 0.137-3.el5 is needed by package elfutils-libs-0.137-3.el5.x86_64 (base)
 You could try using --skip-broken to work around the problem
 You could try running: package-cleanup --problems
                        package-cleanup --dupes
                        rpm -Va --nofiles --nodigest
The program package-cleanup is found in the yum-utils package.

是否yum告诉我实际上无法安装该rpm-build包?

答案1

最好使用 来构建源 RPM rpmbuild,或者更好的是使用,mock因为此工具将通过在 chroot 中执行所有操作来保持构建环境清洁并与其运行的系统分离。

这并不需要在最终 RPM 所针对的实际系统上完成;您始终可以启动运行相同目标操作系统的虚拟机并在其上执行构建。

如果你做不到,总会有新的Fedora 项目的 COPR 服务。此构建服务允许您提交 EL 5、6、7 和当前版本的 Fedora 的源 RPM,在 Fedora 服务器上构建它们,并创建 yum 存储库,然后您可以直接使用。它的功能与 Ubuntu 的 PPA 服务非常相似。

当然,由于这是随操作系统发行版附带的软件包,因此您可以简单地安装在任何 CentOS 镜像上可以找到的现有二进制包。


但归根结底,这里的问题是您的 yum 配置中有一些可能不合适的软件包排除项。检查/etc/yum.conf和文件以/etc/yum.repos.d确定这些排除项在哪里,然后将其删除。哦,您可能还需要重新启用存储updates库。

相关内容