CentOS5.4系统安装在虚拟机上,编译gcc.
挂载CentOS的DVD系统光盘,然后进入CentOS目录内,安装顺序如下:
rpm -ivh cpp-4.1.2-42.el5.i386.rpm
rpm -ihv kernel-headers-2.6.18-92.el5.i386.rpm
rpm -ivh glibc-headers-2.5-24.i386.rpm
rpm -ivh glibc-devel-2.5-24.i386.rpm
rpm -ivh libgomp-4.1.2-42.el5.i386.rpm
rpm -ivh gcc-4.1.2-42.el5.i386.rpm

注意:必须安装: kernel-headers-2.6.18-92.el5.i386.rpm 这个包,否则报错:
warning: glibc-headers-2.5-24.i386.rpm: Header V3 DSA signature: NOKEY, key ID e8562897
error: Failed dependencies:
kernel-headers is needed by glibc-headers-2.5-24.i386
kernel-headers >= 2.2.1 is needed by glibc-headers-2.5-24.i386
安装:g++

rpm -ihv libstdc++-devel-4.1.2-42.el5.i386.rpm
rpm -ihv gcc-c++-4.1.2-42.el5.i386.rpm