What do I do to find and remove the reason for
stack build
...
Progress: 8/188
-- While building package pcre-light-0.4.0.4 using:
...
Configuring pcre-light-0.4.0.4...
setup-Simple-Cabal-1.22.5.0-ghc-7.10.3: parsing output of pkg-config
--modversion failed
When I just cabal install pcre-light, there is no error.
Similar issue reported here: https://github.com/bos/mysql-simple/issues/24
I cannot reproduce the issue, so it must be something with the build environment.
What does stack exec -- which pkg-config say? And which pkg-config?
What about pkg-config --version?
It may also be helpful to use stack build -v --cabal-verbose to get a more detailed log. Please paste that output.
Hi. Thanks for looking into this. I will paste some data below.
The actual "bug" here is that stack says parsing output of pkg-config --modversion failed but does not tell me (even with -v as you described) what this output was, and from what exact call it was obtained.
On reproducibility: I can reproduce the failure on that machine (running some pretty dated Debian). The build works fine (as far as stack is concerned) on machines with a recent Fedora.
What baffles me most is that plain "cabal install pcre-light" works on the "old" machine.
$ stack exec -- which pkg-config
Warning: Specified resolver could not satisfy all dependencies. Some external packages have been added as dependencies.
You can suppress this message by removing it from stack.yaml
/usr/bin/pkg-config
$ which pkg-config
/usr/bin/pkg-config
$ pkg-config --version
0.25
$ pkg-config --modversion libpcre
8.02
$ stack build -v --cabal-verbose
...
Configuring pcre-light-0.4.0.4...
Flags chosen: old_base=False
Dependency base ==4.8.2.0: using base-4.8.2.0
Dependency bytestring ==0.10.6.0: using bytestring-0.10.6.0
setup-Simple-Cabal-1.22.5.0-ghc-7.10.3: parsing output of pkg-config
--modversion failed
There is something wrong in cabal's parser: it apparently cannot handle a leading zero.
When I manually change the version info (in libpcre.pc) from 8.02 to 8.2, then there is no error.
This does occur in cabal-install-1.22.9.0 and in stack-1.0.4.3. (but not in cabal-install-1.23.0.0)
And indeed, the issues seems fixed in Cabal meanwhile, cf. https://github.com/haskell/cabal/commit/6b3457de66772d958fd5fe96066b08e93d0fb0c7#diff-adcdeade4238a28603b5f7083c95ae6e
I am not sure how this affects stack, exactly. I did cabal install stack basically from a plain ghc-7.10.3. The version of Cabal that stack uses, is hard-wired? Since it says setup-Simple-Cabal-1.22.5.0-ghc-7.10.3: ...
I'm experiencing this issue too.
Full output of stack build -v --cabal-verbose: http://lpaste.net/163311
$ cat /Users/rune/IdeaProjects/bitcoin-payment-channel-example/.stack-work/logs/pcre-light-0.4.0.4.log
Configuring pcre-light-0.4.0.4...
Flags chosen: old_base=False
Dependency base ==4.8.2.0: using base-4.8.2.0
Dependency bytestring ==0.10.6.0: using bytestring-0.10.6.0
setup-Simple-Cabal-1.22.5.0-ghc-7.10.3: parsing output of pkg-config
--modversion failed
Output of relevant commands:
$ stack exec -- which pkg-config
/usr/local/bin/pkg-config
$ which pkg-config
/usr/local/bin/pkg-config
$ pkg-config --version
0.29.1
I'm running into this, too.
Andrews-iMac:startupspot andrew$ stack build
pcre-light-0.4.0.4: configure
Progress: 1/4
-- While building package pcre-light-0.4.0.4 using:
/Users/andrew/.stack/setup-exe-cache/x86_64-osx/setup-Simple-Cabal-1.22.5.0-ghc-7.10.3 --builddir=.stack-work/dist/x86_64-osx/Cabal-1.22.5.0 configure --with-ghc=/Users/andrew/.stack/programs/x86_64-osx/ghc-7.10.3/bin/ghc --with-ghc-pkg=/Users/andrew/.stack/programs/x86_64-osx/ghc-7.10.3/bin/ghc-pkg --user --package-db=clear --package-db=global --package-db=/Users/andrew/.stack/snapshots/x86_64-osx/lts-6.1/7.10.3/pkgdb --libdir=/Users/andrew/.stack/snapshots/x86_64-osx/lts-6.1/7.10.3/lib --bindir=/Users/andrew/.stack/snapshots/x86_64-osx/lts-6.1/7.10.3/bin --datadir=/Users/andrew/.stack/snapshots/x86_64-osx/lts-6.1/7.10.3/share --libexecdir=/Users/andrew/.stack/snapshots/x86_64-osx/lts-6.1/7.10.3/libexec --sysconfdir=/Users/andrew/.stack/snapshots/x86_64-osx/lts-6.1/7.10.3/etc --docdir=/Users/andrew/.stack/snapshots/x86_64-osx/lts-6.1/7.10.3/doc/pcre-light-0.4.0.4 --htmldir=/Users/andrew/.stack/snapshots/x86_64-osx/lts-6.1/7.10.3/doc/pcre-light-0.4.0.4 --haddockdir=/Users/andrew/.stack/snapshots/x86_64-osx/lts-6.1/7.10.3/doc/pcre-light-0.4.0.4 --dependency=base=base-4.8.2.0-cc43d8e06aa74e9c4c0132becc49ee25 --dependency=bytestring=bytestring-0.10.6.0-8363d61ddfe397e767bde0e3fed6260e
Process exited with code: ExitFailure 1
Logs have been written to: /Users/andrew/src/startupspot/.stack-work/logs/pcre-light-0.4.0.4.log
Configuring pcre-light-0.4.0.4...
setup-Simple-Cabal-1.22.5.0-ghc-7.10.3: parsing output of pkg-config
--modversion failed
Andrews-iMac:startupspot andrew$
Since it's fixed in Cabal-1.24, one possible approach might be stack setup --upgrade-cabal
@mgsloan that worked great, thank you!
Great!
Pinging @runeksvendsen @jwaldmann , feel free to re-open if this doesn't address it.
Most helpful comment
Since it's fixed in Cabal-1.24, one possible approach might be
stack setup --upgrade-cabal