Fpm version 0.7.0 released

We have just release version 0.7.0 of fpm!

New main features include:

  • C preprocessor support in the manifest fpm.toml
  • Compilation of C++ sources
  • and other minor bug fixes

For a more detailed description check out the Release Notes


With fpm coming to 0.7.0, do we have some clear short-term goals to do?

I’m very much looking forward to dependencies being stored locally via toml/json so that we only need to parse files that are changed.

1 Like

fpm 0.7.0 has just arrived in MSYS2:


fpm 0.7.0 has been imported into OpenBSD ports tree: ports/devel/fpm/


I’ve tried to follow Homebrew way of installing as instructed on the fpm page but it failed. First, the version “poured” from the awvwgk/fpm tap is 0.5.0. Second, it does not work, seemingly unable to find libgfortran.5.dylib which is present, as part of gfortran-12 suite but not in places that fpm is searching

dyld[22790]: Library not loaded: ‘/usr/local/opt/gcc/lib/gcc/11/libgfortran.5.dylib’
Referenced from: ‘/usr/local/Cellar/fpm/0.5.0/bin/fpm’
Reason: tried: ‘/usr/local/opt/gcc/lib/gcc/11/libgfortran.5.dylib’ (no such file), ‘/usr/local/lib/libgfortran.5.dylib’ (no such file), ‘/usr/lib/libgfortran.5.dylib’ (no such file)

The binary for MacOS is no better:

dyld[23036]: Library not loaded: ‘/usr/local/opt/gcc@9/lib/gcc/9/libgfortran.5.dylib’
Referenced from: ‘/Users/msz/Downloads/fpm-0.7.0-macos-x86_64’
Reason: tried: ‘/usr/local/opt/gcc@9/lib/gcc/9/libgfortran.5.dylib’ (no such file), ‘/usr/local/lib/libgfortran.5.dylib’ (no such file), ‘/usr/lib/libgfortran.5.dylib’ (no such file)

Finally, I downloaded the source and ran install.sh. This has worked although I was a bit confused to find
line in the install.sh script
The source-compiled fpm reports version 0.7.0 alpha which is a bit discouraging. On the WWW page, it is tagged as “Latest” but the next-older release, 0.6.0, is not tagged as “Stable”. So which one should I use?

Added: Sorry for a stupid question but the tutorial says only about creating a new project. Is fpm capable of building a project basing just on its fpm.toml file? I tried to build pyplot-fortran that way but I got just “Project is up to date”. Only when I downloaded full source drom Github, I was able to build it. I thought fpm is sort of apm/yum/brew app, capable of downloading the source based on a single configuration file.

