views:

756

answers:

2

I'm compiling PHP5.2.9 on Mac OS X 10.5.6. Need some help to figure this out.

I have PHP compiling and working with a basic config, and now I'm trying to compile with GD2. The problem I'm running into is that if I add the argument to build with Freetype, I get build errors. This is my minimum config to demo the problem. Also, I know that there are other requirements for libjpeg/libpng, etc. I'm not including those right now to make this simpler.

sudo ./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/conf/php \
--enable-fastcgi \
--with-freetype-dir=/usr/local \
--with-gd

Error:

checking for FT_New_Face in -lfreetype... no
configure: error: Problem with freetype.(a|so). Please check config.log for more information.

This is from the error log:

configure:36779: gcc -o conftest  -gstabs  -no-cpp-precomp -Wl,-rpath,/usr/loca$
Undefined symbols:
  "_FT_New_Face", referenced from:
      _main in ccgzHTP6.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
configure: failed program was:
#line 36768 "configure"
#include "confdefs.h"
/*     Override any gcc2 internal prototype to avoid an error.  */
/* We use char because int might match the return type of a gcc2
    builtin and then its argument prototype would still apply.  */

I have freelib-2.1.3 built from source and installed at /usr/local/, as I defined in the --with-freetype-dir argument. I think its telling me its trying to find a font file, but I'm not sure when or if such a font is being installed.

If I build without Freetype, GD2 will build and install but I want to have Freetype capability on my system. The following is my complete config setup with Freetype option(the one that's failing!)

sudo ./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/conf/php --enable-fastcgi \
--with-jpeg-dir=/usr/local \
--with-png-dir=/usr/local \
--with-zlib-dir=/usr/local \
--enable-gd-native-ttf \
--with-tlib=/usr/local \
--with-freetype-dir=/usr/local \
--with-xpm-dir=/usr/X11R6 \
--with-gd
+1  A: 

Ok, did something really stupid. I've forgotten exactly where I downloaded Freetype2 from, but the 2.1.3 version is YEARS out of date. I just updated to 2.3.9 and it freaking compiles perfectly. Bleh.

Be warned, fellow Google searchers. Step one to troubleshooting is to make sure you're using the most recent release versions of your requirements.

Geuis
A: 

Installing a custom version of PHP including desired extensions can be a challenge. An alternative to compiling everything from scratch is using MacPorts which provides the right source files, dependencies and fully automates the configure, make and make install process.

In the MacPorts port collection, the latest version of PHP and pretty much all extensions and tools are present. When a new version of PHP is released, it usually finds its way into MacPorts pretty soon, allowing to upgrade your installed version very easily.

If you do LAMP / MAMP development, MacPorts also provides the latest Apache and MySQL server versions.

Bas Peters