glibc 2.12 升級 2.14

升級原因
  • 安裝saltstack出現(xiàn)報錯:
Error: Package: PyYAML-3.11-1.el7.x86_64 (salt-latest)
           Requires: libc.so.6(GLIBC_2.14)(64bit)
  • 查看當(dāng)前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
  • 查看當(dāng)前系統(tǒng)中是否有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
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. 創(chuàng)建編譯目錄
# 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.

如果出現(xiàn)上面報錯,可能由于沒有裝32bit lib庫,添加--disable-multilib參數(shù)即可解決:

# ../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目錄,重新編譯

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容