msz59: it looks like recent fpm doesn’t build dependencies if your program `app\main.f90’ doesn’t use them. Very nice feature.

1 Like

I don’t think I can help much with the brew tap issue, since I don’t have access to a Mac anymore.
Same goes for the GitHub release artifact. The only thing I would add is that the release binary is only for Intel MacOS not the newer ARM based chips.

The install.sh script does more than simply download version 0.6.0 of fpm. It then uses fpm to update dependencies and build itself from source, hence the version being 0.7.0 is correct.

“Latest” is a GitHub assignment to indicate the latest release, that’s useful for a number of reasons. Also we don’t tag our releases as “Stable”, they are all meant to be stable.

fpm will only recompile if there are changes to your project, very similar to other build tools. If there are no changes, then there is no work for your compiler to do.

The adding dependencies part of the tutorial is I suspect what you’re looking for: https://fpm.fortran-lang.org/en/tutorial/dependencies.html

I hope this helps.

My question was about building an external package, not about building my project that depends on an external package. When I finally downloaded the full source of pyplot-fortran and isssued fpm build --profile release in its top directory, the project was built, resulting in pyplot_module.mod and libpyplot-fortran.a files in the build directory tree. So I wondered if fpm were able to do this whole process based on just fpm.toml file which, as I see, contains the URL of the project.
Sort of self-dependence, so to say.

Do I understand correctly that if I initially build fpm itself or other project with specific flags etc. and then running fpm install --prefix "$PREFIX" I must setup the same flags to avoid recompiling?

If initially run fpm build and then run fpm test then build fpm package it will be recompiled because of internal built-in tests (using test-drive), isn’t it?

Yes, very similar to other build tools. For fpm the file fpm.toml is how fpm interacts with your project.

If you are using fpm install ... yes, since every time you install will override the same binary/library.
If you are doing fpm build ... or fpm run ... then fpm is capable of maintaining multiple builds simultaneously, under ./build.

When you do fpm build what is compiled by default are Fortran files under src, app and example, so when you do fpm test you only need to compile the Fortran files under test not the entire project. The only reason I can think of why fpm test would recompile files under src is if somehow your test modules where altering the files.

If files in src get built in fpm test they were probably not used in any executable, since fpm will only compile modules which are used.

1 Like

I prepared Gentoo Linux package dev-util/fpm-0.7.0 for GURU repository.

I have to patch fpm.toml to unbundle toml-f and m_cli2 libraries (as separate packages) to build it as external packages and to link as shared libraries. It’s because package is required to be built within networkless environment and Gentoo QA requirements to unbundle as much as possible.

In src_compile and src_install phases I pass all possible flags to be safe of respecting user/system defined values instead of defaults. Also I assumed that fpm recompile on options changes like scons build system so pass the same options (flags) to fpm install command. On this iteration I disable tests checking for package.

The package is in the dev branch so it requires to wait a little bit and it will be available for Gentoo users too.

I didn’t find option in fpm documentation to run parallel build process. Isn’t it implementing yet?

1 Like

Nice, thanks for doing the work to port it to Gentoo.

The parallelisation is only available via OpenMP. This should work assuming you have OpenMP installed

fpm install --profile release --flag "-fopenmp"

@gnikit ,
thank you for additional info. I added optional USE="openmp" package manager flag for gentoo fpm package but without --profile release as anyway system defined flags are passed anyway.

Have you verified that the resulting fpm binary contains optimised code? I would check that just to be safe.

Also, just as a sanity check to make sure fpm works with the compiler flags you are using I would run through the test suite. I don’t mean as part of the Gentoo install process, just locally on your machine.


It seems the fpm currently incompatible with toml-f-0.3.1 - with being unbundled of this library 3 tests (or more) are failed (non depend on flags, I passed from system: -march=native -O2 -pipe):

# Starting invalid-toml ... (2/3)
#      ... invalid-toml [EXPECTED FAIL]
# Message: error: Key 'dependencies' already exists
 --> fpm-invalid-toml.toml:4:2-13
3 | dependencies.fpm.git = "https://github.com/fortran-lang/fpm"
  | ------------ first defined here
4 | [dependencies]
  |  ^^^^^^^^^^^^ key already used
# Starting package-simple ... (24/48)
#      ... package-simple [FAILED]
# Message: manifest file syntax error: package name must be composed only of alphanumerics, "-" and "_"  and start with a letter ::"example"
# Starting package-wrongexe ... (28/48)
#      ... package-wrongexe [EXPECTED FAIL]
# Message: manifest file syntax error: package name must be composed only of alphanumerics, "-" and "_"  and start with a letter ::"example"
# Starting package-wrongtest ... (29/48)
#      ... package-wrongtest [EXPECTED FAIL]
# Message: manifest file syntax error: package name must be composed only of alphanumerics, "-" and "_"  and start with a letter ::"example"
# Starting package-duplicate ... (30/48)
#      ... package-duplicate [EXPECTED FAIL]
# Message: manifest file syntax error: package name must be composed only of alphanumerics, "-" and "_"  and start with a letter ::"example"
# Starting test-simple ... (31/48)
#      ... test-simple [FAILED]
# Starting example-simple ... (39/48)
#      ... example-simple [FAILED]
# Message: manifest file syntax error: example name must be composed only of alphanumerics, "-" and "_"  and start with a letter ::"example"
3 test(s) failed!

Error termination. Backtrace:
#0  0x7ff8c4b85a28 in ???
#1  0x7ff8c4b86674 in ???
#2  0x555c909f9ec0 in MAIN__
#3  0x555c909f94de in main
<ERROR> Execution failed for object " fpm-test "
<ERROR>*cmd_run*:stopping due to failed executions

But fpm successfully build the fpm from git and create new project. The executable is optimized with applied flags - it’s about 700 Kb and addition of --verbose key show that the offered flags are used.

With unbundled toml-f-0.2.4 (that corresponds bundled commit-sha) all tests are passed. I need to restrict fpm package build against this version of toml-f.

1 Like

Thanks for pointing this out could you open an issue in fpm regarding this incompatibility? It could also be a bug in TOML Fortran.

1 Like

I open appropriate issue: fpm tests fail if build against toml-f 0.3.1 instead of 0.2.4 · Issue #805 · fortran-lang/fpm · GitHub

Initially I failed to reproduce and was confused. It was because my cloned fpm repo already had build/dependencies/toml-f with v0.2.4 and change of toml-f commit-sha within fpm.toml didn’t result in the update of this dependency files. Is it a bug or there is fpm command to refetch/update dependencies?

Good point, I just cheated when making the patch by cloning from a local repo so I didn’t noticed any issue in fpm update. If you have a reproducer we can check.