MetOffice / MetOffice/ngmo-environments

Incorrect compiler env variables if different compiler versions are installed

Open
#9 4 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
12
Forks
8
PR merge metrics
No merged PRs in 30d

Description

My wsl system had gcc-9 (only, no gfortran), and a full gcc-11* installed. The environmet created the following env variables:
```
CC=$'/usr/bin/gcc-9\n/usr/bin/gcc'
OMPI_CC=$'/usr/bin/gcc-9\n/usr/bin/gcc'
FC=$'None\n/usr/bin/gfortran'
OMPI_FC=$'None\n/usr/bin/gfortran'
```
Reason is the following output of `spack compiler info`:
```
RUN spack compiler info gcc
gcc@9.5.0:
paths:
cc = /usr/bin/gcc-9
cxx = None
f77 = None
fc = None
modules = []
operating system = ubuntu22.04
gcc@11.4.0:
paths:
cc = /usr/bin/gcc
cxx = /usr/bin/g++
f77 = /usr/bin/gfortran
fc = /usr/bin/gfortran
modules = []
operating system = ubuntu22.04

```

I have a branch that fixes it, once I have confirmed (by rebuilding I'd guess :( ) that it works, I'll do a PR.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by running `spack compiler info gcc` in an environment with multiple GCC versions and inspect how compiler paths become environment variables. Compare the generated CC, OMPI_CC, FC, and OMPI_FC values with the compiler records, then rebuild the environment to confirm the branch's fix produces valid paths.

Written by the indexing model from the issue text.

Assessment

Tech stack
c, fortran, python
Domain
build-system
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.