ubuntu13.04下gcc4.5.1的安装

摘要:
(1) 前往gcc官方网站下载源代码包http://ftp.gnu.org/gnu/gcc/gcc-4.5.1/gcc-4.5.1.tar.bz2(2)在编译和安装gcc之前,您需要安装三个库。如果以下命令不起作用,您可以在官方网站上下载它们:$wgetftp://ftp.dti.ad.jp/pub/lang/gcc/infrastructure/gmp-4.3.2.tar.bz2 $ wgetftp://ftp.dti.

(1)去gcc官网下载源码包http://ftp.gnu.org/gnu/gcc/gcc-4.5.1/gcc-4.5.1.tar.bz2

(2)编译安装gcc之前需要先安装三个库,如果下面命令行不通,对应的都可以到官网下载:

$wgetftp://ftp.dti.ad.jp/pub/lang/gcc/infrastructure/gmp-4.3.2.tar.bz2

$wgetftp://ftp.dti.ad.jp/pub/lang/gcc/infrastructure/mpfr-2.4.2.tar.bz2
$wgetftp://ftp.dti.ad.jp/pub/lang/gcc/infrastructure/mpc-0.8.1.tar.gz

但是这种方法好像比较麻烦,mpfr依赖gmp的安装,mpc依赖前面两者的安装;

接着运行./configure--prefix=/afs/ihep.ac.cn/soft/common/gcc/gcc--enable-threads=posix--disable-multlib--enable-languages=c,c++,java--with-gmp-lib=gmpInstallDir/lib--with-gmp-include=gmpInstallDir/include--with-mpfr-lib=mpfrInstallDir/lib--with-mpfr-include=mpfrInstallDir/include--with-mpc-lib=mpcInstallDir/lib--with-mpc-include=mpcInstallDir/include

(3)所以我才用下面的方式通过apt-get install直接、分别进行安装:

在编译安装mpfr时出现错误,通过如下方式解决:

Availble mpfr version for 13.04 is 3.1.1-1. See packages.ubuntu.com for information.

You can install it by :

 sudo apt-get install libmpfr-dev libmpfr-doc libmpfr4 libmpfr4-dbg
期间它会自动安装libgmp-dev
随后的mpc也是通过apt-get install libmpc-dev实现
通过apt-get install 默认的安装路径:/usr/bin /usr/lib /usr/share /usr/share/man
通过dpkg -L 软件名(如libgmp-dev)查看安装位置;
这些库的include目录、lib目录默认已经添加进环境变量;因此在编译安装gcc时不需要在./configure中显示说明
(4)进入gcc-4.5.1的目标目录,运行如下命令:(不是目标错误回报错https://gcc.gnu.org/bugzilla/show_bug.cgi?id=28298中Sebastian Forsman 2006-08-15 17:09:20 UTC 所说)
./configure--prefix=/afs/ihep.ac.cn/soft/common/gcc/gcc--enable-threads=posix--disable-multlib--enable-languages=c,c++,java
即可
(5)然后运行make、make check、make install命令
在make的时候出现错误:
/usr/include/stdc-predef.h:30:26: fatal error: bits/predefs.h:没有那个文件或目录
通过如下方法解决:   1. 确定你的系统是x86_64 GNU/Linux     #uname -a 输出像:32 UTC 2008 x86_64 GNU/Linu     安装libc6-dev-i386:sudo apt-get install libc6-dev-i386
  2. 32位系统:sudo apt-get install libc6-dev
  3.输入sudo apt-get installgcc-multilib 即可
../.././libgcc/../gcc/config/i386/linux-unwind.h:138:17: error: field ‘info’ has incomplete type
通过打开linux-unwind.h,将138行由struct siginfo info;修改为siginfo_t info;
/usr/bin/ld: cannot find crti.o: 没有那个文件或目录
通过再网上找资料发现 export LIBRARY_PATH=/usr/lib/i386-linux-gnu中存在crti.o
./.libs/libgcj.so: undefined reference to `__cxa_call_unexpected”.
To resolve, we need to modify the prims.cc file like below:--- libjava/prims.cc 2014-01-11 +++ libjava/prims.cc 2014-01-11 @@ -38,6 +38,14 @@ details. */
......... #endif
#ifndef DISABLE_GETENV_PROPERTIES +#ifdef __GLIBC__ +#define __NO_CTYPE 1 +#endif #include <ctype.h> #include <java-props.h> #define PROCESS_GCJ_PROPERTIES process_gcj_properties()
.........
(6)后续配置
查看原来的gcc所在的路径:which gcc
export PATH="/usr/local/gcc-4.5.1/bin:$PATH"
export LD_LIBRARY_PATH=/usr/local/gcc-4.5.1/lib:$LD_LIBRARY_PATH
通过gcc -v查看版本

免责声明:文章转载自《ubuntu13.04下gcc4.5.1的安装》仅用于学习参考。如对内容有疑问,请及时联系本站处理。

上篇golang-指针,函数,mapdotpeek的导出下篇

宿迁高防,2C2G15M,22元/月;香港BGP,2C5G5M,25元/月 雨云优惠码:MjYwNzM=

相关文章

linux动态链接库---一篇讲尽

一般我们在Linux下执行某些外部程序的时候可能会提示找不到共享库的错误, 比如:tmux: error while loading shared libraries: libevent-1.4.so.2: cannot open shared object file: No such file or directory原因一般有两个, 一个是操作系统里确...

在perl上装DBD:mysql 的问题

在perl上装DBD:mysql ,就这事弄了多半天。mysql实在是不咋地 首先,在装DBD:mysql模块时,make后打印出错误信息,如下:gcc: language strconst not recognized gcc: dbdimp.c: linker input file unused because linking not done gcc...

CentOS+Nginx+PHP+Mysql 服务器配置

[利用yum命令配置、升级所需程序库] # sudo -s# LANG=C# yum -y install gcc gcc-c++ autoconf #yum -y install make //如果不安装make,那么cmake的时候会出问题 # yum -y install cmake # yum -y install bison 接下来最好手动编译...

Mac anaconda 在terminal中fbprophet安装过程

首先要安装好conda install pystan 再安装pip install fbprohet 调试的时候报错一:cannot import name 'easter' from 'holidays' holiday版本过高(将版本下载) pip install holidays==0.9.8 依旧解决不了问题,于是整体升级版本 pip instal...

Ubuntu16.04中Appium的安装和使用

准备工作 root@ranxf-TEST:/home/ranxf# conda create -n appium python=3.7 root@ranxf-TEST:/home/ranxf# conda info -e # conda environments: # base * /root/anaconda3 ap...

JumpServer跳板机的搭建与部署

---恢复内容开始--- 搭建之前要准备一个全新的虚拟机,不然容易出错    报你的配置文件错误   不知道什么原因(有待纠正)1.先解压源码包(不能在/root目录中,因为别的用户不能进) tar xf jumpserver-master.tar.gz -C /usr/local/ 2.搭建阿里云yum仓库 wget -O /etc/yum.repos....