centos6.4 gcc降級至4.1.2過程


安裝tfs,需要gcc-4.1.2版本的,我的centos6.4 是4.7版本它編譯不了,很奇怪。下面是gcc-4.1.2的安裝。
 

解包:tar -xjf gcc-4.1.2.tar.bz2

進入目錄:cd gcc-4.1.2

# ./configure && 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.
make[3]: *** [fastjar.info] 錯誤 1
make[3]:正在離開目錄 `/home/ssm/gcc-obj/fastjar'
make[2]: *** [all] 錯誤 2
make[2]:正在離開目錄 `/home/ssm/gcc-obj/fastjar'
make[1]: *** [all-fastjar] 錯誤 2
make[1]:正在離開目錄 `/home/ssm/gcc-obj'
make: *** [all] 錯誤 2

(主要原因是GCC的版本過高)

出現此錯誤的原因也在於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.2版本。即把’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])’后保存,編譯

接着又報錯:

/usr/include/gnu/stubs.h:7:27: error: gnu/stubs-32.h:

參考:http://stackoverflow.com/questions/7412548/gnu-stubs-32-h-no-such-file-or-directory

On Ubuntu it's called libc6-dev-i386 - do sudo apt-get install libc6-dev-i386. See below for extra instructions for Ubuntu 12.04.

On Red Hat distros, the package name is glibc-devel.i686 (Thanks to David Gardner's comment)

On CentOS 5.8, the package name is glibc-devel.i386 (Thanks to JimKleck's comment)

On CentOS 6.3, the package name is glibc-devel.i686.

On SLES it's called glibc-devel-32bit - do zypper in glibc-devel-32bit

so,   yum install glibc-devel.i686

繼續編譯 make

然后 make install

 

最后, 重啟 ,即可(當時以為失敗了,結果第二天打開時,亮瞎了雙眼,尼瑪)

[hadoop@luxury ~]$ gcc -v
使用內建 specs。
目標:x86_64-unknown-linux-gnu
配置為:./configure
線程模型:posix
gcc 版本 4.1.2


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM