Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GHC.Paths makes incorrect assumption as to where to find ghc #4

Open
erikd opened this issue Jan 13, 2014 · 3 comments
Open

GHC.Paths makes incorrect assumption as to where to find ghc #4

erikd opened this issue Jan 13, 2014 · 3 comments

Comments

@erikd
Copy link

erikd commented Jan 13, 2014

I hen trying to set up taffybar (xmonad toolbar) which uses Dyre which in turn uses ghc-paths and ran into a problem.

I have a couple of different versions of GHC installed (7.4.2, 7.6.3 and 7.7) all installed under $HOME/GHC/$version and I switch between them by setting my $PATH variable. When Dyre tires to re-compile the taffybar config file, ghc-paths says that the ghc binary is at "/usr/lib/ghc/bin/ghc-7.6.3" when it is actually at $HOME/GHC/7.6.3/bin/ghc-7.6.3.

@andreasabel
Copy link
Contributor

I am having a similar problem: the value of ghc points to a location where my GHC used to be. The explanation is that the path to ghc is fixed at compile-time of ghc-paths, and neither Stack nor Cabal rebuild this package when the location of GHC changes.

This has already described by @phadej in his answer at https://stackoverflow.com/questions/38096298/where-is-the-source-of-ghc-paths-value-came-from .

... If it still shows "/usr/bin/ghc-7.10.3" for GHC paths, then I suspect that you had GHC there when you compiled ghc-paths for GHC-7.10.3, and as stack is quite good in not rebuilding stuff, the old version of ghc-paths is still there. I don't know a way to rebuild a package in a snapshot, other then whiping ~/.stack and starting over; which might be a good idea. if you changed you global GHC stuff.

Given this problem, I have doubts in the quality of the ghc-paths package. The solution chosen here does not work reliably in the current Haskell ecosystem, where the location of the compiler is not counted as dependency whose modification warrants recompilation.

@sol
Copy link
Contributor

sol commented Nov 4, 2024

The solution chosen here does not work reliably in the current Haskell ecosystem, where the location of the compiler is not counted as dependency whose modification warrants recompilation.

  1. It has been working for me reliably for over 15 years, but then again, reinstalling the exact same version of GHC into a different location is not a use case that I regularly encounter. Also note that with recent version of GHC if you use two GHCs with the exact same version, that are not ABI compatible, then cabal will rebuild ghc-paths (and with older versions of GHC your cabal store would get corrupted anyway). So I think this could only ever be an issue when ABI compatible versions of GHC are installed to different locations. Is this in the context of Nix, or where exactly do you encounter this?
  2. Maybe a solution could be for cabal to include the canonical path to GHC into the build hash. However, if this is something you want to pursue, the we will need --with-repl first, otherwise cabal-doctest will fall apart.

@andreasabel
Copy link
Contributor

... Is this in the context of Nix, or where exactly do you encounter this?

I had first installed GHC 9.4.8 in the /usr/local structure going the manual way of downloading, ./configure, make install. Then I removed it and instead installed it with ghcup.
Neither Cabal nor Stack took notice of this, so the ghc-paths build they reused was stale and returned the wrong path.

phadej referenced this issue in goldfirere/singletons Dec 10, 2024
This replaces `singletons-base`'s custom `Setup.hs` script with a `cabal` code
generator. This finally allows `singletons-base` to have a `Simple` build type,
but at the (relatively less extreme) cost of requiring `Cabal-3.8` or later in
order to build.

Remarkably, everything that the custom `Setup.hs` script did can be done in a
much simpler way with a `cabal` code generator, as all of the information that
the `singletons-base` test suite needs to invoke GHC can be inferred from the
arguments passed to a code generator. One downside is that due to
haskell/cabal#8421, the code generator must be
implemented in a standalone executable package
(`singletons-base-code-generator`). Until that `cabal` issue is fixed, we will
need to upload `singletons-base-code-generator` to Hackage with each
`singletons` release.

Fixes #532.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants