手动安装gcc-4.6

Eva ·
更新时间:2024-11-10
· 817 次阅读

手动安装gcc-4.6 1.下载所需的gcc版本(4.6)

链接: gcc 中国下载镜像,选择安装的gcc版本(4.6),下载安装包gcc-4.6.4.tar.gz

2. 解压缩安装包 3. 下载编译所需的依赖包 $ ./contrib/download_prerequisites 4. 编译 创建gcc-build文件夹,存放编译结果。(单独存放在另外一个目录中,不能是源目录的子目录) 配置configure $ ../gcc-4.6.4/configure --enable-checking=release --enable-languages=c,c++ --disable-multilib

这个过程中出现了问题:

msgfmt: /home/xx/XX/Tools/gcc/gcc-build-4.6.4/x86_64-unknown-linux-gnu/libstdc++-v3/src/.libs/libstdc++.so.6: version `CXXABI_1.3.8' not found (required by /usr/lib/x86_64-linux-gnu/libicuuc.so.55) Makefile:451: recipe for target 'de.mo' failed make[4]: *** [de.mo] Error 1 make[4]: Leaving directory '/home/xx/XX/Tools/gcc/gcc-build-4.6.4/x86_64-unknown-linux-gnu/libstdc++-v3/po' Makefile:469: recipe for target 'all-recursive' failed make[3]: *** [all-recursive] Error 1 make[3]: Leaving directory '/home/xx/XX/Tools/gcc/gcc-build-4.6.4/x86_64-unknown-linux-gnu/libstdc++-v3' Makefile:377: recipe for target 'all' failed make[2]: *** [all] Error 2 make[2]: Leaving directory '/home/xx/XX/Tools/gcc/gcc-build-4.6.4/x86_64-unknown-linux-gnu/libstdc++-v3' Makefile:16876: recipe for target 'all-target-libstdc++-v3' failed make[1]: *** [all-target-libstdc++-v3] Error 2 make[1]: Leaving directory '/home/xx/XX/Tools/gcc/gcc-build-4.6.4' Makefile:898: recipe for target 'all' failed make: *** [all] Error 2

解决方法如下:

//确认该地址中 CXXABI_1.3.8 真的不存在 $ strings /home/xx/XX/Tools/gcc/gcc-build-4.6.4/x86_64-unknown-linux-gnu/libstdc++-v3/src/.libs/libstdc++.so.6 | grep CXXABI CXXABI_1.3 CXXABI_1.3.1 CXXABI_1.3.2 CXXABI_1.3.3 CXXABI_1.3.4 CXXABI_1.3.5 CXXABI_1.3 CXXABI_1.3.2 CXXABI_1.3.1 CXXABI_1.3.5 CXXABI_1.3.4 CXXABI_1.3.3 //查看系统中是否存在 $ strings /usr/lib/x86_64-linux-gnu/libstdc++.so.6 | grep CXXABI CXXABI_1.3 CXXABI_1.3.1 CXXABI_1.3.2 CXXABI_1.3.3 CXXABI_1.3.4 CXXABI_1.3.5 CXXABI_1.3.6 CXXABI_1.3.7 CXXABI_1.3.8 CXXABI_1.3.9 CXXABI_TM_1 CXXABI_FLOAT128 //发现系统中存在 $ ln -sf /usr/lib/x86_64-linux-gnu/libstdc++.so.6 /home/xx/XX/Tools/gcc/gcc-build-4.6.4/x86_64-unknown-linux-gnu/libstdc++-v3/src/.libs/libstdc++.so.6 编译及安装 $ make & make install 4. 安装后

运行configure命令时,没有指定安装目录,因此上述命令会将gcc到默认位置:/usr/local
可执行文件在/usr/local/bin

$ ls /usr/local/bin c++ gcc x86_64-unknown-linux-gnu-g++ cpp gcov x86_64-unknown-linux-gnu-gcc g++ x86_64-unknown-linux-gnu-c++ x86_64-unknown-linux-gnu-gcc-4.6.4 $ /usr/local/bin/gcc -v 使用内建 specs。 COLLECT_GCC=/usr/local/bin/gcc COLLECT_LTO_WRAPPER=/usr/local/libexec/gcc/x86_64-unknown-linux-gnu/4.6.4/lto-wrapper 目标:x86_64-unknown-linux-gnu 配置为:../gcc-4.6.4/configure --enable-checking=release --enable-languages=c,c++ --disable-multilib 线程模型:posix gcc 版本 4.6.4 (GCC)
作者:桃子小迷妹



安装gcc gcc

需要 登录 后方可回复, 如果你还没有账号请 注册新账号