Skip to content

Commit e1ec0ae

Browse files
authored
test(macos-13): use/suggest linker option for gcc7-9 (#40)
1 parent 2bc384c commit e1ec0ae

File tree

2 files changed

+16
-3
lines changed

2 files changed

+16
-3
lines changed

.github/workflows/test.yml

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ jobs:
3636
- {compiler: gcc, version: 8}
3737
- {compiler: gcc, version: 7}
3838
- {compiler: gcc, version: 6}
39-
# {compiler: gcc, version: 5}
4039
include:
4140
- {os: ubuntu-20.04, toolchain: {compiler: intel, version: '2023.2'}}
4241
- {os: ubuntu-20.04, toolchain: {compiler: intel, version: '2022.2.1'}}
@@ -146,7 +145,19 @@ jobs:
146145
FC: ${{ steps.setup-fortran.outputs.fc }}
147146
CC: ${{ steps.setup-fortran.outputs.cc }}
148147
run: |
149-
${{ env.FC }} -o hw hw.f90
148+
# macos-13 / gcc 7-9 compatibility workaround
149+
args=""
150+
if [ "$RUNNER_OS" == "macOS" ]; then
151+
if [[ $(sw_vers -productVersion) == 13* ]] && \
152+
[[ ${{ matrix.toolchain.compiler }} == "gcc" ]] && \
153+
[[ ${{ matrix.toolchain.version }} =~ ^(7|8|9)$ ]]
154+
then
155+
args="-L/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib"
156+
fi
157+
fi
158+
args="$args -o hw hw.f90"
159+
160+
${{ env.FC }} $args
150161
output=$(./hw '2>&1')
151162
[[ "$output" == *"hello world"* ]] && echo "$output" || (echo "Unexpected output: $output"; exit 1)
152163

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,8 @@ Support for the GCC toolchain varies across GitHub-hosted runner images.
9898

9999
**Note:** version 13 of the GNU toolchain is not yet available on Windows.
100100

101+
**Note:** on `macos-13`, gcc 7-9 require flag `-L/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib`.
102+
101103
Supported Intel toolchains:
102104

103105
| runner | compiler | version |
@@ -108,7 +110,7 @@ Supported Intel toolchains:
108110
| windows-\* | intel | 2023.2, 2023.1, 2023.0, 2022.2.0, 2022.1.0 |
109111
| windows-\* | intel-classic | 2021.10.0, 2021.9.0, 2021.8.0, 2021.7.0, 2021.6.0 |
110112

111-
**Note:** on macOS the `intel`/`ifx` compiler option is not supported, only `intel-classic` with the `ifort` compiler.
113+
**Note:** on macOS `ifx` is not supported, so the `intel` option redirects to `intel-classic` (`ifort`).
112114

113115
## License
114116

0 commit comments

Comments
 (0)