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

Do not use pkg-config to locate zlib on FreeBSD #13

Merged
merged 1 commit into from Mar 12, 2023

Conversation

arrowd
Copy link

@arrowd arrowd commented Mar 12, 2023

FreeBSD has zlib in its base system, so it is guaranteed to be present. At the same time it doesn't provide a .pc file, so Cabal fails to fullfill the pkgconfig-depends: zlib dependency.

FreeBSD has zlib in its base system, so it is guaranteed to be present.
At the same time it doesn't provide a .pc file, so Cabal fails to fullfill the
`pkgconfig-depends: zlib` dependency.
@TeofilC
Copy link
Owner

TeofilC commented Mar 12, 2023

Thanks @arrowd !

@TeofilC TeofilC merged commit 5148270 into TeofilC:main Mar 12, 2023
4 checks passed
@arrowd
Copy link
Author

arrowd commented Mar 12, 2023

May I also ask you to make a new Hackage release ASAP?
Right now, when packaging any Haskell application that transitively uses digest for FreeBSD, it fails due to not finding zlib.

@arrowd arrowd deleted the patch-1 branch March 12, 2023 14:00
@TeofilC
Copy link
Owner

TeofilC commented Mar 12, 2023

Sure, no worries. Here's the release: https://hackage.haskell.org/package/digest-0.0.1.7

@arrowd
Copy link
Author

arrowd commented Mar 12, 2023

Fantastic, thanks for the quick resolution!

@rybak
Copy link

rybak commented Apr 12, 2023

Disclaimer: I'm not very familiar with Stack and Cabal, I'm just trying to compile a Haskell project.

Is it possible that the same problem described above for FreeBSD is present on Ubuntu?

I was trying to build master branch of a project using stack and I got:

$ stack build
[...]
digest                       > configure                                                                  
digest                       > Configuring digest-0.0.1.4...                                              
digest                       > Cabal-simple_SvXsv1f__3.6.3.0_ghc-9.2.5: The pkg-config package 'zlib' is  
digest                       > required but it could not be found.                                        
digest                       >                                                                            
[...]
Error: [S-7282]
       Stack failed to execute the build plan.
       
       While executing the build plan, Stack encountered the following errors:
       
       [S-7011]
       While building package digest-0.0.1.4 (scroll up to its section to see the error) using:

After checking and finding that digest has a newer version, I've upgraded from resolver: lts-20.8 to resolver: lts-20.17, but I got the same error with digest-0.0.1.7:

digest                           > configure                                                           
digest                           > Configuring digest-0.0.1.7...                                     
digest                           > Cabal-simple_SvXsv1f__3.6.3.0_ghc-9.2.7: The pkg-config package 'zlib' is
digest                           > required but it could not be found.           
digest                           >                                               
[...]
Error: [S-7282]
       Stack failed to execute the build plan.
       
       While executing the build plan, Stack encountered the following errors:
       
       [S-7011]
       While building package digest-0.0.1.7 (scroll up to its section to see the error) using:

So I went to an older commit of the project I'm trying to compile, which uses resolver: lts-20.4, which seems to pick up digest-0.0.1.3, and the build failure went away. According to CHANGELOG.md, version 0.0.1.4 was the one that changed the way zlib was found.

@TeofilC
Copy link
Owner

TeofilC commented Apr 12, 2023

It should work fine on Ubuntu. Make sure you have pkg-config and the zlib development packages installed.
On my ubuntu machine I can run the following command with no problem:

 pkg-config zlib --version

@rybak
Copy link

rybak commented Apr 12, 2023

Make sure you have pkg-config and the zlib development packages installed.

Searching for the error message turned up this similar sounding issue, so making sure that I have the -dev package of zlib was actually the first thing I did. As it turns out, Ubuntu package haskell-platform actually depends on zlib1g-dev.

Another story for pkg-config , however. To my shame, trying to build this project is the first time I learned about existence of pkg-config. Indeed, after a sudo apt install pkg-config the build is successful. Thank you very much! :-D

Why didn't Stack complain about pkg-config not being installed? From my inexperienced reading of the build log it seems as though it was an error reported by pkg-config. It seems that Stack can complain about missing pkg-config.

Even better, why doesn't Stack install a snapshot of pkg-config on its own like it does with GHC? I thought that Stack was all about snapshots and sandboxing and such.

I guess both of those are questions to developers of Stack, though. Or maybe developers of Nix, I can't tell :-/

P.S. After some poking at apt it seems that I had the 32 bit version of pkg-config installed, so that might have been the root cause.

netbsd-srcmastr pushed a commit to NetBSD/pkgsrc that referenced this pull request Oct 27, 2023
0.0.1.7 — 5th March 2023
* Don't use 'pkg-config' to locate zlib on FreeBSD (Thanks to @arrowd):
  TeofilC/digest#13

0.0.1.6 — 5th March 2023
* Introduce 'pkg-config' cabal flag (Thanks to @jonathanlking):
  TeofilC/digest#11
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

Successfully merging this pull request may close these issues.

None yet

3 participants