Skip to content

stack prefers ghc from .stack-work\install\…\bin over the one from PATH #1052

Closed
@mwu-tow

Description

@mwu-tow

I have a package that compiles to the executable named ghc.exe.
When building first time, everything works fine. The install step places the built ghc.exe in the .stack-work\install\x86_64-windows\lts-2.22\7.8.4\bin directory. As expected.

However, any subsequent stack build command will fail:

    setup-Simple-Cabal-1.22.4.0-x86_64-windows-ghc-7.8.4.exe: The program 'ghc' version >=6.4 is required but the version of C:\z\.stack-work\install\x86_64-windows\lts-2.22\7.8.4\bin\ghc.exe could not be determined.
    setup-Simple-Cabal-1.22.4.0-x86_64-windows-ghc-7.8.4.exe: fd:5: hGetContents: invalid argument (invalid byte sequence)

To built it again I have to delete .stack-work directory.

It is because stack tried to use .stack-work\install\x86_64-windows\lts-2.22\7.8.4\bin\ghc.exe — that is not an actual GHC but the locally built package that was just named so.

I expect that stack should prefer ghc.exe from PATH or its ghc-paths over the built executables. The results of build should not affect subsequent builds, and overwriting the compiler executable should not be implicit.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions