天天看點

Centos 降低Gcc版本

GCC源版本:4.4.6

GCC目标版本:4.1.2

作業系統:CentOS release 6.5 (Final)

          Kernel \r on an \m

tar -zxvf gcc-4.1.2.tar.bz2

cd gcc-4.1.2

./configure --prefix=/Disk/gcc

make

報錯:

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.

解決辦法:

  a.網上都說是修改源碼支援4.1.2版本

configure檔案中texinfo對該版本不支援,可以在解壓gcc4.1.2檔案夾中的configure檔案裡找到以下語句

# For an installed makeinfo, we require it to be from texinfo 4.2 or

# higher, else we use the "missing" dummy.

if ${MAKEINFO} --version \

| egrep 'texinfo[^0-9]*([1-3][0-9]|4\.[2-9]|[5-9])' >/dev/null 2>&1; then

:

else

MAKEINFO="$MISSING makeinfo"

fi

;;

其中4\.[2-9]|[5-9]表示的是支援4.2-4.9之間的幾個版本,是以需要自己添加4\.[1-9][0-9]*,以支援4.1版本。

即把'texinfo[^0-9]*([1-3][0-9]|4\.[2-9]|[5-9])'編輯成'texinfo[^0-9]*([1-3][0-9]|4\.[2-9]|4\.[1-9][0-9]*|[5-9])'後儲存,編譯通過。

-->但嘗試之後失敗<--

  b.yum -y install texinfo

yum -y install ncurses

  c.繼續報錯

/usr/include/gnu/stubs.h:7:27: error: gnu/stubs-32.h: 沒有那個檔案或目錄

make[4]: *** [32/crtbegin.o] 錯誤 1

make[4]: Leaving directory `/Disk/gcc_source/gcc-4.1.2/host-x86_64-unknown-linux-gnu/gcc'

make[3]: *** [extra32] 錯誤 2

make[3]: Leaving directory `/Disk/gcc_source/gcc-4.1.2/host-x86_64-unknown-linux-gnu/gcc'

make[2]: *** [stmp-multilib] 錯誤 2

make[2]: Leaving directory `/Disk/gcc_source/gcc-4.1.2/host-x86_64-unknown-linux-gnu/gcc'

make[1]: *** [all-gcc] 錯誤 2

make[1]: Leaving directory `/Disk/gcc_source/gcc-4.1.2'

make: *** [all] 錯誤 2

   解決辦法:

    yum -y install glibc-devel.i686

make install

yum remove gcc 解除安裝yum安裝的高版本gcc

ln -s /usr/local/bin/gcc /usr/bin/gcc

[root@GHCLC6X-4354 bin]# gcc -v

Using built-in specs.

Target: x86_64-unknown-linux-gnu

Configured with: ./configure --prefix=/Disk/gcc

Thread model: posix

gcc version 4.1.2

gcc 降級成功

本文轉自 xinsir999 51CTO部落格,原文連結:http://blog.51cto.com/xinsir/1579537,如需轉載請自行聯系原作者

繼續閱讀