From: Matan Breizman Date: Wed, 31 Aug 2022 18:02:18 +0000 (+0000) Subject: examples: Compile with c++20 X-Git-Tag: v18.1.0~1141^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F47900%2Fhead;p=ceph.git examples: Compile with c++20 This change will apply to ubuntu only. Fixes: https://tracker.ceph.com/issues/57163 Signed-off-by: Matan Breizman --- diff --git a/examples/librados/Makefile b/examples/librados/Makefile index fd61cb998032..a97d640eb1f5 100644 --- a/examples/librados/Makefile +++ b/examples/librados/Makefile @@ -1,6 +1,6 @@ CXX?=g++ -CXX_FLAGS?=-std=c++11 -Wno-unused-parameter -Wall -Wextra -Werror -g +CXX_FLAGS+=-Wno-unused-parameter -Wall -Wextra -Werror -g CXX_LIBS?=-lrados -lradosstriper CXX_INC?=$(LOCAL_LIBRADOS_INC) CXX_CC=$(CXX) $(CXX_FLAGS) $(CXX_INC) $(LOCAL_LIBRADOS) diff --git a/qa/workunits/ceph-helpers-root.sh b/qa/workunits/ceph-helpers-root.sh index f4557aec4589..5b5d2b409ee5 100755 --- a/qa/workunits/ceph-helpers-root.sh +++ b/qa/workunits/ceph-helpers-root.sh @@ -28,9 +28,21 @@ function distro_version() { } function install() { + if [ $(distro_id) = "ubuntu" ]; then + sudo apt-get purge -y gcc + sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test + fi for package in "$@" ; do install_one $package done + if [ $(distro_id) = "ubuntu" ]; then + sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-11 11 + sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-11 11 + sudo update-alternatives --install /usr/bin/cc cc /usr/bin/gcc 11 + sudo update-alternatives --set cc /usr/bin/gcc + sudo update-alternatives --install /usr/bin/c++ c++ /usr/bin/g++ 11 + sudo update-alternatives --set c++ /usr/bin/g++ + fi } function install_one() { diff --git a/qa/workunits/rados/test_librados_build.sh b/qa/workunits/rados/test_librados_build.sh index 75f1748cf429..3463c47dcdbd 100755 --- a/qa/workunits/rados/test_librados_build.sh +++ b/qa/workunits/rados/test_librados_build.sh @@ -71,7 +71,10 @@ pushd $DESTDIR case $(distro_id) in centos|fedora|rhel|opensuse*|suse|sles) install gcc-c++ make libradospp-devel librados-devel;; - ubuntu|debian|devuan|softiron) + ubuntu) + install gcc-11 g++-11 make libradospp-dev librados-dev + export CXX_FLAGS="-std=c++20";; + debian|devuan|softiron) install g++ make libradospp-dev librados-dev;; *) echo "$(distro_id) is unknown, $@ will have to be installed manually."