Reliable software distribution is one of the major issues I faced when starting my open source projects. Especially proprietary operating systems like Windows and OSX have always been hard to support, because I don’t have those available in my local development environment. Yet I get plenty of requests for Windows and OSX versions.
I’m currently relying mostly on conda-forge to distribute Fortran programs, which does a great job to reliably create packages for Linux (x86_64, ppc64le and aarch64) and OSX (x86_64) based on GFortran 9 (there is also aarch64 for OSX available now, but I haven’t tried this toolchain yet).
I also explored homebrew for OSX a while ago, which always has been a dead-end for modern Fortran because of their GFortran 4.9 version requirement to build the bottled packages. Packaging for OSX is particular difficult because you cannot statically link binaries like on Linux, distribution outside of a package manager therefore always seemed unfeasible for me.
Distribution for Windows has been an issue so far, conda-forge offers either classic flang 5 with LLVM or GFortran 5 with MinGW, which left me stuck with a similar issue I faced with homebrew: modern Fortran projects don’t compile with this setup.
What is your experience with packaging Fortran projects? Have you found a good solution for creating distributions for Windows?
Cross-platform binary package manager: I also use Conda . To fix Windows, cannot you simply compile your Conda packages at conda-forge using a more modern compiler?
Cross-platform source package manager: we are hoping fpm will fill this role for Fortran. There are other source package managers such as Spack, which is planning to add Windows support.
I’m looking for a binary package manager, having users compile on their system opens a whole new can of worms . Providing source code distributions for developers works perfectly fine with fpm or meson so far.
I don’t think they have newer compilers packaged. You can check the Fortran compilers available here:
I see. We should package the latest GFortran for Windows.
Btw, one of the goals of LFortran is to have a first class support on Windows and good interoperation with MSVC. But we are not there yet for production codes.
It seems like we are not yet there for reliably distributing Fortran software for Windows, are we? From my limited knowledge on Windows there seem to exist at least several other packaging ecosystems beside conda as well:
I did try using Linuxbrew for a while, I guess a Formula like this might be able to build fpm:
class Fpm < Formula
desc "Fortran Package Manager (fpm)"
homepage "https://fpm.fortran-lang.org"
url "https://github.com/fortran-lang/fpm/releases/download/v0.1.4/fpm-0.1.4.f90"
sha256 "06c139b16cf871e06cd3ea3be93c1ddbb5a94e4546a0c64822d10dc87333ac0c"
license "MIT"
depends_on "gcc" # for gfortran
fails_with :gcc => "4"
fails_with :gcc => "5"
fails_with :gcc => "6"
fails_with :clang
def install
# ENV.fc is not defined and setting it up with ENV.fortran will yield default gfortran
ENV["FC"] = ENV.cc.gsub /gcc/, "gfortran"
system ENV["FC"], "fpm-0.1.4.f90", "-o", "fpm"
bin.install "fpm"
end
test do
system "#{bin}/fpm", "--version"
end
end
Selecting a Fortran compiler other than GCC 4 required me a bit of hacking… not sure if this is still an issue in brew.
As far as I know the answer is not yet. There has been discussions on the conda-forge gitter channel regarding the oneAPI compilers with no clear outcome yet.
Anaconda seems to be using Intel Parallel Studio to build most of their Windows stack and I know of many communities that use Intel oneAPI already to build their packages for Windows, MacOS and Linux, but this doesn’t mean it is automatically working for open source community at conda-forge as well.