Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

GD giving me the error "libgd was not built with FreeType font support"

by PacoH (Initiate)
on Dec 18, 2013 at 00:36 UTC ( #1067561=perlquestion: print w/ replies, xml ) Need Help??
PacoH has asked for the wisdom of the Perl Monks concerning the following question:

I am trying to run a perl script, that was created in the Windows environment a while ago, on OS X Mountain Lion. I have installed the latest version of perl, perl-5.18.1, via perlbrew and installed the modules I needed, including PDF::API2, and GD. I installed libgd via homebrew. I am getting the error:

"libgd was not built with FreeType font support"

I don't understand this because it looks as if libgd WAS built with FreeType font support:

'brew info libgd' gd: stable 2.1.0, HEAD http://libgd.bitbucket.org/ /usr/local/Cellar/gd/2.1.0 (33 files, 1.7M) * Built from source with: --with-freetype, --with-libvpx, --with-libti +ff From: https://github.com/mxcl/homebrew/commits/master/Library/Formula/ +gd.rb ==> Dependencies Recommended: libpng, jpeg Optional: freetype, libtiff, libvpx

My code includes the path to the system fonts.

my $fontdir = '/Library/Fonts/'; my $typeface = 'Arial.ttf';

This is the line that the error is referring to:

$gd_text->set_font("$fontdir$typeface", $fsize) or die $gd_text->error;

This worked perfectly on Windows. All I did was change the path for OS X. Are TrueType fonts considered to be FreeType fonts?

This is what I've got in my .bash_profile:

export PATH=/usr/local/bin:$PATH export PATH=$PATH:$HOME/bin export PS1='\w : \u$ ' source ~/perl5/perlbrew/etc/bashrc export PERLBREW_ROOT=/opt/perl5 source ${PERLBREW_ROOT}/etc/bashrc

Did I leave anything out?

My path:

/Users/user/perl5/perlbrew/bin:/Users/user/perl5/perlbrew/perls/perl-5.18.1/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/opt/ImageMagick/bin:/Users/user/bin

How to solve this problem?

Comment on GD giving me the error "libgd was not built with FreeType font support"
Select or Download Code
Re: GD giving me the error "libgd was not built with FreeType font support"
by Anonymous Monk on Dec 18, 2013 at 00:51 UTC

      I already did re-install libgd after I read that thread even though brew showed freetype as installed. Didn't work.

      The only thing I can think of is I did try installing GD with cpan before installing it with cpanm and it could not make so I force installed it. Maybe there's some leftover crap somewhere that is messing things up?

      cpan -t GD

      ** WARNING: found gd.h header file in /usr/local/includegd.h, but it is expected at /usr/local/Cellar/gd/2.1.0/include/gd.h. This may cause compile errors! **

        I tried uninstalling GD using pm-uninstall. When I ran

        cpan -t GD

        I got the same warning but it turns out that /usr/local/include/gd.h is just a symlink to the Cellar gd.h

        I tried installing GD again with cpanm and got test errors:

        Failed 1/2 test programs. 7/13 subtests failed. make: *** [test_dynamic] Error 255 Retry with --force to force install it.

        I did a force install and now I'm not getting original error but I am getting this error:

        Can't call method "val" on an undefined value at /Users/user/perl5/perlbrew/perls/perl-5.18.1/lib/site_perl/5.18.1/PDF/API2/Resource/XObject/Image.pm line 66.

        I don't know if this is related to the failed tests.

Re: GD giving me the error "libgd was not built with FreeType font support"
by zentara (Archbishop) on Dec 18, 2013 at 17:20 UTC
    libgd was not built with FreeType font

    Then download the libgd for your library version levels, and build it yourself. It is usually as simple as ./configure; make install" on linux systems with their free compilers.


    I'm not really a human, but I play one on earth.
    Old Perl Programmer Haiku ................... flash japh

      Actually I have had many problems trying to hand compile CPAN modules, especially GD. It's usually preferable to let cpan do it.

      OK, I ran the script with debug enabled and I found that the error was due to a string that concatenated a file name to a directory name. It added the Windows '\' to the directory path. All is working fine now. Thanks everyone for your help.

      To summarize, the fix for the problem was to uninstall/re-install libgd and the GD module:

      Uninstall/re-install libgd:

      brew uninstall libgd brew install libgd --with-freetype --with-libtiff --with-libvpx brew info libgd

      I added libtiff and libvpx support in case I ever need it but I don't believe they are necessary in this case.

      Install pm-uninstall:

      cpan App::pmuninstall

      Uninstall/re-install GD:

      pm-uninstall GD cpanm GD

      If tests fail:

      cpanm -f GD

      Force install only if tests fail. This is not optimal for certain, but it did work in this case. GD is notoriously difficult to install.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://1067561]
Approved by boftx
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (7)
As of 2014-12-27 20:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (177 votes), past polls