haskell / haskell/cabal

Make ghc-pkg discoverable from ghc executable

Open
#7,390 9 comments 0 reactions 0 assignees View on GitHub
type: enhancement
Dominant language
Haskell
Stars
1.7k
Forks
750
Avg merge
4d 3h
Merged PRs (30d)
28

Description

**Describe the bug**
Currently there is no robust way to locate the `ghc-pkg` executable corresponding to a particular compiler. For this reason, Cabal currently implements a variety of heuristics to do the same. However, these can end up failing, in particular when the executable name is version-suffixed.

@hasufell and I discussed this some months ago after a `ghc-up` user encountered this problem, which resulted in [GHC #18807](https://gitlab.haskell.org/ghc/ghc/-/issues/18807). To address this I proposed that `ghc --info` should report the path to the corresponding `ghc-pkg` executable. This solves the problem nicely since Cabal already must query `--info` when configuring a package.

I have put together a very straightforward GHC implementation as [!4214](https://gitlab.haskell.org/ghc/ghc/-/merge_requests/4214). I have also written a [quick patch](https://gitlab.haskell.org/ghc/ghc/-/snippets/2710) implementing the Cabal support.

My sense is that this is the right solution to the problem. However, I'm also happy to hear alternatives. If there are no objections, I will backport to 8.10.5, 9.0.2, and 9.2.1 such that future users won't encounter this issue in the future.

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.