Bug #81217 [Com]: imageavif() fails - Segmentation Fault or No codec available

From: Date: Thu, 26 Aug 2021 14:23:19 +0000
Subject: Bug #81217 [Com]: imageavif() fails - Segmentation Fault or No codec available
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-236085@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=81217&edit=1 ID: 81217 Comment by: pear at laurent-laville dot org Reported by: mlocati at gmail dot com Summary: imageavif() fails - Segmentation Fault or No codec available Status: Open Type: Bug Package: GD related Operating System: Debian Buster and Alpine Linux PHP Version: 8.1.0alpha2 Block user comment: N Private report: N New Comment: This issue is still live with version 8.1.0beta3 Same test procedure, but used docker image php:8.1.0beta3-fpm-buster Previous Comments: ------------------------------------------------------------------------ [2021-07-02 09:39:39] cmb@php.net Hmm, I wonder whether we need to explicitly configure a codec for libavif on some platforms. Apparently, pkg-config doesn't do this here. ------------------------------------------------------------------------ [2021-07-01 15:29:57] mlocati at gmail dot com I tried recompiling gd on Debian Buster after adding libaom: apt-get install -y libfreetype6-dev libjpeg62-turbo-dev libpng-dev libxpm-dev libwebp-dev libavif-dev libaom-dev But php -r 'var_dump(imageavif(imagecreatetruecolor(8, 8), "/tmp/test"));' still gives a Segmentation fault I also tried recompiling gd on Alpine Linux 3.14 after adding aom: apk add freetype-dev libjpeg-turbo-dev libpng-dev libxpm-dev libwebp-dev libavif-dev aom-dev but php -r 'var_dump(imageavif(imagecreatetruecolor(8, 8), "/tmp/test"));' still outputs Warning: imageavif(): avif error - Could not encode image: No codec available in Command line code on line 1 bool(true) (and the generated file is empty) ------------------------------------------------------------------------ [2021-07-01 15:10:55] cmb@php.net Yes, you need a codec for libavif. Try installing libaom. I think we need to do checks for encoding and decoding in config.m4. ------------------------------------------------------------------------ [2021-07-01 15:04:53] mlocati at gmail dot com Description: ------------ I tried the brand new imageavif() function, but I can't make it work. # On Debian Buster Launch a docker container with docker run --rm -it php:8.1.0alpha2-cli-buster bash Run these commands: $ echo 'deb http://deb.debian.org/debian buster-backports main' >/etc/apt/sources.list.d/buster-backports.list $ apt-get update $ apt-get install -y libfreetype6-dev libjpeg62-turbo-dev libpng-dev libxpm-dev libwebp-dev libavif-dev $ docker-php-ext-configure gd --enable-gd --with-webp --with-jpeg --with-xpm --with-freetype --with-avif $ docker-php-ext-install -j$(nproc) gd $ php --ri gd gd GD Support => enabled GD Version => bundled (2.1.0 compatible) FreeType Support => enabled FreeType Linkage => with freetype FreeType Version => 2.9.1 GIF Read Support => enabled GIF Create Support => enabled JPEG Support => enabled libJPEG Version => 6b PNG Support => enabled libPNG Version => 1.6.36 WBMP Support => enabled XPM Support => enabled libXpm Version => 30411 XBM Support => enabled WebP Support => enabled BMP Support => enabled AVIF Support => enabled TGA Read Support => enabled Directive => Local Value => Master Value gd.jpeg_ignore_warning => 1 => 1 $ php -r 'var_dump(imageavif(imagecreatetruecolor(8, 8), "/tmp/test"));' Segmentation fault # On Alpine Linux 3.14 Launch a docker container with docker run --rm -it php:8.1.0alpha2-cli-alpine3.14 sh Run these commands: $ apk add freetype-dev libjpeg-turbo-dev libpng-dev libxpm-dev libwebp-dev libavif-dev $ docker-php-ext-configure gd --enable-gd --with-webp --with-jpeg --with-xpm --with-freetype --with-avif $ docker-php-ext-install -j$(nproc) gd $ php --ri gd gd GD Support => enabled GD Version => bundled (2.1.0 compatible) FreeType Support => enabled FreeType Linkage => with freetype FreeType Version => 2.10.4 GIF Read Support => enabled GIF Create Support => enabled JPEG Support => enabled libJPEG Version => 8 PNG Support => enabled libPNG Version => 1.6.37 WBMP Support => enabled XPM Support => enabled libXpm Version => 30411 XBM Support => enabled WebP Support => enabled BMP Support => enabled AVIF Support => enabled TGA Read Support => enabled Directive => Local Value => Master Value gd.jpeg_ignore_warning => 1 => 1 $ php -r 'var_dump(imageavif(imagecreatetruecolor(8, 8), "/tmp/test"));' Warning: imageavif(): avif error - Could not encode image: No codec available in Command line code on line 1 bool(true) $ php -r 'var_dump(filesize("/tmp/test"));' int(0) ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=81217&edit=1

« previous php.bugs (#236085) next »