ubuntu12.10下用gcc4.7.2编译4.6.3,
来源:互联网 发布:北京知名软件外国企业 编辑:程序博客网 时间:2024/05/22 11:55
from:http://blog.csdn.net/logicouter/article/details/7776507
下载依赖库:
GNU Multiple Precision Library (GMP) version 4.3.2 (or later)
Necessary to build GCC. If a GMP source distribution is found in a subdirectory of your GCC sources named gmp, it will be built together with GCC. Alternatively, if GMP is already installed but it is not in your library search path, you will have to configure with the --with-gmp configure option. See also --with-gmp-lib and --with-gmp-include.
MPFR Library version 2.4.2 (or later)
Necessary to build GCC. It can be downloaded from http://www.mpfr.org/. If an MPFR source distribution is found in a subdirectory of your GCC sources named mpfr, it will be built together with GCC. Alternatively, if MPFR is already installed but it is not in your default library search path, the --with-mpfr configure option should be used. See also --with-mpfr-lib and --with-mpfr-include.
MPC Library version 0.8.1 (or later)
Necessary to build GCC. It can be downloaded from http://www.multiprecision.org/. If an MPC source distribution is found in a subdirectory of your GCC sources named mpc, it will be built together with GCC. Alternatively, if MPC is already installed but it is not in your default library search path, the --with-mpc configure option should be used. See also --with-mpc-lib and --with-mpc-include.
在ftp://gcc.gnu.org/pub/gcc/infrastructure下载并按上述顺序编译。
设置环境变量LD_LIBRARY_PATH,包含上述3个库下的lib目录(重要!)否则会出现如cannot comput subfix(.o)等问题。
../gcc-4.7.1/configure --prefix=/home/changweiwu/usr --with-gmp=/home/changweiwu/usr/ --with-mpfr=/home/changweiwu/usr --with-mpc=/home/changweiwu/usr/ --enable-languages=c,c++
以上在suse的机器上编译通过,但在ubuntu下会有下述问题,需要进行设置头文件、库文件搜索路径:
ISSUE#1
checking for suitable m4... configure: error: No usable m4 in $PATH or /usr/5bin (see config.log for reasons).
Solution:
#sudo apt-get install m4
ISSUE#2
In file included from /usr/include/stdio.h:28:0,
from ../../../../gcc-4.7.0/libgcc/../gcc/tsystem.h:88,
from ../../../../gcc-4.7.0/libgcc/libgcc2.c:29:
/usr/include/features.h:324:26: fatal error: bits/predefs.h: No such file or directory
compilation terminated.
make[5]: *** [_muldi3.o] Error 1
Analysis:
Use 'locate bits/predefs.h' to find the path of this header. (in '/usr/include/x86_64-linux-gnu')
Solution:
#export C_INCLUDE_PATH=/usr/include/i386-linux-gnu && export CPLUS_INCLUDE_PATH=$C_INCLUDE_PATH
ISSUE#3
In file included from /usr/include/features.h:389:0,
from /usr/include/stdio.h:28,
from ../../../../gcc-4.7.0/libgcc/../gcc/tsystem.h:88,
from ../../../../gcc-4.7.0/libgcc/libgcov.c:29:
/usr/include/i386-linux-gnu/gnu/stubs.h:7:27: fatal error: gnu/stubs-32.h: No such file or directory
compilation terminated.
make[5]: *** [_gcov.o] Error 1
Analysis:
Related to libc multilib, disable it with '--disable-multilib' should work.
Solution:
add '--disable-multilib' and 'configure' again, then run 'make'.
ISSUE#4
/usr/bin/ld: cannot find crti.o: No such file or directory
collect2: error: ld returned 1 exit status
make[3]: *** [libgcc_s.so] Error 1
make[3]: *** Waiting for unfinished jobs....
Analysis:
Use 'locate crti.o' to find this file. (in '/usr/lib/i386-linux-gnu/crti.o') Set LIBRARY_PATH (LDFLAGS)
Solution:
#export LIBRARY_PATH=/usr/lib/i386-linux-gnu
make && make install
参考资料:
http://gcc.gnu.org/install/
http://gcc.gnu.org/onlinedocs/gccint/index.html
http://hi.baidu.com/yehsos/blog/item/88b2d6b4200dcb748ad4b2d5.html
http://www.oschina.net/question/12_49423
http://blog.csdn.net/gengshenghong/article/details/7498085
- ubuntu12.10下用gcc4.7.2编译4.6.3,
- ubuntu12.04下用gcc4.6编译android4.0.3
- ubuntu12.04 编译gcc4.8.0
- linux下编译gcc4
- ubuntu12.10 MTK GCC4.4.3
- ubuntu12.04上编译gcc4.8
- linux-0.11 GCC4.3下可编译运行的源码
- ubuntu12.04下手动编译安装gcc4.7.1
- GCC4.7下crypto++编译报错
- 在centos6.2下编译gcc4.7
- centos 6 下编译gcc4.8.3
- UBUNTU 12.04下编译安装 GCC4.1.2
- mac os下编译gcc4.9.2
- linux(Centos)下编译安装gcc4.8.2
- ubuntu12.10下OpenFoam的编译
- linux0.11源代码在gcc4.3.x gcc4.4.x下编译bochs下模拟
- 在CentOS 6.3编译gcc4.7.2
- cetos6.3编译安装gcc4.8.1
- hexdump用法
- linux下时间有关的函数和结构体
- Google GSON GsonBuilder().setDateFormat("yyyy-MM-dd HH:mm:ss")不能格式化Data
- 2012第二届GIS制图大赛——赛前培训资料(下篇)& 培训资料下载
- C++ 连接数据库
- ubuntu12.10下用gcc4.7.2编译4.6.3,
- impdp数据表table导入
- minicom设置
- vs2008常见调试问题汇总
- eclipse开发velocity实例(初学)
- 字符串的全排列和组合算法
- js中date的用法(转)
- C++ delete和delete[]
- ExtJS4组件_form表单配置-属性-方法详解