# MSYS2 fpm compilation

**URL:** <https://fortran-lang.discourse.group/t/msys2-fpm-compilation/10714>\
**Category:** fpm\
**Created:** [February 11, 2026, 8:15pm UTC](https://fortran-lang.discourse.group/t/msys2-fpm-compilation/10714 "2026-02-11T20:15:23Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![agisteg](https://avatars.discourse-cdn.com/v4/letter/a/73ab20/32.png) [@agisteg](https://fortran-lang.discourse.group/u/agisteg)\
**Post date:** [February 11, 2026, 8:15pm UTC](https://fortran-lang.discourse.group/t/msys2-fpm-compilation/10714/1 "2026-02-11T20:15:23Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![BFelsher](https://avatars.discourse-cdn.com/v4/letter/b/71c47a/32.png) [@BFelsher](https://fortran-lang.discourse.group/u/BFelsher)\
**Post date:** [February 12, 2026, 3:48pm UTC](https://fortran-lang.discourse.group/t/msys2-fpm-compilation/10714/2 "2026-02-12T15:48:58Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![agisteg](https://avatars.discourse-cdn.com/v4/letter/a/73ab20/32.png) [@agisteg](https://fortran-lang.discourse.group/u/agisteg)\
**Post date:** [February 14, 2026, 2:30pm UTC](https://fortran-lang.discourse.group/t/msys2-fpm-compilation/10714/3 "2026-02-14T14:30:32Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![R\_cubed](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/r_cubed/32/263_2.png) [@R\_cubed](https://fortran-lang.discourse.group/u/R_cubed)\
**Post date:** [February 15, 2026, 4:55pm UTC](https://fortran-lang.discourse.group/t/msys2-fpm-compilation/10714/4 "2026-02-15T16:55:02Z")

</div>

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.

> **[Compatibility](https://learn.microsoft.com/en-us/cpp/c-runtime-library/compatibility?view=msvc-170)**
>
> Describes the compatibility of the Microsoft Universal C runtime library (UCRT) with the Standard C library, POSIX, the Safe CRT, and Store apps.

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.

---

<div class="post-metadata">

**Author:** ![zoziha](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/zoziha/32/582_2.png) [@zoziha](https://fortran-lang.discourse.group/u/zoziha)\
**Post date:** [February 15, 2026, 5:17pm UTC](https://fortran-lang.discourse.group/t/msys2-fpm-compilation/10714/5 "2026-02-15T17:17:52Z")

</div>

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](https://github.com/fortran-lang/fpm/pull/1242) 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.

---

<div class="post-metadata">

**Author:** ![BFelsher](https://avatars.discourse-cdn.com/v4/letter/b/71c47a/32.png) [@BFelsher](https://fortran-lang.discourse.group/u/BFelsher)\
**Post date:** [February 16, 2026, 3:07pm UTC](https://fortran-lang.discourse.group/t/msys2-fpm-compilation/10714/6 "2026-02-16T15:07:07Z")

</div>

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”

---

<div class="post-metadata">

**Author:** ![agisteg](https://avatars.discourse-cdn.com/v4/letter/a/73ab20/32.png) [@agisteg](https://fortran-lang.discourse.group/u/agisteg)\
**Post date:** [February 18, 2026, 1:44am UTC](https://fortran-lang.discourse.group/t/msys2-fpm-compilation/10714/7 "2026-02-18T01:44:09Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![hkvzjal](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/hkvzjal/32/3055_2.png) [@hkvzjal](https://fortran-lang.discourse.group/u/hkvzjal)\
**Post date:** [February 18, 2026, 6:53am UTC](https://fortran-lang.discourse.group/t/msys2-fpm-compilation/10714/8 "2026-02-18T06:53:35Z")

</div>

Have you tried installing fpm from the windows package manager ?

from powershell:

```auto
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](https://www.equation.com/servlet/equation.cmd?fa=fortran)
