Php: Installing GD with freetype no longer working on 7.0 and 7.1

Created on 26 Mar 2018  路  14Comments  路  Source: docker-library/php

Since some time it seems that the documentation in how to install GD into PHP does no longer work with PHP-Versions 7.0-apache and 7.1-apache.

On 7.2 it works.

Only way currently to install GD at all for me is not adding freetype like this:
docker-php-ext-configure gd --with-jpeg-dir=/usr/include/

instead of docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/

libfreetype6-dev is always installed.

the image build just cancels with the message:

configure: error: GD build test failed. Please check the config.log for details.

Issue

Most helpful comment

I just tried to install GD with my script (install-php-extensions gd) both on php:7.0-apache and on php:7.1-apache and it has been installed without problems.
For PHP 7.0 and 7.1, for gd that script basically callls:

apt-get update

apt-get install -y libwebp-dev libjpeg62-turbo-dev libpng-dev libxpm-dev \
    libfreetype6-dev

docker-php-ext-configure gd --with-gd --with-webp-dir --with-jpeg-dir \
    --with-png-dir --with-zlib-dir --with-xpm-dir --with-freetype-dir \
    --enable-gd-native-ttf

docker-php-ext-install gd

(see here and here)

All 14 comments

Try to change version PHP from 7.0-apache to 7.0-fpm.

That would require quite some changes in configuration as i would need another container just for Apache. right?

And since freetype in GD works on PHP:7.2-apache i still consider it a bug.

And also it worked some time ago. Unfortunately i can't exactly say when it worked on 7.1 or 7.0.

I just tried to install GD with my script (install-php-extensions gd) both on php:7.0-apache and on php:7.1-apache and it has been installed without problems.
For PHP 7.0 and 7.1, for gd that script basically callls:

apt-get update

apt-get install -y libwebp-dev libjpeg62-turbo-dev libpng-dev libxpm-dev \
    libfreetype6-dev

docker-php-ext-configure gd --with-gd --with-webp-dir --with-jpeg-dir \
    --with-png-dir --with-zlib-dir --with-xpm-dir --with-freetype-dir \
    --enable-gd-native-ttf

docker-php-ext-install gd

(see here and here)

mhh. I tried to change it similar to what you have (added libxpm-dev + libwebp-dev and removed paths to the --with-xy-dir parameters) But i still get the error
configure: error: GD build test failed. Please check the config.log for details.

Is there some way i can see what got written into that config.log even when the whole container build fails?

Might try to use your script instead of installing it myself. Maybe there is something else different that i am missing.

Is there some way i can see what got written into that config.log even when the whole container build fails?

@lsascha you can try to manually build it inside docker. Simply run
docker run --rm -it php:7.2-apache bash
and you can perform all the operations you want, as well as see the contents of the config.log file.

Might try to use your script instead of installing it myself. Maybe there is something else different that i am missing.

Please let me know if it'll work (it does for me).

Closing, given that we cannot reproduce the issue.

In the future, these sorts of questions/requests would be more appropriately posted to the Docker Community Forums, the Docker Community Slack, or Stack Overflow. Thanks!

Well, here's an example for a Dockerfile that reproduces this issue:

FROM php:7.2-fpm
RUN apt-get update && apt-get install -y \
        libfreetype6-dev \
        libjpeg62-turbo-dev \
        libpng-dev \
    && docker-php-ext-install -j$(nproc) iconv \
    && docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ \
    && docker-php-ext-install -j$(nproc) gd

Yes, this is character by character the suggested Dockerfile from https://docs.docker.com/samples/library/php/#php-core-extensions, and it fails with the error configure: error: freetype-config not found..

Either the image has to be fixed here, or the documentation, but this is indeed a valid and reproducible issue.

Edit: for everyone finding this thread: workaround is to use php:7.2-fpm-stretch.

I have the same issue on php:7.2-apache with the following Dockerfile snippet:

# ...
RUN apt-get install -y \
  # ...
  libwebp-dev \
  libjpeg62-turbo-dev \
  libpng-dev \
  zlib1g-dev \
  libxpm-dev \
  libfreetype6-dev \
  # ...

Followed by

bash RUN docker-php-ext-install iconv \ && docker-php-ext-install json \ && docker-php-ext-install exif \ && docker-php-ext-install mbstring \ && docker-php-ext-install pdo_mysql \ && docker-php-ext-install pdo \ && docker-php-ext-install intl \ && docker-php-ext-install opcache \ && docker-php-ext-install zip \ && docker-php-ext-install bcmath \ && docker-php-ext-install curl \ && docker-php-ext-install soap \ && docker-php-ext-configure gd \ --with-gd \ --with-webp-dir=/usr/include/ \ --with-jpeg-dir=/usr/include/ \ --with-png-dir=/usr/include/ \ --with-xpm-dir=/usr/include/ \ --with-freetype-dir=/usr/include/ \ && docker-php-ext-install gd \ && docker-php-ext-install sockets

I don't know if it helps, but this is the second build we've had break in a week where the work around (as @moqmar suggested) has been to use stretch, could the issue lie with Debian?

FWIW: Our other one was with the Docker Official Image for Rust.

Our builds started to fail on saturday morning 4:00 Berlin - first actually with "unable to locate openjdk-8-jre" - upon removing that package (dev leftovers), it started to fail with configure: error: freetype-config not found.

Really annoying, since fpm is not an option for us right now.

Also - its happening on PHP 7.2 for me. That might be important. ;)

The problem does seem to be that the base image has moved to Debian 10, specifying stretch pins you to Debian 9.

Stretch and Buster are the development names of Debian 9 and 10 respectively.

Please keep discussion of https://github.com/docker-library/php/issues/865 over on https://github.com/docker-library/php/issues/865. This issue is unrelated (and predates Debian Buster by quite some time).

Was this page helpful?
0 / 5 - 0 ratings

Related issues

igodorogea picture igodorogea  路  3Comments

ktrzos picture ktrzos  路  3Comments

ihorsamusenko picture ihorsamusenko  路  4Comments

cmath10 picture cmath10  路  3Comments

cordoval picture cordoval  路  3Comments