commercialhaskell / commercialhaskell/stack

Exclude '/path/to/ghc' from PATH during `stack run` on Windows

Open
#5,036 0 comments 0 reactions 0 assignees View on GitHub
component: Windows type: bug type: discuss
Dominant language
Haskell
Stars
4.1k
Forks
850
Avg merge
10h 37m
Merged PRs (30d)
4

Description

## Motivation

I have a project, which depends on `sdl2`. SDL2 (the C library), in turn, has a dependency of `zlib1.dll`. It seems `zlib1.dll` from GHC 8.6.5 is not compatible with SDL2 from MSYS. The problem is, when I run `stack run` from the terminal, the `zlib1.dll` chosen by Windows is always the one bundled with GHC, instead of the one installed by MSYS.

I might just copy all the DLLs together with the executable produced by `stack build` to some other path and double-click to run it (and this method worked), but that is far from desirable.

## Proposal

I feel that this problem can be solved by removing `/path/to/ghc` from the `PATH` variable during `stack run`, thus the `zlib1.dll` installed by MSYS could take precedence.

As far as I understand, it is not necessary for GHC to be in PATH during `stack run`. If I were wrong on this, it will also be helpful to have an option.

Simply swap the sequence of GHC path and MSYS path everywhere probably will NOT help, for that might break GHC on `stack build`.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.