From 5d0a8a5344f254703a8d628ba3b643aa11124d42 Mon Sep 17 00:00:00 2001 From: John Mulligan Date: Tue, 1 Nov 2022 14:58:16 -0400 Subject: [PATCH] script: add gcc-toolset-11 support to discover_compiler 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 (cherry picked from commit 435d4c75386b0b58b33e3e2024983c608b46249c) --- src/script/lib-build.sh | 9 +++++++++ src/script/run-make.sh | 4 ++++ 2 files changed, 13 insertions(+) diff --git a/src/script/lib-build.sh b/src/script/lib-build.sh index c6ce94b633ad7..6c4455344379d 100644 --- a/src/script/lib-build.sh +++ b/src/script/lib-build.sh @@ -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}" diff --git a/src/script/run-make.sh b/src/script/run-make.sh index 8e04e6fc8a46f..431f2001b388f 100755 --- a/src/script/run-make.sh +++ b/src/script/run-make.sh @@ -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 -- 2.39.5