Fpm version 0.14.0 released

The Fortran Package Manager (FPM) v0.14.0 is a release about faster and more reliable builds. The release binaries now build packages in parallel, with a new --jobs option to control how many targets build at once. Incremental builds now recompile everything a change affects. More compilers can build fpm itself and the packages it manages, and there are new release binaries for Linux ARM64 and self-contained ones for macOS.

Highlights

⚡ Parallel builds out of the box

The fpm release binaries are now built with OpenMP, so fpm compiles, links and archives independent targets at the same time. fpm --version reports whether your fpm runs in parallel:

❯ fpm --version
Version:     0.14.0, alpha
...
Parallel:    OpenMP, 10 threads

By default fpm uses OMP_NUM_THREADS if it is set, and all cores otherwise. The new --jobs/-j option of build, run, test and install, or the FPM_JOBS environment variable, sets the number of parallel jobs without changing OMP_NUM_THREADS for the programs fpm runs:

❯ fpm build -j 4
❯ fpm test -j 1      # one target at a time

Compiler, linker and archiver commands now start directly through posix_spawn or CreateProcess instead of a shell, which makes running them from many threads safe, on macOS too. fpm processes that run at the same time on one package now wait for each other through a lock on the build directory instead of compiling the same files at once.

To build fpm from source with OpenMP, use fpm install --features openmp. install.sh now does this by default, and takes --no-openmp to turn it off.

  • ci: ship parallel (OpenMP-enabled) fpm release artifacts by @zbeekman in #1281

  • feat: add –jobs/-j to set the number of parallel build jobs by @perazz in #1388

  • feat: lock the build directory against concurrent fpm runs by @perazz in #1390

  • feat: exec Fortran compiles via argv (posix_spawn/CreateProcess) by @krystophny in #1299

  • feat: run link and archive in parallel via argv spawn by @krystophny in #1300

  • feat: exec C/C++ compiles via argv, close the shell-fork gap by @krystophny in #1301

  • refactor: share argv command building and running across compile and link by @perazz in #1371

  • refactor: serialize shell commands inside run() by @perazz in #1372

🔁 Incremental builds that rebuild what changed

fpm now recompiles every target that a change affects, including after a failed or interrupted build:

  • targets whose dependencies were rebuilt since their own last build are rebuilt too, so apps and tests no longer keep old module code;

  • a source is recompiled when a file it includes changes;

  • static archives are rebuilt from scratch, so the object of a moved or renamed source no longer shadows the new one at link time;

  • a cached dependency is resolved again when its local path changes.

  • fix: rebuild targets whose dependencies changed since their last build by @perazz in #1363

  • fix: rebuild sources when their included files change by @perazz in #1402

  • fix: rebuild static archives from scratch by @perazz in #1360

  • fix: re-resolve a cached dependency when its local path changes by @krystophny in #1395

  • fix(targets): per-profile build dirs for archive, shared, and exe targets by @perazz in #1286

  • fix feature caching in fpm by @JorgeG94 in #1320

🛠️ More compilers

LLVM Flang and NAG can now build fpm itself and the packages it manages, and fpm builds packages with AOCC, whose flang is classic flang. A gfortran 15 and 16 miscompilation that hung fpm on Windows is avoided, and LFortran, amdflang and Intel on Windows get flag fixes.

  • Fix: make an elemental subprogram impure so flang builds fpm by @rouson in #1318

  • fix: build fpm with nagfor, and build packages with it by @perazz in #1397

  • build(nag): rm headerpad flags for nagfor on macOS by @rouson in #1312

  • fix: build with AOCC, whose flang is classic flang by @perazz in #1392

  • fix: detect amdflang before flang and enable its OpenMP flag by @ShryukGrandhi in #1387

  • fix: avoid class array allocations that gfortran 15+ leaves without a rank by @perazz in #1352

  • Fix: lfortran release flag and Windows ifx variant mapping by @gha3mi in #1249

  • fix: lfortran uses ‘–shared’ not ‘-shared’ by @amckinstry in #1280

  • Keep Unix Intel debug flags off Windows by @Sarthak-Shreshtha01 in #1342

  • fix(compiler): use /OUT: for a user-set lib archiver, set os_type first by @perazz in #1389

📦 Release binaries for more platforms

The release now includes a static Linux ARM64 binary, so ARM64 runners and machines no longer need to build fpm from source. The macOS binaries link the GCC runtimes statically and run on any Mac, without Homebrew’s GCC. The single-file source fpm.F90 and the source archive fpm.zip also come with .sha256 checksums in the current pre-release.

  • ci: ship a static Linux ARM64 release binary by @perazz in #1400

  • ci: link GCC runtimes statically into the macOS release artifacts by @yuki-nishikawa in #1333

  • ci: checksum fpm.F90 and fpm.zip in the current prerelease by @perazz in #1401

