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.
t/GD……….dubious
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
Solution:
- Install the macports.org port of GD2:
- sudo port install gd2-nox11
- Download the GD CPAN module.
- Build the makefile with
perl Makefile.PL - Now edit the Makefile (not Makefile.PL) to add the following to EXTRALIBS and LDLOADLIBS:
- -L/opt/local/lib -liconv
- Now build with:
- make
- 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!
- No bugs? Install it:
- sudo make install
- 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.
March 17, 2007 at 6:05 pm
Thanks for the comment, I’m glad it helped you. =)
August 28, 2011 at 7:57 pm
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!
January 9, 2013 at 2:58 pm
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).