]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
script: add gcc-toolset-11 support to discover_compiler
authorJohn Mulligan <jmulligan@redhat.com>
Tue, 1 Nov 2022 18:58:16 +0000 (14:58 -0400)
committerJohn Mulligan <jmulligan@redhat.com>
Tue, 18 Feb 2025 22:58:08 +0000 (17:58 -0500)
In order to configure, build, and run tests in a CentOS 8 (or similar)
container we need a functioning gcc-toolset compiler. This relies on
the environment script being sourced as well. cmake does not appear
to be able to discover this compiler own its own.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
(cherry picked from commit 435d4c75386b0b58b33e3e2024983c608b46249c)

src/script/lib-build.sh
src/script/run-make.sh

index c6ce94b633ad7c0ea1df3bad8aba1f25d30cfecb..6c4455344379d373774ddbda1400dd16fb9eb0a2 100644 (file)
@@ -71,6 +71,15 @@ function discover_compiler() {
             break
         fi
     done
+    # but if this is {centos,rhel} we need gcc-toolset
+    if [ -f "/opt/rh/gcc-toolset-11/enable" ]; then
+        ci_debug "Detected SCL gcc-toolset-11 environment file"
+        compiler_env="/opt/rh/gcc-toolset-11/enable"
+        # shellcheck disable=SC1090
+        cxx_compiler="$(. ${compiler_env} && command -v g++)"
+        # shellcheck disable=SC1090
+        c_compiler="$(. ${compiler_env} && command -v gcc)"
+    fi
 
     export discovered_c_compiler="${c_compiler}"
     export discovered_cxx_compiler="${cxx_compiler}"
index 8e04e6fc8a46fef9e37a48dc4275ea95addfef6f..431f2001b388f0bbb6ebafaa52917f08b2d9759d 100755 (executable)
@@ -92,6 +92,10 @@ EOM
     if ! discover_compiler ci-build ; then
         ci_debug "Failed to discover a compiler"
     fi
+    if [ "${discovered_compiler_env}" ]; then
+        ci_debug "Enabling compiler environment file: ${discovered_compiler_env}"
+        . "${discovered_compiler_env}"
+    fi
     local cxx_compiler="${discovered_cxx_compiler}"
     local c_compiler="${discovered_c_compiler}"
     local cmake_opts