1

I was using Mac OS 12 and Perlbrew with Perl 5.36.

When I install GD using either CPAN or cpanm I get the following error:

cpanm (App::cpanminus) 1.7046 on perl 5.036000 built for darwin-2level
Work directory is /Users/mjb/.cpanm/work/1673722431.48328
You have make /usr/bin/make
You have LWP 6.67
You have /usr/bin/tar: bsdtar 3.5.1 - libarchive 3.5.1 zlib/1.2.11 liblzma/5.0.5 bz2lib/1.0.8 
You have /usr/bin/unzip
Searching install () on cpanmetadb ...
install is up to date. (0.01)
Searching GD () on cpanmetadb ...
--> Working on GD
Fetching http://www.cpan.org/authors/id/R/RU/RURBAN/GD-2.76.tar.gz
-> OK
Unpacking GD-2.76.tar.gz
Entering GD-2.76
Checking configure dependencies from META.json
Checking if you have ExtUtils::Constant 0.22 ... Yes (0.25)
Checking if you have ExtUtils::PkgConfig 0 ... Yes (1.16)
Configuring GD-2.76
Running Makefile.PL
Notice: Type perl Makefile.PL -h for command-line option summary.

Package gdlib was not found in the pkg-config search path.
Perhaps you should add the directory containing `gdlib.pc'
to the PKG_CONFIG_PATH environment variable
No package 'gdlib' found
 at Makefile.PL line 530.
*** can not find package gdlib
*** check that it is properly installed and available in PKG_CONFIG_PATH
 at Makefile.PL line 530.
-> N/A
-> FAIL Configure failed for GD-2.76. See /Users/mjb/.cpanm/work/1673722431.48328/build.log for details.

The above is the contents of build.log. I'm not sure how to investigate further or fix it.

Previously I had Perl's GD install and build using the system Perl. I also have libgd installed from Homebrew and I included /usr/local/lib in the env var PKG_CONFIG_PATH. Still no avail.

Would appreciate help as I rely upon GD for my personal projects. Thanks.

8
  • 2
    Did you try this answer: stackoverflow.com/a/65281748/2173773 Commented Jan 28, 2023 at 15:52
  • Did you install just the library, or the dev files (.h files) too?
    – ikegami
    Commented Jan 28, 2023 at 20:37
  • @HåkonHægland, sorry that didn't work. I have both pkg-config and libgd installed. @ikegami I installed this: formulae.brew.sh/formula/gd#default it appears to be the only gd package on Homebrew. I haven't found any gd.h or gd_color.h files on my Mac.
    – thran
    Commented Jan 28, 2023 at 22:45
  • @thran Can you try to download the tar ball for GD cpan.metacpan.org/authors/id/R/RU/RURBAN/GD-2.76.tar.gz, and then run perl Makefile.PL from the distribution directory? When I do that (macOS 13.1, M1, perlbrew perl 5.34) I get this output: pastebin.com/QHx6vZWr Commented Jan 28, 2023 at 22:53
  • @HåkonHægland I ran it and got the same error message as above. Though when I searched my mac for gdlib.pc it wasn't present - is this file in your system?
    – thran
    Commented Jan 29, 2023 at 12:27

1 Answer 1

2

Found it... something (probably me botching my .zshrc) had unset my $PKG_CONFIG_PATH!

After finding out what pkg-config was and scouring my drive for any telling collection of .pc files, I found gdlib.pc under /usr/local/lib/pkgconfig/gdlib.pc.

Then I simply did an export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig/ and reran the installation. Perl's GD built and installed without grumbling.

A pernanment solution will be to add the above line to your ~/.zshrc.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.