suse11安装gcc多版本

1.下载gcc4.1.2(http://gcc.gnu.org/)

2.解压(我是解压在/usr/local/src).建立文件夹/usr/local/gcc-4.1.2,为后来的安装做准备

3.#cd /usr/local/src/gcc-4.1.2

#./configure  --prefix=/usr/local/gcc-4.1.2  --enable-threads=posix  --disable-checking  --with-system-zlib --enable-languages=c,c++  --host=x86_64-linux 

#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

解决办法:安装texinfo(我安装的是texinfo4.12)

修改gcc-4.1.2的configure:

3551 if ${MAKEINFO} --version \
3552 | egrep 'texinfo[^0-9]*([1-3][0-9]|4\.[2-9]|[5-9])' >/dev/null 2>&1;then

将其中的4\.[2-9]|[5-9]改成4.\[1-9]|[1-9](因为我的是4.12)

重新make,又出现错误:

error: gnu/stubs-32.h: No such file or directory

解决办法

Fix for Debian Linux

Type the following command:
$ sudo apt-get install libc6-dev

Fix for Ubuntu Linux

Type the following command:
$ sudo apt-get install libc6-dev-i386

Fix for OpenSUSE / Novell Suse Linux (SLES)

Type the following command:
# zypper in glibc-devel-32bit

Fix for RHEL / Fedora / CentOS / Scientific Linux

Type the following yum command to install glibc package:
# yum install glibc-devel.i686

4. make install

5.使用 update-alternatives 管理多版本共存的软件

首先添加 gcc 的配置管理

#update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.3 50
#update-alternatives --install /usr/bin/gcc gcc /usr/local/gcc-4.1.2/bin/x86_64-linux-gcc-4.1.2 40
查看并选择gcc的不同版本

update-alternatives --config gcc

There are 2 alternatives which provide `gcc'.


  Selection    Alternative
-----------------------------------------------
 +        1    /usr/bin/gcc-4.3
*         2    /usr/local/gcc-4.1.2/bin/x86_64-linux-gcc-4.1.2


Press enter to keep the default[*], or type selection number:_

选择对应的就可以了。



评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值