diff --git a/ChangeLog.md b/ChangeLog.md index 03566a6db8..7dbc1f1d34 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -8,6 +8,14 @@ Release notes: Major changes: +* On 64-bit Windows, the default `msys-environment` configuration option is now + `CLANG64`, rather than `MINGW64` (which remains an option). The MSYS2 project + deprecated the latter environment on 15 March 2026. The GHC project has used + the former toolchain from GHC 9.4.1. No default is provided for 32-bit + Windows, rather than `MINGW32` (which remains an option). The MSYS2 project + ceased to actively support it on 17 May 2020. 32-bit Windows is not supported + by the GHC project from GHC 8.12. + Behavior changes: Other enhancements: diff --git a/doc/configure/yaml/non-project.md b/doc/configure/yaml/non-project.md index 3c5faa5b06..50b768230e 100644 --- a/doc/configure/yaml/non-project.md +++ b/doc/configure/yaml/non-project.md @@ -946,7 +946,9 @@ modify-code-page: false Restrictions: Windows systems only. -Default: `MINGW64` (64-bit Windows) or `MINGW32` (32-bit Windows) +Default: +([:octicons-tag-24: 3.11.1](https://github.com/commercialhaskell/stack/releases/tag/v3.11.1)) +`CLANG64` (64-bit Windows) The name of the MSYS2 environment (case-sensitive) used in the Stack environment. Valid environments are `CLANG32`, `CLANG64`, `CLANGARM64`, diff --git a/doc/topics/GHC_from_source.md b/doc/topics/GHC_from_source.md index 2c66e07f81..c693e48166 100644 --- a/doc/topics/GHC_from_source.md +++ b/doc/topics/GHC_from_source.md @@ -167,25 +167,25 @@ Stack will build and install `happy` and `alex`, if not already on the PATH. ~~~pwsh stack exec -- pacman --sync --refresh # Synchronize MSYS2 package databases - stack exec -- pacman --sync mingw-w64-x86_64-python-pip + stack exec -- pacman --sync mingw-w64-clang-x86_64-python-pip # The PyPA recommended tool (pip) for installing Python packages. Also # installs Python as a dependency. GHC uses a Python script named `boot`. - # The package must be the one from the `mingw64` MSYS2 repository, as Python + # The package must be the one from the `clang64` MSYS2 repository, as Python # from the `msys` repository cannot interpret Windows file paths correctly. - stack exec -- pacman --sync mingw-w64-x86_64-autotools + stack exec -- pacman --sync mingw-w64-clang-x86_64-autotools # The GNU autotools build system, including `autoreconf`, `aclocal` # and `make`. GHC uses a sh script named `configure` which is itself created # from a file named `configure.ac`. stack exec -- pacman --sync patch # A utility to apply patch files to original sources. - stack exec -- pacman --sync texinfo + stack exec -- pacman --sync mingw-w64-clang-x86_64-texinfo # Utilities to work with and produce manuals, ASCII text, and on-line # documentation from a single source file, including `makeinfo`. - stack exec -- pacman --sync mingw-w64-x86_64-ca-certificates + stack exec -- pacman --sync mingw-w64-clang-x86_64-ca-certificates # Common CA (certificate authority) certificates. - stack exec -- pacman -sync mingw-w64-x86_64-python-sphinx + stack exec -- pacman -sync mingw-w64-clang-x86_64-python-sphinx # Sphinx is the Python documentation generator. - stack exec -- pacman -sync mingw-w64-x86_64-texlive-full + stack exec -- pacman -sync mingw-w64-clang-x86_64-texlive-full # The TeX Live distribution. ~~~ diff --git a/doc/topics/developing_on_windows.md b/doc/topics/developing_on_windows.md index b3756fb6e0..b71ca19dd4 100644 --- a/doc/topics/developing_on_windows.md +++ b/doc/topics/developing_on_windows.md @@ -3,11 +3,11 @@ # Developing on Windows # On Windows, Stack comes with an installation of [MSYS2](https://www.msys2.org/). -An environment of MSYS2 (by default, `MINGW64` on 64-bit Windows or `MINGW32` on -32-bit Windows) will be used by Stack to provide a Unix-like shell and -environment for Stack. This may be necessary for installing some Haskell -packages, such as those which use `configure` scripts, or if your project needs -some additional tools during the build phase. +An environment of MSYS2 (by default, `CLANG64` on 64-bit Windows) will be used +by Stack to provide a Unix-like shell and environment for Stack. This may be +necessary for installing some Haskell packages, such as those which use +`configure` scripts, or if your project needs some additional tools during the +build phase. No matter which terminal software you choose (Windows Terminal, Console Windows Host, Command Prompt, PowerShell, Git bash or any other) you can use this @@ -26,22 +26,22 @@ example, help about the operation `--sync` (or `-S`) can be obtained with `stack exec -- pacman --sync --help` or, equivalently, `stack exec -- pacman -Sh`. -Command `stack path --bin-path` to see the PATH in the Stack environment. If the -relevant MSYS2 environment is `MINGW64`, on Windows, it includes the -`\mingw64\bin`, `\usr\bin` and `\usr\local\bin` directories of the -Stack-supplied MSYS2. (It includes the corresponding directory if the relevant -MSYS2 environment is other than `MINGW64`.) If your executable depends on files -(for example, dynamic-link libraries) in those directories and you want to run -it outside of the Stack environment, you will need to ensure copies of those -files are on the PATH. +Command `stack path --bin-path` to see the PATH in the +[Stack environment](stack_environment.md). If the relevant MSYS2 environment is +`CLANG64`, on Windows, it includes the `\clang64\bin`, `\usr\local\bin` and +`\usr\bin` directories of the Stack-supplied MSYS2. (It includes the +corresponding directory if the relevant MSYS2 environment is other than +`CLANG64`.) If your executable depends on files (for example, dynamic-link +libraries) in those directories and you want to run it outside of the Stack +environment, you will need to ensure copies of those files are on the PATH. Command `stack path --extra-include-dirs` and `stack path --extra-library-dirs` to see the extra directories searched for C header files or system libraries -files in the Stack environment. If the relevant MSYS2 environment is `MINGW64`, -on Windows, it includes the `\mingw64\include` (include) and the `\mingw64\lib` -and `\mingw64\bin` directories (library) of the Stack-supplied MSYS2. (It +files in the Stack environment. If the relevant MSYS2 environment is `CLANG64`, +on Windows, it includes the `\clang64\include` (include) and the `\clang64\lib` +and `\clang64\bin` directories (library) of the Stack-supplied MSYS2. (It includes the corresponding directories if the relevant MSYS2 environment is -other than `MINGW64`.) +other than `CLANG64`.) For further information about configuring the relevant MSYS2 environment, see Stack's [`msys-environment`](../configure/yaml/non-project.md#msys-environment) @@ -72,7 +72,7 @@ common Haskell packages on Windows. Feel free to submit additional entries via a pull request. * For [text-icu](https://hackage.haskell.org/package/text-icu) install - `mingw64/mingw-w64-x86_64-icu`. + `mingw-w64-clang-x86_64-icu`. * For [zlib >= 0.7](https://hackage.haskell.org/package/zlib) the default Cabal flag `pkg-config` is `true` and requires executable `pkg-config` on @@ -83,27 +83,3 @@ pull request. stack exec -- pacman -S pkgconf Alternatively, build with `--flag zlib:-pkg-config`. - -## CMake ## - -CMake has trouble finding other tools even if they are available on the PATH. -Likely this is not a CMake problem but one of the environment not fully -integrating. For example GHC comes with a copy of GCC which is not installed by -MSYS2 itself. If you want to use this GCC you can provide a full path to it, or -find it first with `System.Directory.findExecutable` if you want to launch GCC -from a Haskell file such as `Setup.hs`. - -Experience tells that the `mingw-w64` versions of Make and CMake are most -likely to work. Though there are other versions available through `pacman`, so -have a look to see what works for you. Both tools can be installed with the -commands: - - stack exec -- pacman -S mingw-w64-x86_64-make - stack exec -- pacman -S mingw-w64-x86_64-cmake - -Even though Make and CMake are then both installed into the same environment, -CMake still seems to have trouble to find Make. To help CMake find GCC and Make -supply the following flags: - - -DCMAKE_C_COMPILER=path - -DCMAKE_MAKE_PROGRAM=path diff --git a/doc/tutorial/hello_world_example.md b/doc/tutorial/hello_world_example.md index 5036b23cfa..62f34b7a24 100644 --- a/doc/tutorial/hello_world_example.md +++ b/doc/tutorial/hello_world_example.md @@ -324,7 +324,7 @@ environment. !!! info On Windows, the [Stack environment](../topics/stack_environment.md) includes - the `\mingw64\bin`, `\usr\bin` and `\usr\local\bin` directories of the + the `\clang64\bin`, `\usr\bin` and `\usr\local\bin` directories of the Stack-supplied MSYS2. If your executable depends on files (for example, dynamic-link libraries) in those directories and you want ro run it outside of the Stack environment, you will need to ensure copies of those files are diff --git a/src/Stack/Config.hs b/src/Stack/Config.hs index fe99bb602e..3e26f49674 100644 --- a/src/Stack/Config.hs +++ b/src/Stack/Config.hs @@ -306,10 +306,6 @@ configFromConfigMonoid installMsys = fromFirst installGHC configMonoid.installMsys skipGHCCheck = fromFirstFalse configMonoid.skipGHCCheck skipMsys = fromFirstFalse configMonoid.skipMsys - defMsysEnvironment = case platform of - Platform I386 Windows -> Just MINGW32 - Platform X86_64 Windows -> Just MINGW64 - _ -> Nothing extraIncludeDirs = configMonoid.extraIncludeDirs extraLibDirs = configMonoid.extraLibDirs customPreprocessorExts = configMonoid.customPreprocessorExts @@ -324,15 +320,19 @@ configFromConfigMonoid requireStackVersion = simplifyVersionRange configMonoid.requireStackVersion.intersectingVersionRange compilerCheck = fromFirst MatchMinor configMonoid.compilerCheck - msysEnvironment <- case defMsysEnvironment of - -- Ignore the configuration setting if there is no default for the - -- platform. + mMsysEnv = case platform of + Platform X86_64 Windows -> + -- Default CLANG64 on 64-bit Windows: + Just $ fromFirst CLANG64 configMonoid.msysEnvironment + Platform _ Windows -> + -- No default on unsupported 32-bit Windows: + getFirst configMonoid.msysEnvironment + _ -> Nothing + msysEnvironment <- case mMsysEnv of Nothing -> pure Nothing - Just defMsysEnv -> do - let msysEnv = fromFirst defMsysEnv configMonoid.msysEnvironment - if msysEnvArch msysEnv == arch - then pure $ Just msysEnv - else prettyThrowM $ BadMsysEnvironment msysEnv arch + Just msysEnv + | msysEnvArch msysEnv == arch -> pure $ Just msysEnv + | otherwise -> prettyThrowM $ BadMsysEnvironment msysEnv arch platformVariant <- liftIO $ maybe PlatformVariantNone PlatformVariant <$> lookupEnv platformVariantEnvVar let build = buildOptsFromMonoid configMonoid.buildOpts diff --git a/src/Stack/Types/MsysEnvironment.hs b/src/Stack/Types/MsysEnvironment.hs index 7372f72ff7..efee5d6e60 100644 --- a/src/Stack/Types/MsysEnvironment.hs +++ b/src/Stack/Types/MsysEnvironment.hs @@ -26,13 +26,10 @@ import Stack.Prelude data MsysEnvironment = CLANG32 | CLANG64 + -- ^ Stack's default on architecture x86_64. | CLANGARM64 | MINGW32 - -- ^ Stack's default on architecture i386, and applied if GHC version is - -- earlier than GHC 9.6. | MINGW64 - -- ^ Stack's default on architecture x86_64, and applied if GHC version is - -- earlier than GHC 9.6. | UCRT64 deriving (Eq, Ord, Show)