LFortran can now compile fpm , the Fortran Package Manager. We opened up an issue for it in April 2025, when we started focusing on it as a priority. We closed it on February 7, 2026. fpm is the most complex project that we now successfully built and run. It is an interesting project: it is not computational, but rather a system project which exercises running other programs, reading environment variables, command-line argument parsing, reading and writing files, directories, parsing enough Fortran to understand dependencies, etc. It uses almost all modern Fortran features: classes, inheritance, allocatable components, constructors, arrays of classes, select type, associate, automatic LHS (left-hand side) reallocation, strings, arrays of strings and it exposed dozens and dozens of bugs and missing features in LFortran. And we have now implemented them all. As a result, LFortran is really close to beta, and we are advancing our progress bar to 9/10.
When we started our progress bar towards beta, we thought that compiling 10 codes with increasing complexity and ending with fpm would be enough for beta. But when we got close to compiling fpm , we realized we are still not quite there. Beta quality to us means that when you use LFortran on your code of N lines (say N=10,000), it will compile and run it correctly in about 90% of the cases. We are estimating that we are there with N=500 or maybe N=1,000, but not for larger codes yet. However the bugs are very small, and so we are sprinting by compiling more and more codes and fixing all bugs, which are now simple to fix.
So we decided to cheat a little bit and did not progress the bar on compiling LAPACK, which allows us to progress the bar now and still have one step left and we will progress it to beta once we are confident that we can compile medium-sized codes with high probability.
One of the big subprojects was to completely refactor how we handle classes, virtual functions and inheritance. We studied how Clang handles classes in C++ and implemented a similar approach with some Fortran-specific additions.
As with any big projects that we compile, we got it working a few weeks ago, we set up testing that compiles and runs all fpm tests at our CI (Continuous Integration) for every commit and then we keep fixing bugs from other projects and watch the CI if it ever fails in fpm with flaky bugs. If it does not after lots of other PRs (Pull Requests) are merged, we know that it is working and that it does not have simple flaky bugs. It might still have some bugs that do not show up easily, but all the things that we can see are rock solid, so we are comfortable announcing it.
We also added support for fpm ’s five key dependencies: M_CLI2 command-line argument parsing), toml-f (reads TOML configuration files), fortran-regex (handles pattern matching), fortran-shlex (processes shell-like syntax), and Jonquil (manages JSON data).
Build
To build, do:
git clone https://github.com/fortran-lang/fpm git checkout d0f89957541bdcc354da8e11422f5efcf9fedd0e # latest main conda create -n fpm lfortran=0.60.0 fpm gfortran conda activate fpm fpm --compiler=lfortran test --flag --cpp --flag --realloc-lhs-arrays --flag --use-loop-variable-after-loop
You can also append --fast or --separate-compilation options, both work as well. The gfortran compiler is necessary to pass tests, it is not being used to build any source code. Upstream would need to be improved to not have gfortran hard-coded in testing.
... continue reading