🔍 More accurate source parsing

fpm reads the module dependencies of more sources correctly:

  • use statements followed directly by a comment;

  • module names that contain an intrinsic module name;

  • indented #if defined() and #elif blocks;

  • module procedure::name;

  • include directories with spaces in their names.

  • Fix parsing of USE statements with inline comments without whitespace by @ZainabTravadi in #1272

  • Fix false intrinsic module detection for substring matches in USE parsing by @ZainabTravadi in #1274

  • fix(source-parsing): correct macro extraction for indented #if defined() by @krystophny in #1284

  • fix: restore parser active state after #elif conditional blocks by @chaitanya-bhardwaj in #1340

  • fix: do not read module procedure::name as a module statement by @perazz in #1358

  • fix: preserve include directories containing spaces by @krystophny in #1339

Further fixes and improvements

Changelog (selected)

  • ci: ship parallel (OpenMP-enabled) fpm release artifacts by @zbeekman in #1281

  • feat: add –jobs/-j to set the number of parallel build jobs by @perazz in #1388

  • feat: lock the build directory against concurrent fpm runs by @perazz in #1390

  • feat: exec Fortran compiles via argv (posix_spawn/CreateProcess) by @krystophny in #1299

  • feat: run link and archive in parallel via argv spawn by @krystophny in #1300

  • feat: exec C/C++ compiles via argv, close the shell-fork gap by @krystophny in #1301

  • fix: rebuild targets whose dependencies changed since their last build by @perazz in #1363

  • fix: rebuild sources when their included files change by @perazz in #1402

  • fix: rebuild static archives from scratch by @perazz in #1360

  • fix: re-resolve a cached dependency when its local path changes by @krystophny in #1395

  • Fix: make an elemental subprogram impure so flang builds fpm by @rouson in #1318

  • fix: build fpm with nagfor, and build packages with it by @perazz in #1397

  • fix: build with AOCC, whose flang is classic flang by @perazz in #1392

  • fix: detect amdflang before flang and enable its OpenMP flag by @ShryukGrandhi in #1387

  • fix: avoid class array allocations that gfortran 15+ leaves without a rank by @perazz in #1352

  • ci: ship a static Linux ARM64 release binary by @perazz in #1400

  • ci: link GCC runtimes statically into the macOS release artifacts by @yuki-nishikawa in #1333

  • Fix parsing of USE statements with inline comments without whitespace by @ZainabTravadi in #1272

  • Fix false intrinsic module detection for substring matches in USE parsing by @ZainabTravadi in #1274

  • fix(source-parsing): correct macro extraction for indented #if defined() by @krystophny in #1284

  • fix: restore parser active state after #elif conditional blocks by @chaitanya-bhardwaj in #1340

  • fix: reject positional arguments in subcommands that take none by @perazz in #1364

  • fix: stop without the runtime’s stop code or IEEE exception notes by @perazz in #1412

Full changelog: GitHub comparison view

New contributors

We welcome the following new contributors:

  • @gha3mi (Ali), who fixed the LFortran release flag and the Windows ifx variant mapping.

  • @ZainabTravadi (Zainab Travadi), who fixed the parsing of use statements with inline comments and a false intrinsic module match.

  • @zbeekman (Izaak “Zaak” Beekman), who made the release binaries parallel with OpenMP.

  • @amckinstry (Alastair McKinstry), who fixed the LFortran shared library flag.

  • @bonachea (Dan Bonachea), who retired the macos-14 and gcc 11 CI build.

  • @Shubham-Padkonde (Shubham Padkonde), who fixed glob backtracking, basename and an uninitialized return code.

  • @chaitanya-bhardwaj (Chaitanya Bhardwaj), who fixed the parser state after #elif blocks and extended the new test.

  • @Sarthak-Shreshtha01 (Sarthak Shreshtha), who kept the Unix Intel debug flags off Windows.

  • @yuki-nishikawa (Yuki), who made the macOS release binaries self-contained.

  • @ShryukGrandhi, who fixed the detection of amdflang and its OpenMP flag.

  • @shubhambhar007 (Shubham Bhardwaj), who fixed an LFortran test.

Acknowledgments

This release was supported by Lawrence Berkeley National Laboratory through Damian Rouson. Thanks to Dan Bonachea, who reported many of the issues this release fixes, from LLVM Flang builds to version reporting, reviewed pull requests, and tested the release candidate with gfortran and LLVM Flang. Thanks also to nAG for providing a temporary license of nagfor.

Feedback and discussion

Join the conversation and share your feedback on the Fortran Discourse thread.