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

Windows: zlib-0.7 now needs MSYS install of zlib system library #6557

Closed
andreasabel opened this issue Apr 20, 2024 · 5 comments
Closed

Windows: zlib-0.7 now needs MSYS install of zlib system library #6557

andreasabel opened this issue Apr 20, 2024 · 5 comments

Comments

@andreasabel
Copy link

andreasabel commented Apr 20, 2024

When bumping to latest Stackage nightly, which has upgraded zlib to 0.7, it seems that on Windows I now need to install the zlib library into MSYS2.

Bumping Stackage nightly to 2024-04-20 upgrades zlib to 0.7, and this needs a pkgconf-supported installation of the zlib system library.
From the changelog at https://hackage.haskell.org/package/zlib-0.7.0.0/changelog:

Make flag pkg-config automatic and on by default.

https://github.com/haskell/zlib/blob/16571cb9731de4be121c729b6b00544b013bd9a2/zlib.cabal#L66-L69

With Stack on Windows, this triggered a build error: https://github.com/agda/agda/actions/runs/8763153892/job/24051720397#step:10:2869

Error: Cabal-simple_9p6GVs8J_3.10.2.0_ghc-9.8.2.exe: The pkg-config package
'zlib' is required but it could not be found.

Installing thezlib library with stack exec -- pacman -S ...-zlib fixed the problem.
b6e154c (#7229)
https://github.com/agda/agda/actions/runs/8763585687/job/24052629583?pr=7229#step:6:122

installing mingw-w64-x86_64-zlib...

Can this be fixed by updating the MSYS2 installation shipped with Stack?

Or should this be fixed elsewhere? E.g. one could turn off the pkg-config flag for zlib in the Stackage snapshots. But this seems not very future-oriented, since the pkgconfig-depends mechanism was to make package descriptions more complete.

Downstream:

See also:

@mpilgrem
Copy link
Member

@andreasabel, the Stack-supplied MSYS2 is, indeed, a 'plain vanilla'/'out of the box' version. If users need specific MSYS2 packages, as you identify, they can install them with pacman in the Stack environment. This is documented at https://docs.haskellstack.org/en/stable/developing_on_windows/#developing-on-windows.

I am reluctant to change that basic approach, but I can extend the online documentation to give zlib >=0.7 as a specific example.

@Bodigrim
Copy link

The problem is that Stack does not distinguish between manual and automatic flags and - for the sake of reproducibility - refuses to do any solving. The only solution I can think of is to bake constraints: zlib -pkg-config into Stackage snapshots. It's not cool, but not a regression in comparison to zlib-0.6 (where pkg-config was off by default).

mpilgrem added a commit that referenced this issue Apr 20, 2024
`--flag zlib:-pkg-config` is required on Windows (as MSYS2 does not provide `pkg-config.exe` 'out of the box') and as there is no mechanism to specify in a Cabal file the flags required by dependencies or to specify flags by operating system using Stack, it has to be set for all operating systems.
@Bodigrim
Copy link

FWIW I second the suggestion for Stack to preinstall pkg-config into its MSYS environment. pkg-config is a more secure and sane way to do things and more packages will benefit from its existence in future.

@mpilgrem
Copy link
Member

mpilgrem commented Apr 20, 2024

@Bodigrim, in that case (your seconding), I'll consult more widely. EDIT: In April 2022, I was of the same mind: #1586 (comment).

@andreasabel
Copy link
Author

bake constraints: zlib -pkg-config into Stackage snapshots.

That would be:

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