事情的起因
在编译linux0.11内核的时候,编译完成后在bochs上一直跑不起来,一直卡在 Loading System… 页面。正常的思路应该是改代码,让代码适应gcc。可是很遗憾我暂时还么有这个能力,只能让gcc版本来适应我的代码。
事情的经过
1、环境准备
Centos6.8_x86
我的gcc版本
目标版本gcc4.1.2
2、开始安装
tar jxvf gcc-4.1.2.tar.bz2
cd gcc-4.1.2
./configure --prefix=/usr/local/gcc-4.1.2 --enable-language=c,c++
make
ERROR1
WARNING: `makeinfo' is missing on your system. You should only need it if
you modified a `.texi' or `.texinfo' file, or any other file
indirectly affecting the aspect of the manual. The spurious
call might also be the consequence of using a buggy `make' (AIX,
DU, IRIX). You might want to install the `Texinfo' package or
the `GNU make' package. Grab either from any GNU archive site.
解决1
yum install texinfo
将gcc-4.1.2目录下的Makefile文件中的.../missing makeinfo改成/usr/bin/makeinfo
继续 make
10分钟后,编译完成
make install
3、配置
删除 /usr/bin 目录下的 cc,gcc,g++,cpp 并创建同名软连接到 /usr/local/gcc-4.1.2/bin 目录下的相应文件
mv gcc cc g++ cpp gcc_bak/
ln -s /usr/local/gcc-4.1.2/bin/gcc gcc
ln -s gcc cc
ln -s /usr/local/gcc-4.1.2/bin/g++ g++
ln -s /usr/local/gcc-4.1.2/bin/cpp cpp
4、gcc安装完成
更新后的gcc版本