MSYS2 uses a different exception handling variant on 32 bit than every
other common mingw-w64 build. You’ll notice that in complicated enough C++
code like qt. That’s the main reason we don’t really support MSYS2 in a
first class way.
Easiest way is via the Julia package. There are a few examples of packages
that have done this, notably ParallelAccelerator. It’s doable without
installing Julia too in a few ways, but messier (see
contrib/windows/get_toolchain.sh).