What Jessie Did Next...

...being the inane ramblings of a mundane Yorkshire bird.

This morning I couldn’t sleep, so got up to sort a few things out – one of those needed Thomas Boutell’s GD library which I don’t have installed on the MBP. I’ve had a bit of hassle sorting it out so this is pretty much Google-bait for those who have had the same problem and are looking for a resolution.

There’s an installation in macports.org, under gd2-nox11. This installs the libraries, but perl has a problem getting its own GD.pm installed via CPAN:

Running make test
PERL_DL_NONLAZY=1 /usr/bin/perl “-MExtUtils::Command::MM” “-e” “test_harness(0, ‘blib/lib’, ‘blib/arch’)” t/*.t
t/GD……….Can’t load ‘./blib/arch/auto/GD/GD.bundle’ for module GD: dlopen(./blib/arch/auto/GD/GD.bundle, 2): Symbol not found: _libiconv_close
Referenced from: /opt/local/lib/libgd.2.dylib
Expected in: flat namespace
at t/GD.t line 14
Compilation failed in require at t/GD.t line 14.
BEGIN failed–compilation aborted at t/GD.t line 14.
Test returned status 255 (wstat 65280, 0xff00)
DIED. FAILED tests 1-12
Failed 12/12 tests, 0.00% okay

A bit of digging turned up that Macports GD2 port has a broken gdlib-config, which confuses matters and makes sure iconv can’t be found. This was causing make test to fail, meaning GD.pm itself was useless.


  1. Install the macports.org port of GD2:
    sudo port install gd2-nox11
  2. Download the GD CPAN module.
  3. Build the makefile with perl Makefile.PL
  4. Now edit the Makefile (not Makefile.PL) to add the following to EXTRALIBS and LDLOADLIBS:
    -L/opt/local/lib -liconv
  5. Now build with:
  6. Now test (optional):
    make test

    At this point the following command shouldn’t give you any errors – if it does, the gdlib-config bug isn’t the problem!

  7. No bugs? Install it:
    sudo make install
  8. Job done – make a cup of tea

Thanks to Pascal’s Phase of Matter blog and this thread on Usenet for pointing me in the right direction.


  1. Thanks for the comment, I’m glad it helped you. =)

  2. Carefull, nowadays (2011) that doesn’t work that way anymore. The package to install wit macports is "p5.12-gd" or the version that matches your perl!

  3. Hi – Thanks so much for sharing this. I was going crazy trying to get GD to install under 10.8. This was the only method that worked for me. One thing I noticed was that the GD CPAN module that is downloaded in step 2 no longer requires the editing you discuss in step 4. It seems to be included in the latest version (2.46).

Leave a Reply

Your email address will not be published.


This site uses Akismet to reduce spam. Learn how your comment data is processed.