How to Fix Configure: Error: Freetype-Config Not Found PHP Compile

Issue

While compiling PHP from source on CentOS server, we get the error below:

checking for jpeg_read_header in -ljpeg... yes
checking for png_write_image in -lpng... yes
If configure fails try --with-xpm-dir=<DIR>
configure: error: freetype-config not found.

The root of the problem is we’ve enabled this option –with-freetype-dir.

./configure --prefix=/usr/local/php7 \
    --with-config-file-path=/usr/local/php7/etc \
    --with-config-file-scan-dir=/usr/local/php7/etc/conf.d \
    --enable-bcmath \
    ...
    --with-freetype-dir \
    --with-jpeg-dir

Solution

In this, we have to install the dependencies packages as follows:

sudo yum -y install freetype*
# yum list installed | grep freetype
freetype.x86_64                      2.8-14.el7_9.1                 @updates
freetype-demos.x86_64                2.8-14.el7_9.1                 @updates
freetype-devel.x86_64                2.8-14.el7_9.1                 @updates

And then try to re-compile PHP from source and it should be able to compile this time.

Leave a Comment

Required fields are marked *