美文网首页
glibc 2.12 升级 2.14

glibc 2.12 升级 2.14

作者: Leebor | 来源:发表于2017-10-13 16:40 被阅读0次
    升级原因
    • 安装saltstack出现报错:
    Error: Package: PyYAML-3.11-1.el7.x86_64 (salt-latest)
               Requires: libc.so.6(GLIBC_2.14)(64bit)
    
    • 查看当前glibc版本:
    # rpm -qa | grep glibc
    glibc-headers-2.12-1.209.el6_9.2.x86_64
    glibc-common-2.12-1.209.el6_9.2.x86_64
    glibc-devel-2.12-1.209.el6_9.2.x86_64
    glibc-2.12-1.209.el6_9.2.x86_64
    
    • 查看当前系统中是否有libc.so.6模块以及支持glibc版本:
    # find / -name libc.so.6
    /lib64/libc.so.6
    
    # strings /lib64/libc.so.6 | grep GLIB
    GLIBC_2.2.5
    GLIBC_2.2.6
    GLIBC_2.3
    GLIBC_2.3.2
    GLIBC_2.3.3
    GLIBC_2.3.4
    GLIBC_2.4
    GLIBC_2.5
    GLIBC_2.6
    GLIBC_2.7
    GLIBC_2.8
    GLIBC_2.9
    GLIBC_2.10
    GLIBC_2.11
    GLIBC_2.12
    GLIBC_PRIVATE
    

    最高支持GLIBC_2.12

    升级glibc
    • 官网 选择合适版本下载glibc
    • 所需软件包
    We recommend installing the following GNU tools before attempting to
    build the GNU C Library:
    
       * GNU 'make' 3.79 or newer
       * GCC 4.9 or newer
       * GNU 'binutils' 2.25 or later
       * GNU 'texinfo' 4.7 or later
       * GNU 'awk' 3.1.2, or higher
       * Perl 5
       * GNU 'sed' 3.02 or newer
       * GNU 'autoconf' 2.69 (exactly)
       * GNU 'gettext' 0.10.36 or later
       * GNU 'bison' 2.7 or later
    

    一般CentOS6自带的gcc都是4.4上下,如果需要更新到4.9及一上,可以查看《gcc 4.4.7 升级到4.9》

    • 编译安装
    1. 创建编译目录
    # mkdir -p Gcc/{gcc-src,gcc-obj}
    gcc-src为源码文件路径,gcc-obj为编译路径
    # cd Gcc/gcc-obj
    # ../gcc-src/configure --prefix=/usr
    checking build system type... x86_64-pc-linux-gnu
    checking host system type... x86_64-pc-linux-gnu
    checking target system type... x86_64-pc-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... gawk
    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 libmpx support... yes
    checking for libhsail-rt 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... no
    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
    configure: WARNING: using in-tree isl, disabling version check
    The following languages will be built: c,c++,fortran,lto,objc
    *** This configuration is not supported in the following subdirectories:
         gnattools gotools target-libada target-libhsail-rt target-libgo target-libffi target-liboffloadmic
        (Any other directories should still work fine.)
    checking for default BUILD_CONFIG... 
    checking for --enable-vtable-verify... no
    /usr/bin/ld: cannot find crti.o: No such file or directory
    /usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-redhat-linux/4.4.7/libgcc_s.so when searching for -lgcc_s
    /usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-redhat-linux/4.4.7/libgcc_s.so when searching for -lgcc_s
    /usr/bin/ld: cannot find -lgcc_s
    /usr/bin/ld: cannot find -lc
    /usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-redhat-linux/4.4.7/libgcc_s.so when searching for -lgcc_s
    /usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-redhat-linux/4.4.7/libgcc_s.so when searching for -lgcc_s
    /usr/bin/ld: cannot find -lgcc_s
    /usr/bin/ld: cannot find crtn.o: No such file or directory
    collect2: ld returned 1 exit status
    configure: error: I suspect your system does not have 32-bit development libraries (libc and headers). If you have them, rerun configure with --enable-multilib. If you do not have them, and want to build a 64-bit-only compiler, rerun configure with --disable-multilib.
    

    如果出现上面报错,可能由于没有装32bit lib库,添加--disable-multilib参数即可解决:

    # ../gcc-src/configure --prefix=/usr  ***--disable-multilib*** 
    

    或者安装:

    # yum install -y libgcc.i686 libgcc-devel.i686
    
    • 安装
    # make 
    # make install
    
    - 其他报错
    configure: error: `GMPLIBS' has changed since the previous run:
    

    之前有编译过gcc,但是没有编译成功,解决办法:

    删除gcc-obj目录,重新编译

    相关文章

      网友评论

          本文标题:glibc 2.12 升级 2.14

          本文链接:https://www.haomeiwen.com/subject/vuuzyxtx.html