Daniel-Diaz/pcre-light

Building a project with pcre-light on Windows fails

Closed this issue · 4 comments

I am running stack setup && stack build in the directory of my project which relies on pcre-light.
On Linux, the project compiles and runs without any problems, but on Windows I get the following message:

Error:
--  While building package pcre-light-0.4.0.4 using:
.....
    Configuring pcre-light-0.4.0.4...
    Cabal-simple_Z6RU0evB_1.24.2.0_ghc-8.0.2.exe: The program 'pkg-config' version
    >=0.9.0 is required but it could not be found.

You'll need to install both pkg-config and pcre for it to work. For example:

Install msys2, here via chocolatey package manager:

choco install msys2

And then in msys2 terminal (msys2.exe):

pacman -Syu
pacman -S mingw-w64-x86_64-pcre
pacman -S mingw-w64-x86_64-pkg-config

The x86_64 build artifacts will then be available for stack to find, back in your regular shell. You'll need to ensure your PATH points at the bin directory they are placed.

You'll need to install both pkg-config and pcre for it to work. For example:

Install msys2, here via chocolatey package manager:

And for those using Windows Subsystem for Linux (WSL), sudo apt-get install pkg-config works.

I guess I can close this. Thanks for providing information on this matter!

Stack also automatically installs msys2 and installing the packages with that version works. For me it's located in ~\AppData\Local\Programs\stack\x86_64-windows\msys2-20180531, the last few digits presumably aren't static.