最新版本的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 非常重要