1. 程式人生 > >CentOS7 安裝gcc 7.2 (為了編譯最新版ceph)

CentOS7 安裝gcc 7.2 (為了編譯最新版ceph)

最新版本的ceph已經使用了c++14新特性,CentOS7中的gcc版本太低,所以需要手動安裝新版本的gcc。

本文給出了一個可以正確編譯ceph的gcc配置,供大家參考。

  $ wget https://ftp.gnu.org/gnu/gcc/gcc-7.2.0/gcc-7.2.0.tar.xz                                                     
  $ tar -Jxf gcc-7.2.0.tar.xz
  $ cd gcc-7.2.0
  # ./contrib/download_prerequisites
  # cd ..
  # mkdir objdir
  # cd objdir
  # $PWD/../gcc-7.2.0/configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-bootstrap --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --with-linker-hash-style=gnu --enable-languages=c,c++,go --enable-plugin --enable-initfini-array --disable-libgcj --enable-gnu-indirect-function --with-tune=generic --with-arch_32=x86-64 --build=x86_64-redhat-linux --disable-multilib --with-default-libstdcxx-abi=gcc4-compatible --with-abi=m64 --enable-offload-targets=nvptx-none --without-cuda-driver --enable-checking=release  --with-target-system-zlib --enable-objc-gc=auto  --enable-gnu-unique-object --disable-vtable-verify --enable-libmpx --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-nls --without-included-gettext
  # yum install gcc-gnat.x86_64
  # make -j16 > log 2>&1 &
  # make install 

其中 --with-default-libstdcxx-abi=gcc4-compatible 非常重要