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 --collect can't find package database #75

Open
noughtmare opened this issue Feb 20, 2021 · 2 comments
Open

cabal-store-gc --collect can't find package database #75

noughtmare opened this issue Feb 20, 2021 · 2 comments

Comments

@noughtmare
Copy link

Running cabal-store-gc --collect yields:

[   0.00076] ghc.info: ghc
[   0.00483] process.0.start: cwd=/tmp ghc --info
[   0.08585] info: Reading global package db
[   0.08606] ghc.read-package-db: /home/jaro/.ghcup/ghc/8.10.4/lib/ghc-8.10.4/package.conf.d
[   0.12203] info: 34 packages in /home/jaro/.ghcup/ghc/8.10.4/lib/ghc-8.10.4/package.conf.d
[   0.12389] info: Reading store package db
[   0.12412] ghc.read-package-db: /home/jaro/.cabal/store/ghc-8.10.4/package.db
[   0.29674] info: 193 packages in /home/jaro/.cabal/store/ghc-8.10.4/package.db
[   0.30614] info: Reading installdir roots
[   0.32144] debug: Found 19 installdir roots from 3 executables
[   0.32233] info: Reading environment roots
[   0.32293] debug: Found 26 environment roots
[   0.32316] info: Reading indirect roots
[   0.33123] debug: Found 26 indirect roots
[   0.33154] info: Found 140 roots
[   0.33202] info: Finding dependencies
[   0.34100] info: 233 components are referenced from the roots
[   0.34497] info: 175 components are in the store
[   0.34521] info: 18 components will be removed from the store
[   0.34548] ghc.find-ghc-pkg: GhcInfo {ghcPath = "ghc", ghcVersion = mkVersion [8,10,4], ghcEnvDir = Path "/home/jaro/.ghc/x86_64-linux-8.10.4/environments", ghcGlobalDb = Path "/home/jaro/.ghcup/ghc/8.10.4/lib/ghc-8.10.4/package.conf.d", ghcLibDir = Path "/home/jaro/.ghcup/ghc/8.10.4/lib/ghc-8.10.4"}
[   0.34651] process.1.start: cwd=/home/jaro/.ghc /home/jaro/.ghcup/ghc/8.10.4/lib/ghc-8.10.4/bin/ghc-pkg --version
[   0.36305] ghc.find-ghc-pkg.result: /home/jaro/.ghcup/ghc/8.10.4/lib/ghc-8.10.4/bin/ghc-pkg
[   0.36351] info: Removing async-2.2.3-236a4dc2f1b240551dae7a0b57a37c7de0b8dd5dcd25a2be0640dfd6e7afc562
[   0.36477] info: Removing attoparsec-0.13.2.5-d25a5dd2588894a14d2bae233a4fcb72e50147763f995af2de858d4af56a4616
[   0.36859] info: Removing case-insensitive-1.2.1.0-b2d0636a493060666e0f9b8b1150344d33f989b7db2023ae885cf27af0400c58
[   0.36988] info: Removing data-fix-0.3.1-08a094bb7b050df795bee7c81792f03ef71fbd8d967ae3a02ce9941882d9ba72
[   0.37083] info: Removing gentle-introduction-2021.1-2174da8667e1c277d3e7bef4326707ece8b0914e633e77ed14c522732b3fe68f
[   0.37184] info: Removing hashable-1.3.1.0-d6843a1c354b03ec345a56de12b120cc2558ac419378e59c75471c08f0c9e3bb
[   0.37330] info: Removing indexed-traversable-instances-0.1-3bd722fa5eb0aab1c992decd8138b22a52c07092075091c20e53561c61e7bfc6
[   0.37450] info: Removing lattices-2.0.2-5392f2233466144065aa296d4087703042d6c46abe97abee50d0b9f6cf4f8a01
[   0.37827] info: Removing optics-extra-0.3-aaba74d59681213761e63b57c695a6d2d4a823157254324f1d294bd1d025b3c7
[   0.38227] info: Removing scientific-0.3.6.2-e93e3f666210ea472bcfba3c150692c34101d365d8ab4de460bde5e83bd421e5
[   0.38406] info: Removing semialign-1.1.0.1-2dea8aa3a90a86fff8db0dbaf5245edc3e6950ae6141f046d88e2872e86de60f
[   0.38563] info: Removing semigroupoids-5.3.5-c5147d3a093fe9110baf508c76e32c407d6bbebd190c66441ffbd1127a0ffc83
[   0.38937] info: Removing serialise-0.2.3.0-45becdd1efe6d655411ea2481fce0bc672a5a22499f62b670cf5d992b0c9c3e2
[   0.39136] info: Removing strict-0.4.0.1-8e4ccb9dcf2e61791c3d3c7ffce9fa64d1460621894c4c6625009e401d5f4032
[   0.39307] info: Removing these-1.1.1.1-1b010073e9d9bbe2950bc05199efccc34e7352eb215c03cd84d116d1e69859c3
[   0.39432] info: Removing unordered-containers-0.2.13.0-25a25c80a274cafa04144e390819c8940e24acb3e26f2c4ae170825b997e9e77
[   0.39655] info: Removing uuid-types-1.0.4-5818046324226ec90721eea4b7822bb4e00d0c3db14e472f609185635b1ac3d1
[   0.39793] info: Removing witherable-0.4.1-7c0f8c80c8257681dd1b8254304a7600b6e462b781a890cddf823350329361c4
[   0.39922] process.2.start: cwd=/home/jaro/.cabal/store /home/jaro/.ghcup/ghc/8.10.4/lib/ghc-8.10.4/bin/ghc-pkg recache --package-db=/home/jaro/.cabal/store/ghc-8.10.4/package.db
[   0.41562] process.2.failed: Exitcode 1
========= stdout ================== stderr =========ghc-pkg: Can't find package database in /home/jaro/.ghcup/ghc/8.10.4/lib/ghc-8.10.4/lib
[   0.41628] peu.die: process check failed

Running the command manually gives the same error:

$ cwd=/home/jaro/.cabal/store /home/jaro/.ghcup/ghc/8.10.4/lib/ghc-8.10.4/bin/ghc-pkg recache --package-db=/home/jaro/.cabal/store/ghc-8.10.4/package.db
ghc-pkg: Can't find package database in /home/jaro/.ghcup/ghc/8.10.4/lib/ghc-8.10.4/lib

But running ghc-pkg manually does work:

$ which ghc-pkg
/home/jaro/.ghcup/bin/ghc-pkg
$ cwd=/home/jaro/.cabal/store ghc-pkg recache --package-db=/home/jaro/.cabal/store/ghc-8.10.4/package.db

So maybe cabal-store-gc does not work nicely in combination with ghcup?

@phadej
Copy link
Owner

phadej commented Feb 20, 2021

Probably related to #31

@ulidtko
Copy link

ulidtko commented Nov 8, 2023

Any idea why GHC ships 2 ghc-pkg executables that behave differently? 🤔

  • $GHCDIST/bin/ghc-pkg-$GHCVER — symlinked from bin/ghc-pkg, this is the one that appears on PATH;
  • $GHCDIST/lib/ghc-$GHCVER/bin/ghc-pkg — another one, that cabal-store-gc tries to call.

... Ah, Ben Gamari explained: the former is a wrapper for the latter, adds appropriate --global-package-db=...

It's weird though, why can't ghc-pkg recache just recache the given package-db and skip trying to load the global one?..


The patch from #99, applied locally, provides a workaround. (As well as manually running ghc-pkg recache).

@phadej #133 implements a fix for this, in the way that you wanted in #99. I'd tested, it does fix the issue. Merge?

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