Jerry_J has asked for the wisdom of the Perl Monks concerning the following question:

I just received the Martien Verbruggen bood "Graphics Programming with Perl". After reading the first 20 pages, I liked the book and decided to install the GD module. I am running Windows 10 with Active Perl: "perl 5, version 20, subversion 2 (v5.20.2) built for MSWin32-x64-multi-thread" When I try to install GD via cpanm I receive the following:

C:>cpanm GD --> Working on GD Fetching ... + OK Configuring GD-2.71 ... N/A ! Configure failed for GD-2.71. See C:\Users\Jerry\.cpanm\work\1590342 +755.3924\build.log for details.

The build log has the following error:

cpanm (App::cpanminus) 1.7044 on perl 5.020002 built for MSWin32-x64-m +ulti-thread Work directory is C:\Users\Jerry/.cpanm/work/1590342755.3924 You have make C:\Perl64\site\bin\dmake.exe You have LWP 6.44 Falling back to Archive::Tar 2.04 Searching GD () on cpanmetadb ... --> Working on GD Fetching -> OK Unpacking GD-2.71.tar.gz Entering GD-2.71 Checking configure dependencies from META.json Checking if you have ExtUtils::PkgConfig 0 ... Yes (1.16) Checking if you have ExtUtils::Constant 0.22 ... Yes (0.23) Configuring GD-2.71 Running Makefile.PL Notice: Type perl Makefile.PL -h for command-line option summary. 'gdlib-config' is not recognized as an internal or external command, operable program or batch file. 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 449. *** can not find package gdlib *** check that it is properly installed and available in PKG_CONFIG_PA +TH at Makefile.PL line 449. -> N/A -> FAIL Configure failed for GD-2.71. See C:\Users\Jerry\.cpanm\work\1 +590342755.3924\build.log for details.

I searched my computer and the gdlib.pc file is not on my machine. Being very much a novice on debugging these types of errors, I am hoping other can help me with getting this GD module installed. Any help you can provide is appreciated.

Replies are listed 'Best First'.
Re: cpanm GD error
by hippo (Chancellor) on May 26, 2020 at 15:54 UTC

    Did you remember to install libgd first?

      Thanks for the quick reply marto and hippo.

       If I can't get the current install I have of Perl working with GD, I will try Strawberry. My biggest problem is the switch. I have logging scripts that run automatically all times of day and night. Really don't want to switch if it means the machine will be in a transitional phase. 

      Regarding the libgd - no I haven't installed this. By the looks of the link, I need to do something else besides run a CPANM install. libgd doesn't look to be a perl module. 

      I have no experience with trying to install something like this. If there is a binary version of libgd available for an install into Window 10? It didn't look like it from the link. 

      Sorry to be such a novice on this, but these non CPANM installs are beyond my experience level. Any comments on my naive needs?

        libgd is not a Perl module - it's really nothing to do specifically with Perl at all. But it is a graphics library of long repute. The Perl module GD is essentially a Perl wrapper around libgd so without libgd it would be of no use.

        Either you or the systems administrator of your Windows box will need to install libgd if you want to use GD. I can't really help you with that since I've spent the past 30 years avoiding MS Windows. The repo has some instructions here but I can't vouch for them because ... well, Windows.

        Best of luck.

        If your logging is done using the AS Perl, then you can install the portable version of Strawberry perl in parallel so it does not affect things. If you use berrybrew to manage it then you can install multiple versions, which simplifies upgrading and downgrading.

Re: cpnam GD error
by marto (Cardinal) on May 26, 2020 at 15:18 UTC

    Make life easier on yourself, stop using ActiveState perl. Download Strawberry, which already has GD in addition to many other commonly used modules, and a sensible development environment.

      Or better yet, use perl via docker or virtualbox. In looking to see if App::perlbrew worked on windows (couldn't really tell), I found an article about something called berrybrew that's supposed to do the same thing under Strawberry Perl. Usually when I need to do things on windows I: a) cry, then 2) usually end up installing cygwin.

        I've never had any problems using Strawberry Perl, and I've been running it since the beta versions. The Virtualbox route seems needlessly complicated to be, a virtual machine to deal with/manage just to run perl? Docker, you'd need to carefully examine the pros and cons depending on the situation. Regardless Jerry_J was clear that switching to Strawberry was painless.

        Or op could run Linux... There all troll bases covered now
Re: cpnam GD error
by bliako (Prior) on May 27, 2020 at 12:16 UTC

    Although you already managed to solve your problem, just some information on the "missing gdlib.pc" error and clarify that there is nothing scary about it :) It is a text file containing information on how to compile with GD header files and link against the GD library. It is part of the pkg-config system which sorted out the mess of "where to find libraries, headers and what link options to use". It was designed for Linux but now used by other systems too. Most libraries now installed under Linux will contain a ".pc" pkg-config file to be installed in some standard path. A configuration script for compiling and installing an application which requires this "xyz" library will ask "pkg-config" command to find the options and the latter will look in the standard path(s) for file "xyz.pc" and suggest the options. The absense of that file will prompt the error message you got. Which means that the xyz library was not installed or it was installed in non-standard location that pkg-config does not know about but can be searched if user provides the path via an env-variable among other ways. Otherwise, the command pkg-config --libs --msvc-syntax gdlib would have yielded something like gd.lib.

    And yes, just to troll the anonymous monk, "Linux" is the right answer to any question. Here, now all troll bases covered.

    bw, bliako

Re: cpnam GD error
by Anonymous Monk on May 26, 2020 at 19:15 UTC
    GD is what is called "a wrapper." It is a Perl module whose sole purpose is to enable access to an underlying binary library ... which does all of the actual work. Libraries change over time, and Perl does not always keep pace.