How to install ext-gd for php7.4 at scrutinizer-ci config?

3k Views Asked by At

After some point, Scrutinizer started permanently failing when trying to analyse Sylius plugins code with next errors:

- sylius/sylius v1.7.3 requires ext-gd * -> the requested PHP extension gd is missing from your system.
- sylius/sylius v1.7.2 requires ext-gd * -> the requested PHP extension gd is missing from your system.
- sylius/sylius v1.7.1 requires ext-gd * -> the requested PHP extension gd is missing from your system.
- sylius/sylius v1.7.0 requires ext-gd * -> the requested PHP extension gd is missing from your system.

Example: https://scrutinizer-ci.com/g/Setono/SyliusPronavicPlugin/inspections/c6ead08f-5fad-405e-b557-9d0adf987c0c

It can't find any of php7.4-gd / php7.0-gd / php-gd packages (I've tried all variants as don't know which Ubuntu is using there) and also it fail if I trying to specify compiler options compile_options: '--enable-gd' (because it looks like rewrite some default options which aren't specified at docs, but required for scrutinizer to run successfully, see https://scrutinizer-ci.com/g/Setono/SyliusPronavicPlugin/inspections/e198ca2c-125d-4d57-b8ef-2314a62c5ecc).

Have someone an idea how to configure Scrutinizer to install ext-gd for php7.4? Official docs is not informative :(

UPD: Looks like Scrutinizer work under old Ubuntu 14.04 (Scrutinizer old Ubuntu 14.04) and there are no php7.4 packages exists for it (googling installing php7.4-gd at ubuntu 14.04 will not give you correct results, so the only way to use ext-gd with php7.4 is provide compile options.

UPD2: See Sam Dark's answer below

Thanks

3

There are 3 best solutions below

0
On

You need to specify GD flags in compile options:

environment:
        php:
            version: 7.4.14
            compile_options: '--with-config-file-path=/home/scrutinizer/.phpenv/versions/7.4.14/etc --with-config-file-scan-dir=/home/scrutinizer/.phpenv/versions/7.4.14/etc/conf.d --prefix=/home/scrutinizer/.phpenv/versions/7.4.14 --libexecdir=/home/scrutinizer/.phpenv/versions/7.4.14/libexec --enable-intl --with-openssl --enable-gd --with-jpeg-dir=/usr --with-png-dir=/usr --with-freetype-dir=/usr --enable-exif --with-libzip --with-zlib --with-zlib-dir=/usr --with-sodium --with-pdo-sqlite --enable-soap --enable-xmlreader --with-xsl --enable-ftp --with-tidy --with-xmlrpc --enable-sysvsem --enable-sysvshm --enable-sysvmsg --enable-shmop --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --enable-pcntl --with-readline --enable-mbstring --with-curl --with-pgsql --with-pdo-pgsql --with-gettext --enable-sockets --with-bz2 --enable-bcmath --enable-calendar --with-libdir=lib --enable-fpm --enable-maintainer-zts --with-gmp --with-kerberos --with-imap --with-imap-ssl --with-apxs2=/usr/bin/apxs --with-ldap --with-pear=/home/scrutinizer/.phpenv/versions/7.4.14/pear'             compile_options: '--with-config-file-path=/home/scrutinizer/.phpenv/versions/7.4.14/etc --with-config-file-scan-dir=/home/scrutinizer/.phpenv/versions/7.4.14/etc/conf.d --prefix=/home/scrutinizer/.phpenv/versions/7.4.14 --libexecdir=/home/scrutinizer/.phpenv/versions/7.4.14/libexec --enable-intl --with-openssl --with-gd --enable-gd --with-jpeg-dir=/usr --with-png-dir=/usr --with-freetype-dir=/usr --enable-exif --with-libzip --with-zlib --with-zlib-dir=/usr --with-sodium --with-pdo-sqlite --enable-soap --enable-xmlreader --with-xsl --enable-ftp --with-tidy --with-xmlrpc --enable-sysvsem --enable-sysvshm --enable-sysvmsg --enable-shmop --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --enable-pcntl --with-readline --enable-mbstring --with-curl --with-pgsql --with-pdo-pgsql --with-gettext --enable-sockets --with-bz2 --enable-bcmath --enable-calendar --with-libdir=lib --enable-fpm --enable-maintainer-zts --with-gmp --with-kerberos --with-imap --with-imap-ssl --with-apxs2=/usr/bin/apxs --with-ldap --with-pear=/home/scrutinizer/.phpenv/versions/7.4.14/pear'
4
On

You need to add ondrej/php repository, update package list and then install php7.4-gd:

sudo add-apt-repository ppa:ondrej/php
sudo apt update
sudo apt-get install php7.4-gd
0
On

For anyone looking to compile php with other extensions on scrutinizer CI with a php8+ version, you will have to use --enable-zts instead of --enable-maintainer-zts:

php:
  version: 8.2.15
  compile_options: '--with-config-file-path=/home/scrutinizer/.phpenv/versions/8.2.15/etc --with-config-file-scan-dir=/home/scrutinizer/.phpenv/versions/8.2.15/etc/conf.d --prefix=/home/scrutinizer/.phpenv/versions/8.2.15 --libexecdir=/home/scrutinizer/.phpenv/versions/8.2.15/libexec --enable-intl --with-openssl --with-gd --enable-gd --with-jpeg-dir=/usr --with-png-dir=/usr --with-freetype-dir=/usr --enable-exif --with-libzip --with-zlib --with-zlib-dir=/usr --with-sodium --with-pdo-sqlite --enable-soap --enable-xmlreader --with-xsl --enable-ftp --with-tidy --with-xmlrpc --enable-sysvsem --enable-sysvshm --enable-sysvmsg --enable-shmop --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --enable-pcntl --with-readline --enable-mbstring --with-curl --with-pgsql --with-pdo-pgsql --with-gettext --enable-sockets --with-bz2 --enable-bcmath --enable-calendar --with-libdir=lib --enable-fpm --enable-zts --with-gmp --with-kerberos --with-imap --with-imap-ssl --with-apxs2=/usr/bin/apxs --with-ldap --with-pear=/home/scrutinizer/.phpenv/versions/8.2.15/pear'