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 59c0192
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions .github/workflows/build-and-test-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -93,12 +93,16 @@ 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: |
sudo apt-get install -y openmpi-bin libopenmpi-dev
- name: Configure MPICH
if: matrix.mpi == 'mpich'
run: |
Expand Down Expand Up @@ -160,12 +164,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 59c0192

Please sign in to comment.