Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Help recompiling gdlib

Hello,

I am trying to get Freetype support for GD. When I run gdlib-config --all, it returns:

GD library 2.0.34
includedir: /usr/include
cflags: -I/usr/include
ldflags:
libs: -lpng -lz -liconv
libdir: /usr/lib
features: GD_PNG GD_GIF GD_GIFANIM GD_OPENPOLYGON


...indicating no support for Freetype. Does anyone have information on how to recompile gdlib on Snow Leopard?


Thanks!

Andrew

Macbook Pro Intel Core i7, Mac OS X (10.6.7)

Posted on Apr 14, 2011 8:01 PM

Reply
29 replies

Apr 14, 2011 9:25 PM in response to Linc Davis

The goal is to work with a visualization software called Circos: http://mkweb.bcgsc.ca/circos/
I have all of the requisite Perl modules installed, but when I run a diagnostic test on GD, a picture results, but there is no text where there should be.

I was told that indicates that my install of GD (2.45) does not support Freetype. The suggested solution was to recompile my gdlib, since it was not compiled with Freetype.

Apr 15, 2011 5:00 AM in response to Linc Davis

Linc Davis wrote:
I have port gd2 installed, version 2.0.35, and it supports freetype. I don't know exactly what it does, but it certainly builds. Why is that not a solution to the OP's problem?


Does it work? From what I understand, Freetype supports MacOSX fonts, but that logic is incompatible with other parts of GD and/or PHP. So, in order to build it for GD and PHP on MacOSX, you have to disable the MacOSX font logic and build it with support for only X11 fonts. If you are aware of that and don't expect to be able to use your system fonts, it should work fine.

Apr 15, 2011 5:41 AM in response to garberal

garberal wrote:
etresoft, if it means losing my system fonts, that may not be a tradeoff I'm willing to take. I need fonts for the type of work I do.


You have fonts, they are just the X11 fonts. That is usually adequate for things people use GD and PHP for. Still, it might be worth trying to compile it again. It may have had improvements since the last time I looked at it.

Apr 15, 2011 8:14 AM in response to garberal

garberal wrote:
Thanks for the help. If I need to go through those steps from the link you sent earlier, by modifying PHP and Apache, I'll probably break my computer.


That is a a possibility. You can install a new, self-contained Apache/PHP/etc. with XAMPP: http://www.apachefriends.org/en/xampp-macosx.html

That is probably the easiest, least invasive way to get GD running with freetype support.

MacPorts will work too. It does something similar to XAMPP, only it isn't as self-contained. It will squirrel away new versions of PHP and maybe Apache in /opt or somewhere.

Neither method will replace any built-in software. XAMPP is definitely more self-contained.

Apr 15, 2011 10:03 AM in response to garberal

garberal wrote:
The goal is to work with a visualization software called Circos: http://mkweb.bcgsc.ca/circos/
I have all of the requisite Perl modules installed, but when I run a diagnostic test on GD, a picture results, but there is no text where there should be.


Wait. You aren't trying to run PHP. You are trying to use GD by itself with Perl. That is an entirely different matter.

I was told that indicates that my install of GD (2.45) does not support Freetype. The suggested solution was to recompile my gdlib, since it was not compiled with Freetype.


Unfortunately, GD seems to be a truly horrible, unsupported, and unmaintained library. It doesn't even have a web site and about the only way to get it is as part of PHP. Let me see what I can do with it...

Apr 15, 2011 10:34 AM in response to garberal

First of all - a question. What have you already installed? The only gd I have is the bundled one from PHP. I don't have any gdlib-config at all. The instructions below assume there isn't any standalone gd installed on your system.

OK. Here is what you do:

1) Download the source for libgd from: https://bitbucket.org/pierrejoye/gd-libgd/overview
2) Extract the tar ball
3) Edit the file src/configure.ac and remove the 4 lines that start with 'AM_ICONV'
4) Go into the src directory and run: "ln -s ../config config" and "ln -s ../test test"
5) Now (still in src) run "sh bootstrap.sh"
6) Now (still in src) run "autoreconf -fvi"
(Hopefully you have had no errors by this point)
7) Now (still in src) run "./configure"

On my machine, I am running 10.6.7 with Xcode3 and Xcode4 installed. In the past, I have installed a fair number of funky Perl modules. After running "./configure", my system reports:

Support for PNG library: yes
Support for JPEG library: yes
Support for Freetype 2.x library: yes
Support for Fontconfig library: yes
Support for Xpm library: yes
Support for pthreads: yes

If yours doesn't say the same thing, you may have to go back and install some prerequisites.

8) Run "make"
9) Run "sudo make install"

At this point, you have a standalone libgd installed in /usr/local. If you build all of your Perl modules, they should find that automatically. I don't know what GD they found before.

Help recompiling gdlib

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.