MSYS2 fpm compilation

Has anyone compiled a program using fpm in msys2? I can’t seem to get it to work. It fails at 0% completed or segfaults. Using the default hello world does not compile either.

I think the version of fpm may be using multithreading, so that may be the issue. I can compile through conda though which seems to be using a single thread.

I’m using msys2 version 3.6.5 and fpm version 0.12.0. It’s the same fpm version on conda.

1 Like

Haven’t gotten it to work either, I ended up just building fpm and using it in WSL. Seems easier to set up, but I’m only building console software.

That makes sense. I was having the same issues in WSL with Ubuntu 24.04. I may just have to compile fpm separately instead of installing it from the repositories.

Which environment are you setting it up in? It is ambiguous how you are using the term “MSYS2”, as there are separate environments in the MSYS2 installation, with one of them having that name.

I haven’t run FPM on Windows in awhile, but you might find more errors in the UCRT and mingw64 environments as they are closer to the Windows interface and probably haven’t been debugged thoroughly. UCRT is the Microsoft implementation of the C standard, without certain parts that comply with POSIX.

Have you tried compiling FPM in the MSYS2 environment, which is much closer to a standard Unix or Cygwin environment?

I noticed some gcc errors (when compiling C) that occurred in mingw64 and ucrt environments, but gcc in msys2 was OK, and matched the output of clang on both windows and Linux.

I’m not sure if it’s related to the stack limit triggered by using automatic arrays in fpm 0.12.0. I submitted a patch to the fpm repository. If there is a specific demo-project and hash value of fpm repo commit to reproduce the segmentation fault case, it will be helpful for debugging.

Yes, I also compiled fpm from source to use in windows. Eventually I have gotten it
so that things work exactly in WSL as they do on my thinkpad
where I do most of my development. I just directly use pwsh with nvim and fpm now in windows without using MSYS2.

I’m using. I think it also helps with FPM to set compiler
flags as environment variables, as I haven’t figured out (maybe not
possible) how to do it with the fpm.toml, which I would much prefer.

from my .bashrc

alias ft=‘fpm test’

export FPM_FFLAGS=“-O -Wall -g -fbacktrace -flto -I/usr/local/lib -fcheck=all -std=f2008 -ffpe-trap=zero,invalid,overflow,underflow,denormal”
export FPM_FC=/usr/bin/gfortran
export PATH=“/home/username/.local/bin:$PATH”

I can try the MSYS2 environment. I tried the UCRT and Mingw64 environments, but my MSYS2 environment does not have fpm in the package repositories, so I would have to compile from source.

Have you tried installing fpm from the windows package manager ?

from powershell:

winget install FortranLang.fpm

I’ve found this to be the easiest way to have an fpm installation that works on any terminal (be it msys2, conda env, pws, cmd) easily and natively from windows.

Note: for some reason my installation of gnu compilers in msys2 hasn’t been working for some time now, so I’ve been using either the gnu installation from conda (conda install conda-forge::binutils gcc gfortran gxx) or equation.com

1 Like