Skip to content

BLD: fortran: only use -std=legacy for gfortran#21917

Merged
tylerjereddy merged 1 commit intoscipy:mainfrom
rgommers:fix-fortranstd-legacy
Nov 22, 2024
Merged

BLD: fortran: only use -std=legacy for gfortran#21917
tylerjereddy merged 1 commit intoscipy:mainfrom
rgommers:fix-fortranstd-legacy

Conversation

@rgommers
Copy link
Copy Markdown
Member

Support in other compilers for this flag is quite patchy, leading to build errors and requiring workarounds in distros - see for example:

Compilers that do not support it include at least Flang and AOCC (the AMD Fortran compiler).

This should be fixed upstream in Meson by not passing the flag for compilers that don't support it, and then we can revert this change. But for now it's very useful to avoid bothering users of these compilers with having to override that flag manually.

This does give the following warning with gfortran now, but that can't be helped unfortunately:

WARNING: Consider using the built-in option for language standard version instead of using "-std=legacy".

Support in other compilers for this flag is quite patchy, leading
to build errors and requiring workarounds in distros - see for example:

- scipy#19447
- mesonbuild/meson#12306
- https://github.com/conda-forge/scipy-feedstock/blob/1a8ff378bebd3f0b0bc6a2d1662a77d194ac59a1/recipe/bld.bat#L25
- https://github.com/spack/spack/blob/73316c3e286d548b22dc65667810e4631479c3ea/var/spack/repos/builtin/packages/py-scipy/package.py#L235-L238

Compilers that do not support it include at least Flang and AOCC (the
AMD Fortran compiler).

This should be fixed upstream in Meson by not passing the flag for
compilers that don't support it, and then we can revert this change.
But for now it's very useful to avoid bothering users of these compilers
with having to override that flag manually.

This does give the following warning with `gfortran` now, but that can't
be helped unfortunately:
```
WARNING: Consider using the built-in option for language standard version instead of using "-std=legacy".
```
@rgommers rgommers added Build issues Issues with building from source, including different choices of architecture, compilers and OS Meson Items related to the introduction of Meson as the new build system for SciPy labels Nov 20, 2024
@rgommers rgommers added this to the 1.15.0 milestone Nov 20, 2024
Copy link
Copy Markdown
Contributor

@tylerjereddy tylerjereddy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I verified that the main branch of SciPy fails to build on a DOE supercomputer with AMD clang version 16.0.3 (CLANG: AOCC_4.1.0-Build#270 2023_07_10) because of the Fortran flag removed here.

I checked that a clean build succeeds in the same environment on this feature branch.

I did see quite a few build warnings and testing issues with AOCC (errors like libstdc++.so.6: version GLIBCXX_3.4.30' not found` from testsuite). The latter is usually some environment setup issue.. I rarely use that compiler toolchain. In any case, I at least confirmed an improved situation with changes in this feature branch.

Using PrgEnv-aocc/8.5.0 and

export CXX=clang++
export CC=clang
export FC=flang

The spammed warnings were of this nature:

[1321/1462] Compiling Fortran object scipy/interpolate/libfitpack_lib.a.p/fitpack_fpcurf.f.o
clang-16: warning: argument unused during compilation: '-MD' [-Wunused-command-line-argument]
clang-16: warning: argument unused during compilation: '-MQ scipy/interpolate/libfitpack_lib.a.p/fitpack_fpcurf.f.o' [-Wunused-command-line-argument]
clang-16: warning: argument unused during compilation: '-MF scipy/interpolate/libfitpack_lib.a.p/fitpack_fpcurf.f.o.d' [-Wunused-command-line-argument]

@tylerjereddy
Copy link
Copy Markdown
Contributor

CI fail in benchmarks almost certainly not related.

@tylerjereddy tylerjereddy merged commit 26696e2 into scipy:main Nov 22, 2024
@tylerjereddy
Copy link
Copy Markdown
Contributor

thanks Ralf

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Build issues Issues with building from source, including different choices of architecture, compilers and OS Meson Items related to the introduction of Meson as the new build system for SciPy

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants