Skip to content

Commit

Permalink
Use update-alternatives to set gcc version before all building
Browse files Browse the repository at this point in the history
  • Loading branch information
hughcars committed Dec 20, 2024
1 parent 73c649b commit bd73f15
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions .github/workflows/build-and-test-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit bd73f15

Please sign in to comment.