Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Creating compiler toolchains #638

Open
awvwgk opened this issue Dec 19, 2021 · 1 comment
Open

Creating compiler toolchains #638

awvwgk opened this issue Dec 19, 2021 · 1 comment

Comments

@awvwgk
Copy link
Member

awvwgk commented Dec 19, 2021

We currently detect our compiler toolchain by identifying it from the Fortran compiler, with the default being gfortran. This is somewhat suboptimal since it doesn't account for the C compiler and because changes in the PATH are not correctly considered in our toolchain.

Here is a proposal for creating an fpm compiler command inspired by spack compiler:

  • allow to find installed compilers by searching the PATH for standard names (done automatically on first invocation)
  • inspection/modification of existing compiler toolchains possible (checksum?)
  • available toolchains are user settings in ~/.config/fpm/toolchain/*.toml or ~/.config/fpm/toolchain.toml (individual files might be easier to share/reuse)
  • specify the default toolchain in ~/.config/fpm/config.toml
  • the commands for --compiler, --c-compiler, ... are passed to fpm compiler internally (create new toolchain on demand)
  • toolchain name is used to prefix build output directory (maybe include a digest/slug?)
  • possibility to perform an integrity check of toolchain (in case of system upgrade, ...)
@ivan-pi
Copy link
Member

ivan-pi commented Jan 3, 2022

The Rust cc crate also has a cc::Tool class. The biggest difference is the compiler is configured via the build.rs build script. It makes sense that Fortran compiler integration must be closer (configuration is passed internally).

In general I like the proposal. Given the multitude of Fortran compilers, a good separation layer would be useful. In the spack compiler command, I see one can embed flags directly in the compiler configuration file. How would those interact with the compiler flag profiles (#498) in the user project manifest?

A second question is what if fpm were to be used as a spack build system in the future. Would the spack configurations be translated to fpm configurations (or vice-versa)?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants