Search code examples
mingwmingw-w64msys2

why does openblas when building in msys think I'm using Cygwin


I have been building OpenBLAS with some specific flags for awhile now under MSYS2. Recently, I setup a new install of MSYS2 under Windows 10. After doing the standard pacman -Syu a few times and then installing the needed tooling pacman -S gcc gcc-fortran make cmake git I cloned the OpenBLAS repo, and did make USE_OPENMP=1 USE_LOCKING=1 and when it finished it had created a dll cygopenblas.dll instead of the normal libopenblas.dll and it reported that it detected the os as:

OS ... CYGWIN_NT.

when before it was:

OS ... WINNT.

In addition, when it was looking for libraries, before (when I set this up previously) it was looking for things like libgomp-1.dll in the C:\msys64\mingw64\bin\ directory and now its looking for msys-gomp-1.dll in the C:\msys64\usr\bin directory.

I'm not exactly sure if I did something differently, or if the system has been updated in some way, but I also don't know what it is that dictates these differences in behavior and am looking for some guidance as to what controls where msys is looking for things and why it things my os is CYGWIN_NT when before I think it was WINNT.

I know for this round I did all of my pacman installs through the terminal opened with the "MSYS2" terminal shortcut, whereas I built my programs in the terminal opened with the "MSYS2 MinGW 64-bit" terminal shortcut. I am pretty sure I did that the last time too, but maybe I am misremembering.

I know that's a bit fuzzy, but any guidance would be appreciated. Also any comment on whether any of this makes any difference other than looking in different places for libraries with different names but everything else is the same or actually things are different, would be appreciated.


Solution

  • MSYS2 ships several different toolchains. The one you're using uses MSYS2's fork of Cygwin.

    To switch to the regular, non-Cygwin MinGW, do this:

    • Uninstall gcc, gcc-fortran.
    • Install mingw-w64-x86_64-gcc, mingw-w64-x86_64-gcc-fortran.
    • Restart the terminal using mingw64.exe. If done correctly, the prompt will say MINGW64 in magenta letters, instead of MSYS.

    The current terminal mode (MINGW64 vs MSYS) affects environment variables, most notably PATH. It doesn't matter from which mode you operate pacman, but it affects which toolchain will be in the PATH.