]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
examples: Compile with c++20 47900/head
authorMatan Breizman <mbreizma@redhat.com>
Wed, 31 Aug 2022 18:02:18 +0000 (18:02 +0000)
committerMatan Breizman <mbreizma@redhat.com>
Mon, 19 Sep 2022 13:18:20 +0000 (13:18 +0000)
This change will apply to ubuntu only.
Fixes: https://tracker.ceph.com/issues/57163
Signed-off-by: Matan Breizman <mbreizma@redhat.com>
examples/librados/Makefile
qa/workunits/ceph-helpers-root.sh
qa/workunits/rados/test_librados_build.sh

index fd61cb99803208c740c4616acd6b35f4fd74a80c..a97d640eb1f502ea76eca901f5e79d13293fea7a 100644 (file)
@@ -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)
index f4557aec4589c4255ae6c8748eb852ddc3ef5758..5b5d2b409ee565be2b4b3114f37ed88f552baa3a 100755 (executable)
@@ -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() {
index 75f1748cf429da3dad6ddc0dafba53188c2bf25e..3463c47dcdbd53c6ed38a42dee64c295fd2e5029 100755 (executable)
@@ -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."