From bd73f15393c8f56e668eac5449cb15381e0441a1 Mon Sep 17 00:00:00 2001 From: Hugh Carson Date: Fri, 20 Dec 2024 14:29:15 +0000 Subject: [PATCH] Use update-alternatives to set gcc version before all building --- .github/workflows/build-and-test-linux.yml | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build-and-test-linux.yml b/.github/workflows/build-and-test-linux.yml index e065c82d6..051462a48 100644 --- a/.github/workflows/build-and-test-linux.yml +++ b/.github/workflows/build-and-test-linux.yml @@ -93,7 +93,12 @@ jobs: - uses: actions/checkout@v4 with: submodules: 'recursive' - + - name: Set gcc to gcc-12 + if: matrix.configurations.os == "ubuntu-latest" + run: | + sudo update-alternatives --set $(which gcc) gcc $(which gcc-12) + --slave $(which g++) g++ $(which g++-12) --slave $(which gfortran) gfortran + $(which gfortran-12) - name: Configure Open MPI if: matrix.mpi == 'openmpi' run: | @@ -160,12 +165,12 @@ jobs: elif [[ "${{ matrix.compiler }}" == 'clang' ]]; then export CC=clang export CXX=clang++ - export FC=gfortran-12 + export FC=gfortran export LDFLAGS='-fuse-ld=lld' elif [[ "${{ matrix.compiler }}" == 'gcc' ]]; then - export CC=gcc-12 - export CXX=g++-12 - export FC=gfortran-12 + export CC=gcc + export CXX=g++ + export FC=gfortran fi if [[ "${{ matrix.math-libs }}" == 'aocl' ]]; then export AOCLROOT=/opt/AMD/aocl/aocl-linux-gcc-4.1.0/gcc