Pkg-config woes in Heroku build

I’m trying to deploy an application to Heroku that includes webp among its dependencies, and that requires having libwepb, a non-Haskell library, installed on the system as well.

To make this work I’m using two Heroku build packs: heroku-buildpack-webp-binaries to install libwebp and a fork of heroku-buildpack-stack to install stack and build my app.

Their respective build scripts can be found here:

And here:

However, when I actually try to deploy this application, I get the following error:

webp                             > configure
webp                             > Configuring webp-0.1.0.3...
webp                             > Error: Cabal-simple_6HauvNHV_3.8.1.0_ghc-9.4.7: The pkg-config package
webp                             > 'libwebp' version >=0.6.1 is required but it could not be found.
webp                             > 
Error: [S-7282]

So it can’t find libwebp, however, I believe it is installed in that environment. I even added a webpinfo -version line to the script just to check and it printed: WebP Decoder version: 0.6.1.

Is there something about how pkg-config looks for external dependencies that I should be aware of?

That’s interesting. It seems similar to this issue: Toy GUI project

This was just foolishness on my part. The problem had nothing to do with the way my Haskell application was built. It was actually in the heroku-buildpack-webp-binaries, which itself worked fine but the package it was installing didn’t have a pkgconfig directory with the necessary .pc file. Although libwebp was installed, when I did pkg-config --modversion libwebp I would get:

Package libwebp was not found in the pkg-config search path.
Perhaps you should add the directory containing `libwebp.pc'
to the PKG_CONFIG_PATH environment variable

So I took a different tack and used APT, via heroku-buildpack-apt, to install the right cocktail of dependencies and it worked. Sorry for the false alarm!

1 Like