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

cabal-store-gc: ghc-pkg: Can't find package database in /home/hasufell/.ghcup/ghc/8.10.7/lib/ghc-8.10.7/lib #98

Closed
hasufell opened this issue Oct 1, 2021 · 2 comments

Comments

@hasufell
Copy link
Contributor

hasufell commented Oct 1, 2021

Log:

$ cabal-store-gc -w ghc-8.10.7 --collect                                                                                                              Fri 14:43
[   0.00002] ghc.info: ghc-8.10.7
[   0.00057] process.0.start: cwd=/tmp ghc-8.10.7 --info
[   0.07012] info: Reading global package db
[   0.07045] ghc.read-package-db: /home/hasufell/.ghcup/ghc/8.10.7/lib/ghc-8.10.7/package.conf.d
[   0.10394] info: 34 packages in /home/hasufell/.ghcup/ghc/8.10.7/lib/ghc-8.10.7/package.conf.d
[   0.10729] info: Reading store package db
[   0.10750] ghc.read-package-db: /home/hasufell/.cabal/store/ghc-8.10.7/package.db
[   1.13300] info: 1084 packages in /home/hasufell/.cabal/store/ghc-8.10.7/package.db
[   1.17986] info: Reading installdir roots
[   1.18070] debug: Found 9 installdir roots from 1 executables
[   1.18109] info: Reading environment roots
[   1.18129] debug: Found 0 environment roots
[   1.18147] info: Reading indirect roots
[   1.27710] debug: Found 0 indirect roots
[   1.27729] info: Found 1615 roots
[   1.28278] info: Finding dependencies
[   1.40924] info: 1615 components are referenced from the roots
[   1.49693] info: 1084 components are in the store
[   1.49734] info: 0 components will be removed from the store
[   1.49762] ghc.find-ghc-pkg: GhcInfo {ghcPath = "ghc-8.10.7", ghcVersion = mkVersion [8,10,7], ghcEnvDir = Path "/home/hasufell/.ghc/x86_64-linux-8.10.7/environments", ghcGlobalDb = Path "/home/hasufell/.ghcup/ghc/8.10.7/lib/ghc-8.10.7/package.conf.d", ghcLibDir = Path "/home/hasufell/.ghcup/ghc/8.10.7/lib/ghc-8.10.7"}
[   1.49854] process.1.start: cwd=/home/hasufell/.ghc /home/hasufell/.ghcup/ghc/8.10.7/lib/ghc-8.10.7/bin/ghc-pkg --version
[   1.51421] ghc.find-ghc-pkg.result: /home/hasufell/.ghcup/ghc/8.10.7/lib/ghc-8.10.7/bin/ghc-pkg
[   1.51459] process.2.start: cwd=/home/hasufell/.cabal/store /home/hasufell/.ghcup/ghc/8.10.7/lib/ghc-8.10.7/bin/ghc-pkg recache --package-db=/home/hasufell/.cabal/store/ghc-8.10.7/package.db
[   1.53053] process.2.failed: Exitcode 1
========= stdout ================== stderr =========ghc-pkg: Can't find package database in /home/hasufell/.ghcup/ghc/8.10.7/lib/ghc-8.10.7/lib
[   1.53117] peu.die: process check failed
findGhcPkg
    :: (MakeGhcTracer t, MakePeuTracer t, MakeProcessTracer t)
    => Tracer (Peu r) t -> GhcInfo -> Peu r FilePath
findGhcPkg tracer ghcInfo = do
    tracer' <- makeGhcTracer tracer
    traceWith tracer' $ TraceGhcFindGhcPkg ghcInfo

    let guess = toFilePath $ ghcLibDir ghcInfo </> fromUnrootedFilePath "bin/ghc-pkg"

    ghcDir   <- getAppUserDataDirectory "ghc"
    verBS <- LBS.toStrict <$> runProcessCheck tracer ghcDir guess ["--version"]

    let expected = "GHC package manager version " ++ prettyShow (ghcVersion ghcInfo)
        actual   = trim $ fromUTF8BS verBS
    if actual == expected
    then do
        traceWith tracer' $ TraceGhcFindGhcPkgResult guess
        return guess
    else die tracer $ guess ++ " --version returned " ++ actual ++ "; expecting " ++ expected

It should find /home/hasufell/.ghcup/ghc/8.10.7/bin/ghc-pkg, not /home/hasufell/.ghcup/ghc/8.10.7/lib/ghc-8.10.7/bin/ghc-pkg.

@hasufell
Copy link
Contributor Author

hasufell commented Oct 1, 2021

Relevant: haskell/cabal#7390

@phadej
Copy link
Owner

phadej commented Oct 1, 2021

Duplicate of #31

@phadej phadej marked this as a duplicate of #31 Oct 1, 2021
@phadej phadej closed this as completed Oct 1, 2021
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

Successfully merging a pull request may close this issue.

2 participants