Skip to content

Select appropriate msys2/MinGW shell on Windows #1587

@akhra

Description

@akhra

msys2 provides three shells: the full-POSIX msys2 shell, plus 64- and 32-bit MinGW shells which provide a GNU tool set but use a lighter, more optimized translation layer. Matching this, there are up to three versions of any msys2 pacman package: the unprefixed msys2 version, and architecture-prefixed MinGW versions.

Currently, stack uses the msys2 shell in all cases. This is poor behavior; in fact, the msys2 docs suggest only using that shell for system upgrades and pacman itself, and in practice I've found that MinGW packages install fine from the bit-appropriate MinGW shell. Correct behavior would be to pick MinGW64 or MinGW32 to match the GHC version in the active build strategy, and only use the raw msys2 shell when performing automated installation/upgrades (e.g. as suggested in #1586).

This is not a mere matter of optimization or correctness for its own sake: sdl2 fails to build with stack build on the Windows commandline, as it doesn't even have an msys2 package version; but with the MinGW64 pkg-config and sdl2 packages installed, manually launching the mingw64_shell.bat installed by stack and running stack --skip-msys build works fine. (Note if you want to reproduce this: there's a buggy header in sdl2-2.0.3, to get a successful build you'll need the replacement here).

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions