commercialhaskell / commercialhaskell/stack
Put GHC tmpdirs into .stack-work
- Dominant language
- Haskell
- Stars
- 4.1k
- Forks
- 850
- Avg merge
- 10h 37m
- Merged PRs (30d)
- 4
Description
# Motivation
I'm trying to look at the output of a custom `-pgmF` preprocessor by using `--ghc-options=-keep-tmp-files`, but it took me forever to realize that the output is in `$TMPDIR` and not `.stack-work` (since that's where `-ddump` files go already).
Additionally, when I run a single `stack build`, I get 5 different `ghc` temp directories. I'm assuming Stack invokes GHC 5 times and GHC creates a tmpdir each time. This makes it difficult to know which directory contains the file I want to look at.
# Request
It'd be great if Stack could set the `-tmpdir` flag whenever invoking `ghc` to an appropriate location in `.stack-work/`. This way, the GHC temp dirs could clearly be labelled like `.stack-work/ghctmp-build-setup-hs/` or `.stack-work/ghctmp-build-library/` or whatever, and if a user runs `--ghc-options=-keep-hscpp-files`, they can do `find .stack-work -name '*.hscpp'` and easily find files.
Related: https://gitlab.haskell.org/ghc/ghc/-/issues/22258
Contributor guide
Assessment
This issue has not been assessed yet.