# FPM - failing at the first hurdle

**URL:** <https://fortran-lang.discourse.group/t/fpm-failing-at-the-first-hurdle/10968>\
**Category:** Uncategorized\
**Created:** [June 15, 2026, 10:18am UTC](https://fortran-lang.discourse.group/t/fpm-failing-at-the-first-hurdle/10968 "2026-06-15T10:18:56Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![HighPerformanceMark](https://avatars.discourse-cdn.com/v4/letter/h/c37758/32.png) [@HighPerformanceMark](https://fortran-lang.discourse.group/u/HighPerformanceMark)\
**Post date:** [June 15, 2026, 10:18am UTC](https://fortran-lang.discourse.group/t/fpm-failing-at-the-first-hurdle/10968/1 "2026-06-15T10:18:56Z")

</div>

I finally got round to moving away from Make and towards FPM. So I ran

`port install fpm`

(Yes, I use MacPorts)

carried on following the instructions and executed

`fpm new first_steps`

then

`fpm run`

to which my Mac replied

> first\_steps.f90 compiling…  
> [0%] Compiling…:failed command gfortran -c ././src/first\_steps.f90 -Wall -Wextra -fPIC -fmax-errors=1 -g -fcheck=bounds -fcheck=array-temps -fbacktrace -fcoarray=single -fimplicit-none -Werror=implicit-interface -ffree-form -J build/gfortran\_87E2AE0597D39913 -Ibuild/gfortran\_87E2AE0597D39913 -o build/gfortran\_87E2AE0597D39913/first\_steps/src\_first\_steps.f90.o\>build/gfortran\_87E2AE0597D39913/first\_steps/src\_first\_steps.f90.o.log 2\>&1  
> _run_:Invalid command line  
> STOP 1

Which prompted the question - where did all those options for gfortran come from? I can’t find them anywhere in the fpm configuration files.

Oh, yeah, the other question, what went wrong, well I can probably sort that out myself when I figure out a bit more about how fpm is going about its business. And yes, I have pored over the documentation.

Thanks for any help offered.

---

<div class="post-metadata">

**Author:** ![davidpfister](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/davidpfister/32/3949_2.png) [@davidpfister](https://fortran-lang.discourse.group/u/davidpfister)\
**Post date:** [June 15, 2026, 11:48am UTC](https://fortran-lang.discourse.group/t/fpm-failing-at-the-first-hurdle/10968/2 "2026-06-15T11:48:26Z")

</div>

I guess you have to look into the source code to understand where the flags are coming from. Fpm is coming with two different hard-coded profiles: ‘release’ and ‘debug’.

The flags are found in the [fpm\_compiler.f90](https://github.com/fortran-lang/fpm/blob/eaffbb36086abdb16c0d052961a3e7240cb22b0a/src/fpm_compiler.F90#L328) file. If you want to use you own profile and overwrite the default configuration, you can define a profile in the toml file, see the [doc](https://fpm.fortran-lang.org/spec/features.html).

```auto
name = "my-package"
version = "1.0.0"

[features]
# Release feature with optimization
optim.flags = "-O3"
optim.gfortran.flags = "-funroll-loops"
optim.ifort.flags = "-unroll"
optim.preprocess.cpp.macros = ["NDEBUG"]

[profiles]
optim = ["optim"]

```

Like this, you can create the profile you want and use it as: fpm run --profile optim

---

<div class="post-metadata">

**Author:** ![FedericoPerini](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/federicoperini/32/1750_2.png) [@FedericoPerini](https://fortran-lang.discourse.group/u/FedericoPerini)\
**Post date:** [June 15, 2026, 1:54pm UTC](https://fortran-lang.discourse.group/t/fpm-failing-at-the-first-hurdle/10968/3 "2026-06-15T13:54:45Z")

</div>

The message is genuinely misleading and it should be fixed imho. what’s `gfortran` named like on MacPorts? it would look like something like this should work:

```sh
fpm run --compiler gfortran-mp-15

```

or with the env variable:

```sh
export FPM_FC=gfortran-mp-15

```

---

<div class="post-metadata">

**Author:** ![HighPerformanceMark](https://avatars.discourse-cdn.com/v4/letter/h/c37758/32.png) [@HighPerformanceMark](https://fortran-lang.discourse.group/u/HighPerformanceMark)\
**Post date:** [June 16, 2026, 6:11am UTC](https://fortran-lang.discourse.group/t/fpm-failing-at-the-first-hurdle/10968/4 "2026-06-16T06:11:03Z")

</div>

> [@FedericoPerini](#):
>
> `fpm run --compiler gfortran-mp-15`

Thanks Federico

That solved the problem. I do have `gfortran` aliased to point to `gfortran-mp-15` but I guess that fpm is using it’s own ways to find the compiler.

Mark

---

<div class="post-metadata">

**Author:** ![HighPerformanceMark](https://avatars.discourse-cdn.com/v4/letter/h/c37758/32.png) [@HighPerformanceMark](https://fortran-lang.discourse.group/u/HighPerformanceMark)\
**Post date:** [June 16, 2026, 6:15am UTC](https://fortran-lang.discourse.group/t/fpm-failing-at-the-first-hurdle/10968/5 "2026-06-16T06:15:28Z")

</div>

Well, I did think, as I tried to figure this out “Maybe the compiler options are hard-coded into the fpm sources?” and then I thought …

… that would be a really odd design decision, surely not?

Thanks for the input

Mark

---

<div class="post-metadata">

**Author:** ![Machalot](https://avatars.discourse-cdn.com/v4/letter/m/ebca7d/32.png) [@Machalot](https://fortran-lang.discourse.group/u/Machalot)\
**Post date:** [June 16, 2026, 4:39pm UTC](https://fortran-lang.discourse.group/t/fpm-failing-at-the-first-hurdle/10968/6 "2026-06-16T16:39:58Z")

</div>

> [@HighPerformanceMark](#):
>
> Well, I did think, as I tried to figure this out “Maybe the compiler options are hard-coded into the fpm sources?” and then I thought …
> 
> … that would be a really odd design decision, surely not?

It does make one wonder why the default options are not exposed in a configuration file. I’ve never developed software like this so I am not here to second guess, but I’m curious.

---

<div class="post-metadata">

**Author:** ![FedericoPerini](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/federicoperini/32/1750_2.png) [@FedericoPerini](https://fortran-lang.discourse.group/u/FedericoPerini)\
**Post date:** [June 16, 2026, 7:31pm UTC](https://fortran-lang.discourse.group/t/fpm-failing-at-the-first-hurdle/10968/7 "2026-06-16T19:31:32Z")

</div>

Fully customizable and named sets of flags are now possible via features / profiles since v0.13.0

> **[Features and Profiles — Fortran Package Manager](https://fpm.fortran-lang.org/spec/features.html?highlight=profiles)**

I’ll be the first to admit the original design has some friction re compiler/os/customization support: the default flags were effectively baked in, which is exactly the issue you’re running into. That’s part of why I pushed the features/profiles work into 0.13.0: it’s a substantial improvement and should give you the configurability you’re after.

For the historical context behind the original choices, you can look up the repository issues section, e.g.:

> <https://github.com/fortran-lang/fpm/issues/50>
>
> How should we organize/specify compiler flags?
> 
> Should we only have two sets o…f compiler flags? \`devel-options\` and \`release-options\`, and they are used to build all dependencies and executables?
> 
> Also, should we come up with our own keywords for specifying the compiler options, and have a look up table to determine the correct flag for each compiler?
