`cabal` invokes `pkg-config` on every installed package, so `cabal run` or `cabal install` takes 20 minutes on my system
- Dominant language
- Haskell
- Stars
- 1.7k
- Forks
- 750
- Avg merge
- 4d 3h
- Merged PRs (30d)
- 28
Description
**Describe the bug**
Some cabal commands, e.g. `cabal v2-run` take around 20 minutes on my system (on a vanilla unaltered `cabal init` project).
I am using gentoo linux w/ cabal-install 3.6.2.0, ghc 9.2.7.
The reason for the huge runtime seems to be that cabal calls something like `pkg-config --list-all | cut -f 1 -d ' ' | xargs pkg-config --modversion` (see related discussion in pull request #8496). Executing this command explicitly takes around the same time.
The reason for pkg-config to take so long is another matter: In this case there is a library installed with a .pc file that seems to introduce some circular dependencies (see https://github.com/grpc/grpc/issues/29137) which results in much longer waiting times for each library that depends on that "malfunctioning" library, adding up to take around 20 minutes on my system.
It seems to me one should rethink the approach of using `pkg-config --list-all` to retrieve ALL system library versions beforehand. Just one misconfigured system library will hinder cabal to do its job properly, resulting in this absurd situation that cabal requires a fix in an unrelated project (grpc) to work properly.
Contributor guide
Assessment
This issue has not been assessed yet.