haskell / cabal

Official upstream development repository for Cabal and cabal-install
https://haskell.org/cabal
Other
1.62k stars 697 forks source link

Cabal should respect PKG_CONFIG #8526

Open wenkokke opened 2 years ago

wenkokke commented 2 years ago

Describe the bug Cabal should probably respect the PKG_CONFIG environment variable, rather than hard-coding the name "pkg-config", as done in, e.g., Distribution.Simple.Program.Builtin. For instance, mingw packages are moving to use pkgconf, which leads to trouble with Cabal, as pkg-config and pkgconf cannot both be installed.

mouse07410 commented 2 years ago

If memory serves me, PKG_CONFIG env var is used by other package managers, besides Cabal. Thus, relying on it here could be problematic.

gbaz commented 2 years ago

Is that env var documented as a standard anywhere or is it just widespread convention?

mouse07410 commented 2 years ago

I can't recall. Sorry!

arrowd commented 2 years ago

FreeBSD also uses pkgconf but we also install the pkg-config symlink pointing to pkgconf. Maybe MinGW should do the same?

If an utility is intended to be a drop-in replacement and not intended to be coinstalled, I'd rather fix it on the packaging side.

jokeyrhyme commented 3 months ago

I did brew install pkgconf instead of brew install pkg-config and ran into the following problem during cabal install pandoc-cli:

nu ❯ cabal install pandoc-cli
Warning: Unknown/unsupported 'ghc' version detected (Cabal 3.6.2.0 supports
'ghc' version < 9.4): /Users/rwaldon/.ghcup/bin/ghc is version 9.4.8
Warning: Unknown/unsupported 'ghc' version detected (Cabal 3.6.2.0 supports
'ghc' version < 9.4): /Users/rwaldon/.ghcup/bin/ghc is version 9.4.8
Resolving dependencies...
Build profile: -w ghc-9.4.8 -O1
In order, the following will be built (use -v for more details):
 - digest-0.0.2.1 (lib) (requires build)
 - zlib-0.7.1.0 (lib) (requires build)
 - zip-archive-0.4.3.2 (lib) (requires build)
 - streaming-commons-0.2.2.6 (lib) (requires build)
 - JuicyPixels-3.3.9 (lib) (requires build)
 - hslua-module-zip-1.1.3 (lib) (requires build)
 - http-client-0.7.17 (lib) (requires build)
 - conduit-extra-1.3.6 (lib) (requires build)
 - http-client-tls-0.3.6.3 (lib) (requires build)
 - xml-conduit-1.9.1.3 (lib:xml-conduit) (requires build)
 - typst-0.5.0.5 (lib) (requires build)
 - skylighting-core-0.14.2 (lib) (requires build)
 - pandoc-3.2.1 (lib:xml-light) (requires build)
 - citeproc-0.8.1.1 (lib) (requires build)
 - skylighting-format-ansi-0.1 (lib) (requires build)
 - skylighting-format-latex-0.1 (lib) (requires build)
 - skylighting-format-context-0.1.0.2 (lib) (requires build)
 - skylighting-format-blaze-html-0.1.1.2 (lib) (requires build)
 - skylighting-0.14.2 (lib) (requires build)
 - pandoc-3.2.1 (lib) (requires build)
 - pandoc-lua-engine-0.3 (lib) (requires build)
 - pandoc-cli-3.2.1 (exe:pandoc) (requires build)
Starting     zlib-0.7.1.0 (lib)
Starting     digest-0.0.2.1 (lib)

Failed to build digest-0.0.2.1. The failure occurred during the configure
step.
Build log ( /Users/rwaldon/.cabal/logs/ghc-9.4.8/dgst-0.0.2.1-e2b06c6e.log ):
Configuring library for digest-0.0.2.1..
cabal-3.6.2.0-p1: The program 'pkg-config' version >=0.9.0 is required but it
could not be found.

Failed to build zlib-0.7.1.0. The failure occurred during the configure step.
Build log ( /Users/rwaldon/.cabal/logs/ghc-9.4.8/zlb-0.7.1.0-e4067dc5.log ):
Configuring library for zlib-0.7.1.0..
cabal-3.6.2.0-p1: The program 'pkg-config' version >=0.9.0 is required but it
could not be found.

cabal: Failed to build digest-0.0.2.1 (which is required by exe:pandoc from
pandoc-cli-3.2.1). See the build log above for details.
Failed to build zlib-0.7.1.0 (which is required by exe:pandoc from
pandoc-cli-3.2.1). See the build log above for details.

Is every package going to need to be updated individually or is there something that can be done at the cabal level?

Bodigrim commented 3 months ago

@jokeyrhyme both of your issues should be resolved by updating Cabal to 3.10+. Cabal 3.6.2.0, which you use, is very much outdated.

jokeyrhyme commented 3 months ago

@Bodigrim bah, that's embarrassing: my update scripts have been running ghcup install cabal all this time instead of ghcup install cabal latest, oops!

Yep, running ghcup install cabal latest and then cabal install pandoc-cli works perfectly

Cheers! <3