zoukankan      html  css  js  c++  java
  • x86_64 Ubuntu 14.04 LST安装gcc4.1.2 转载

    由于编译源码软件需要用到gcc4.1.2版本,但是本机已经安装有gcc4.8.4,下载gcc4.1.2源码编译总会出现运行找不到库文件错误,或者i386和x86_64不兼容问题,在http://askubuntu.com/,stackoverflow都有相似问题的解答,但最终还是一篇中文博客顺利的安装成功。

    1. 下载&解压源码

    $ wget http://ftp.gnu.org/gnu/gcc/gcc-4.1.2/gcc-4.1.2.tar.bz2
    $ tar xvjf gcc-4.1.2.tar.bz2

    2. 安装依赖库, 以及软件

    $ sudo apt-get install libc6-dev libgmp-dev libmpfr-dev texinfo

    3. 为头文件以及所需库添加链接
    添加如下链接, 这取决于你的 Ubuntu 系统架构, 如果你使用的是64位的ubuntu系统应当使用x86_64-linux-gnu替代i386-linux-gnu

    $ cd /usr/include
    $ sudo ln -s i386-linux-gnu/bits bits
    $ sudo ln -s i386-linux-gnu/gnu gnu
    $ sudo ln -s i386-linux-gnu/sys sys
    $ sudo ln -s i386-linux-gnu/asm asm
    $ cd /usr/lib
    $ sudo ln -s i386-linux-gnu/crt1.o crt1.o
    $ sudo ln -s i386-linux-gnu/crti.o crti.o
    $ sudo ln -s i386-linux-gnu/crtn.o crtn.o 

    4. 编译gcc

    $ cd gcc-4.1.2
    $ mkdir build
    $ cd build
    $ ../configure --prefix=/usr/local --program-prefix=sse- --libexecdir=/usr/local/lib --enable-shared --enable-threads=posix --enable-__cxa_atexit --enable-clocale=gnu --disable-multilib --enable-languages=c,c++
    $ make bootstrap

    如果出现了如下错误:

    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 bootstrap MAKEINFO=makeinfo

    5. 安装gcc

    $ make install
    $ cd /usr/local/bin
    $ ll *gcc*

    看到类似以下几个文件, 安装就完成了

    i686-pc-linux-gnu-gcc-4.1.2 i686-pc-linux-gnu-ssegcc ssegcc ssegccbug

    参考文献: Building GCC 4.1.2 on Ubuntu 12.04.1 LTS

  • 相关阅读:
    T-SQL基础(1)
    shell命令--chage
    Oracle SQL Lesson (11)
    shell命令--chpasswd
    Oracle SQL Lesson (10)
    shell命令--passwd
    Oracle SQL Lesson (9)
    shell命令--usermod
    Spring中的工厂模式和单例模式
    Oracle SQL Lesson (8)
  • 原文地址:https://www.cnblogs.com/fengjl/p/5553029.html
Copyright © 2011-2022 走看看