zoukankan      html  css  js  c++  java
  • ubuntu 16.04 从gcc 5.4 安装gcc 5.3.0

    参考:

    https://www.cnblogs.com/damonxu/p/6434265.html

    http://blog.csdn.net/striker_v/article/details/51920627

    https://www.cnblogs.com/Norlan/p/5196920.html

    tips:

    如果不能科学上网,那么ftp是访问不了的,可以直接把ftp三个字母换成http,亲测有效。

    安装

    #su
    
    #cd /opt
    
    #wget http://ftp.gnu.org/gnu/gcc/gcc-5.3.0/gcc-5.3.0.tar.gz

     安装前置

    你的编译器告诉你还需要GMP啊,等等,就是说你需要前置的三个安装包。

    然后按照:

    https://www.cnblogs.com/damonxu/p/6434265.html

    的方法把ftp统统改成http进行安装。

    每安装完一个都要用

    make check

    看下安装情况

    5.4降到5.3的安装

    ../gcc-5.3.0/configure --enable-checking=release --enable-languages=c,c++ --disable-multilib --with-gmp=/usr/local/gmp-4.3.2 --with-mpfr=/usr/local/mpfr-2.4.2 --with-mpc=/usr/local/mpc-0.8.1

    这个前面的..请换成你的gcc解压包的路径,绝对的或者相对的都可以。

    错误锦集:

    就是之前说的,make check。安装gmp时,作者提示强烈建议运行sudo make check

    1. 检查下有没有错误。然后我就出现了如下错误。这句命令以上博客都没有提到。
    1 of 58 tests failed
    Please report to gmp-bugs@gmplib.org
    ====================================
    Makefile:1004: recipe for target 'check-TESTS' failed
    make[4]: *** [check-TESTS] Error 1
    make[4]: Leaving directory '/usr/local/gmp-4.3.2/tests/mpz'
    Makefile:1104: recipe for target 'check-am' failed
    make[3]: *** [check-am] Error 2
    make[3]: Leaving directory '/usr/local/gmp-4.3.2/tests/mpz'
    Makefile:505: recipe for target 'check-recursive' failed
    make[2]: *** [check-recursive] Error 1
    make[2]: Leaving directory '/usr/local/gmp-4.3.2/tests'
    Makefile:925: recipe for target 'check-recursive' failed
    make[1]: *** [check-recursive] Error 1
    make[1]: Leaving directory '/usr/local/gmp-4.3.2'
    Makefile:1183: recipe for target 'check' failed
    make: *** [check] Error 2

    相关错误只有这里:

    https://gmplib.org/list-archives/gmp-bugs/2013-November/003225.html

    找到了,鉴于还是安装上了,所以暂时不管。

    1. 之后全部走完该安装gcc了,在make 的时候出现了如下错误:
    checking for x86_64-unknown-linux-gnu-gcc... /usr/local/gcc-5.3.0/./gcc/xgcc -B/usr/local/gcc-5.3.0/./gcc/ -B/usr/local/x86_64-unknown-linux-gnu/bin/ -B/usr/local/x86_64-unknown-linux-gnu/lib/ -isystem /usr/local/x86_64-unknown-linux-gnu/include -isystem /usr/local/x86_64-unknown-linux-gnu/sys-include   
    checking for suffix of object files... configure: error: in `/usr/local/gcc-5.3.0/x86_64-unknown-linux-gnu/libgcc':
    configure: error: cannot compute suffix of object files: cannot compile
    See `config.log' for more details.
    Makefile:16229: recipe for target 'configure-stage1-target-libgcc' failed
    make[2]: *** [configure-stage1-target-libgcc] Error 1
    make[2]: Leaving directory '/usr/local/gcc-5.3.0'
    Makefile:20383: recipe for target 'stage1-bubble' failed
    make[1]: *** [stage1-bubble] Error 2
    make[1]: Leaving directory '/usr/local/gcc-5.3.0'
    Makefile:902: recipe for target 'all' failed
    make: *** [all] Error 2

    然后我检查了日志

    gcc: error: unrecognized command line option '-V'
    gcc: fatal error: no input files


    conftest.c:10:21: fatal error: isl/val.h: No such file or directory
    configure:4074: checking for gcc
    configure:4090: found /usr/bin/gcc
    configure:4101: result: gcc
    configure:4330: checking for C compiler version
    configure:4339: gcc --version >&5
    gcc (Ubuntu 5.4.0-6ubuntu1~16.04.9) 5.4.0 20160609
    Copyright (C) 2015 Free Software Foundation, Inc.
    This is free software; see the source for copying conditions.  There is NO
    warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
    
    configure:4350: $? = 0
    configure:4339: gcc -v >&5
    Using built-in specs.
    COLLECT_GCC=gcc
    COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/5/lto-wrapper
    Target: x86_64-linux-gnu
    Configured with: ../src/configure -v --with-pkgversion='Ubuntu 5.4.0-6ubuntu1~16.04.9' --with-bugurl=file:///usr/share/doc/gcc-5/README.Bugs --enable-languages=c,ada,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-5 --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-libmpx --enable-plugin --with-system-zlib --disable-browser-plugin --enable-java-awt=gtk --enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-5-amd64/jre --enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-5-amd64 --with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-5-amd64 --with-arch-directory=amd64 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --enable-objc-gc --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
    Thread model: posix
    gcc version 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.9) 
    configure:4350: $? = 0
    configure:4339: gcc -V >&5
    gcc: error: unrecognized command line option '-V'
    gcc: fatal error: no input files
    compilation terminated.
    configure:4350: $? = 1
    configure:4339: gcc -qversion >&5
    gcc: error: unrecognized command line option '-qversion'
    gcc: fatal error: no input files
    compilation terminated.
    configure:4350: $? = 1
    configure:4370: checking for C compiler default output file name
    configure:4392: gcc    conftest.c  >&5
    configure:4396: $? = 0
    configure:4433: result: a.out
    configure:4449: checking whether the C compiler works
    configure:4458: ./a.out
    configure:4462: $? = 0
    configure:4477: result: yes
    configure:4484: checking whether we are cross compiling
    configure:4486: result: no
    configure:4489: checking for suffix of executables
    configure:4496: gcc -o conftest    conftest.c  >&5
    configure:4500: $? = 0
    configure:4522: result: 
    configure:4528: checking for suffix of object files
    configure:4550: gcc -c   conftest.c >&5
    configure:4554: $? = 0
    configure:4575: result: o
    configure:4579: checking whether we are using the GNU C compiler
    configure:4598: gcc -c   conftest.c >&5
    configure:4598: $? = 0
    configure:4607: result: yes
    configure:4616: checking whether gcc accepts -g
    configure:4636: gcc -c -g  conftest.c >&5
    configure:4636: $? = 0
    configure:4677: result: yes
    configure:4694: checking for gcc option to accept ISO C89
    configure:4758: gcc  -c -g -O2  conftest.c >&5
    configure:4758: $? = 0
    configure:4771: result: none needed
    configure:4849: checking for g++
    configure:4865: found /usr/bin/g++
    configure:4876: result: g++
    configure:4903: checking for C++ compiler version
    configure:4912: g++ --version >&5
    g++ (Ubuntu 5.4.0-6ubuntu1~16.04.9) 5.4.0 20160609
    Copyright (C) 2015 Free Software Foundation, Inc.
    This is free software; see the source for copying conditions.  There is NO
    warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
    
    configure:4923: $? = 0
    configure:4912: g++ -v >&5
    Using built-in specs.
    COLLECT_GCC=g++
    COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/5/lto-wrapper
    Target: x86_64-linux-gnu
    Configured with: ../src/configure -v --with-pkgversion='Ubuntu 5.4.0-6ubuntu1~16.04.9' --with-bugurl=file:///usr/share/doc/gcc-5/README.Bugs --enable-languages=c,ada,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-5 --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-libmpx --enable-plugin --with-system-zlib --disable-browser-plugin --enable-java-awt=gtk --enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-5-amd64/jre --enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-5-amd64 --with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-5-amd64 --with-arch-directory=amd64 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --enable-objc-gc --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
    Thread model: posix
    gcc version 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.9) 
    configure:4923: $? = 0
    configure:4912: g++ -V >&5
    g++: error: unrecognized command line option '-V'
    g++: fatal error: no input files
    compilation terminated.
    configure:4923: $? = 1
    configure:4912: g++ -qversion >&5
    g++: error: unrecognized command line option '-qversion'
    g++: fatal error: no input files
    compilation terminated.

     对于安装到一半错了,我的办法是直接删除安装文件夹,然后看看差什么,重新开始

    • 首先,整了下路径:
      export LD_LIBRARY_PATH=/opt/gmp-5.0.1/lib:/opt/mpfr-3.1.4/lib/:/opt/mpc-1.0:$LD_LIBRARY_PATH

    • 然后看了下

    /usr/local/gcc-5.3/missing: 81: /usr/local/gcc-5.3/missing: makeinfo: not found
    checking for expect... no

    解决方法来自:https://stackoverflow.com/questions/338317/what-is-makeinfo-and-how-do-i-get-it

    之后再次生成makefile

    sudo apt-get install texinfo
    sudo /usr/local/gcc-5.3/configure --prefix=/usr/local/gcc-5.3/objdir --enable-languages=c,c++ --enable-threads=posix --disable-multilib --disable-nls --disable-bootstrap --with-gmp=/usr/local/gcc-5.3/gmp-4.3.2 --with-mpfr=/usr/local/gcc-5.3/mpfr-2.4.2 --with-mpc=/usr/local/gcc-5.3/mpc-0.8.1

    然后就没了

    • 再次运行 
    • sudo make

      再次出现了这个问题

    • checking for x86_64-unknown-linux-gnu-gcc... /usr/local/gcc-5.3.0/./gcc/xgcc -B/usr/local/gcc-5.3.0/./gcc/ -B/usr/local/gcc-5.3/objdir/x86_64-unknown-linux-gnu/bin/ -B/usr/local/gcc-5.3/objdir/x86_64-unknown-linux-gnu/lib/ -isystem /usr/local/gcc-5.3/objdir/x86_64-unknown-linux-gnu/include -isystem /usr/local/gcc-5.3/objdir/x86_64-unknown-linux-gnu/sys-include   
      checking for suffix of object files... configure: error: in `/usr/local/gcc-5.3.0/x86_64-unknown-linux-gnu/libgcc':
      configure: error: cannot compute suffix of object files: cannot compile
      See `config.log' for more details.
      Makefile:12662: recipe for target 'configure-target-libgcc' failed
      make[1]: *** [configure-target-libgcc] Error 1
      make[1]: Leaving directory '/usr/local/gcc-5.3.0'
      Makefile:875: recipe for target 'all' failed
      make: *** [all] Error 2

    Round 2

     

    export  LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/gcc-5.3/mpc-0.8.1/lib:/usr/local/gcc-5.3/gmp-4.3.2/lib:/usr/local/gcc-5.3/mpfr-2.4.2/lib/

     

    我再次更改了我路径的说法,一般情况下,找不到东西,都是应为路径问题。

     

     

    checking build system type... x86_64-unknown-linux-gnu
    checking host system type... x86_64-unknown-linux-gnu
    checking target system type... x86_64-unknown-linux-gnu
    checking for a BSD-compatible install... /usr/bin/install -c
    checking whether ln works... yes
    checking whether ln -s works... yes
    checking for a sed that does not truncate output... /bin/sed
    checking for gawk... no
    checking for mawk... mawk
    checking for libatomic support... yes
    checking for libcilkrts support... yes
    checking for libitm support... yes
    checking for libsanitizer support... yes
    checking for libvtv support... yes
    checking for gcc... gcc
    checking for C compiler default output file name... a.out
    checking whether the C compiler works... yes
    checking whether we are cross compiling... no
    checking for suffix of executables... 
    checking for suffix of object files... o
    checking whether we are using the GNU C compiler... yes
    checking whether gcc accepts -g... yes
    checking for gcc option to accept ISO C89... none needed
    checking for g++... g++
    checking whether we are using the GNU C++ compiler... yes
    checking whether g++ accepts -g... yes
    checking whether g++ accepts -static-libstdc++ -static-libgcc... yes
    checking for gnatbind... no
    checking for gnatmake... no
    checking whether compiler driver understands Ada... no
    checking how to compare bootstrapped objects... cmp --ignore-initial=16 $$f1 $$f2
    checking for objdir... .libs
    checking for the correct version of gmp.h... yes
    checking for the correct version of mpfr.h... yes
    checking for the correct version of mpc.h... yes
    checking for the correct version of the gmp/mpfr/mpc libraries... yes
    checking for compatible ISL... no
    *** This configuration is not supported in the following subdirectories:
         target-libmpx gnattools gotools target-libada target-libgfortran target-libgo target-libffi target-libbacktrace target-zlib target-libjava target-libobjc target-liboffloadmic target-boehm-gc
        (Any other directories should still work fine.)
    checking for default BUILD_CONFIG... 
    checking for --enable-vtable-verify... no
    checking for bison... no
    checking for byacc... no
    checking for yacc... no
    checking for bison... no
    checking for gm4... no
    checking for gnum4... no
    checking for m4... m4
    checking for flex... no
    checking for lex... no
    checking for flex... no
    checking for makeinfo... makeinfo
    checking for expect... no
    checking for runtest... no
    checking for ar... ar
    checking for as... as
    checking for dlltool... no
    checking for ld... ld
    checking for lipo... no
    checking for nm... nm
    checking for ranlib... ranlib
    checking for strip... strip
    checking for windres... no
    checking for windmc... no
    checking for objcopy... objcopy
    checking for objdump... objdump
    checking for readelf... readelf
    checking for cc... cc
    checking for c++... c++
    checking for gcc... gcc
    checking for gcj... no
    checking for gfortran... gfortran
    checking for gccgo... no
    checking for ar... no
    checking for ar... ar
    checking for as... no
    checking for as... as
    checking for dlltool... no
    checking for dlltool... no
    checking for ld... no
    checking for ld... ld
    checking for lipo... no
    checking for lipo... no
    checking for nm... no
    checking for nm... nm
    checking for objcopy... no
    checking for objcopy... objcopy
    checking for objdump... no
    checking for objdump... objdump
    checking for ranlib... no
    checking for ranlib... ranlib
    checking for readelf... no
    checking for readelf... readelf
    checking for strip... no
    checking for strip... strip
    checking for windres... no
    checking for windres... no
    checking for windmc... no
    checking for windmc... no
    checking where to find the target ar... host tool
    checking where to find the target as... host tool
    checking where to find the target cc... just compiled
    checking where to find the target c++... just compiled
    checking where to find the target c++ for libstdc++... just compiled
    checking where to find the target dlltool... host tool
    checking where to find the target gcc... just compiled
    checking where to find the target gcj... host tool
    checking where to find the target gfortran... host tool
    checking where to find the target gccgo... host tool
    checking where to find the target ld... host tool
    checking where to find the target lipo... host tool
    checking where to find the target nm... host tool
    checking where to find the target objcopy... host tool
    checking where to find the target objdump... host tool
    checking where to find the target ranlib... host tool
    checking where to find the target readelf... host tool
    checking where to find the target strip... host tool
    checking where to find the target windres... host tool
    checking where to find the target windmc... host tool
    checking whether to enable maintainer-specific portions of Makefiles... no
    configure: creating ./config.status
    config.status: creating Makefile

     

    还是出现了那个问题

    我决定鸽了。应该是版本问题,以前的版本比较顽固

     

    本博客专注于错误锦集,在作死的边缘试探
  • 相关阅读:
    libevent中的bufferevent原理
    libevent中的事件机制
    libevent中数据缓冲区buffer分析
    libevent中最小堆实现算法解析
    我眼中的WebViewJavascriptBridge(图解)
    Tinyhttpd精读解析
    app微信支付的集成步骤
    java工厂模式的测试
    java Annotation 注解的使用
    android 连接蓝牙打印机 BluetoothAdapter
  • 原文地址:https://www.cnblogs.com/SweetBeens/p/8605465.html
Copyright © 2011-2022 走看看