php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #78314 ext gd.so, built & linked with freetype2, missing freetype support/functions
Submitted: 2019-07-20 04:24 UTC Modified: 2019-07-20 14:04 UTC
From: pgnet dot dev at gmail dot com Assigned: remi (profile)
Status: Closed Package: GD related
PHP Version: 7.4.0-dev OS: any
Private report: No CVE-ID: None
 [2019-07-20 04:24 UTC] pgnet dot dev at gmail dot com
Description:
------------
with
```
	php -v
		PHP 7.4.0-dev (cli) (built: Jun 22 2019 21:50:55) ( NTS )
		Copyright (c) The PHP Group
		Zend Engine v3.4.0-dev, Copyright (c) Zend Technologies
		    with Zend OPcache v7.4.0-dev, Copyright (c), by Zend Technologies
```

and freetype2 libs installed
```
	rpm -qa | egrep -i "freetype2|libfreetype"
		libfreetype6-2.10.1-lp151.170.1.x86_64
		freetype2-devel-2.10.1-lp151.170.1.x86_64

	pkg-config --libs --cflags freetype2
		-I/usr/include/freetype2 -lfreetype
```

building ext gd with freetype support
```
	cd /usr/local/src/php7-src/ext/gd
	./configure \
	--enable-shared --disable-static \
	--enable-gd \
	--with-external-gd \
	--with-webp \
	--with-jpeg \
	--with-xpm \
	--with-freetype \
	--with-gnu-ld

		...
		checking for FreeType 2... yes
		...

	make
	make install
```

checking, module 'gd' is installed,
```
	php -m | grep gd
		gd
```

& linked,
```
	ldd gd.so | grep freetype
		libfreetype.so.6 => /usr/lib64/libfreetype.so.6 (0x00007fbcf300b000)
```

but freetype support is not enabled,
```
	php -i
		...
		gd

			GD Support => enabled
			GD headers Version => 2.2.5
			GD library Version => 2.2.5
			GIF Read Support => enabled
			GIF Create Support => enabled
			JPEG Support => enabled
			libJPEG Version => 8
			PNG Support => enabled
			libPNG Version => 1.6.34
			WBMP Support => enabled
			XPM Support => enabled
			libXpm Version => 30411
			XBM Support => enabled
			WebP Support => enabled
			BMP Support => enabled
			TGA Read Support => enabled

			Directive => Local Value => Master Value
			gd.jpeg_ignore_warning => 1 => 1
		...
```

and checking for freetype functions FAILs
```
	php -r 'return function_exists('imagettfbbox') && function_exists('imagettftext');'
		PHP Warning:  Use of undefined constant imagettfbbox - assumed 'imagettfbbox' (this will throw an Error in a future version of PHP) in Command line code on line 1
		Warning: Use of undefined constant imagettfbbox - assumed 'imagettfbbox' (this will throw an Error in a future version of PHP) in Command line code on line 1
```





Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2019-07-20 05:36 UTC] remi@php.net
-Status: Open +Status: Verified
 [2019-07-20 05:57 UTC] remi@php.net
Automatic comment on behalf of remi
Revision: http://git.php.net/?p=php-src.git;a=commit;h=a85e4d53367c9a4ccca09903dce3c7e30dcc04c7
Log: Fixed bug #78314 (missing freetype support/functions with external gd)
 [2019-07-20 05:57 UTC] remi@php.net
-Status: Verified +Status: Closed
 [2019-07-20 10:59 UTC] danack@php.net
-Status: Closed +Status: Not a bug
 [2019-07-20 10:59 UTC] danack@php.net
You're using single quotes around both the code, and also around the strings. I'm not sure exactly what's happening, but PHP is telling you that it is encountering a "undefined constant imagettfbbox". 

Also, returning a boolean doesn't show any output. For debugging, try doing var_dump instead, and use double-quotes for the strings:

php -r 'var_dump( function_exists("imagettfbbox") && function_exists("imagettftext"));'
 [2019-07-20 13:40 UTC] pgnet dot dev at gmail dot com
-Summary: ext gd.so, built & linked with freetype2, missing freetype support/functions +Summary: pgnd -Package: GD related +Package: memcached -Operating System: linux64 +Operating System: any -PHP Version: 7.4.0alpha3 +PHP Version: 5.4.5
 [2019-07-20 13:40 UTC] pgnet dot dev at gmail dot com
The point is there's no "freeetype support",

	php -r 'var_dump(gd_info());'
		array(13) {
		  ["GD Version"]=>
		  string(5) "2.2.5"
		  ["FreeType Support"]=>
>>>		  bool(false)
		  ["GIF Read Support"]=>
		  bool(true)
		  ["GIF Create Support"]=>
		  bool(true)
		  ["JPEG Support"]=>
		  bool(true)
		  ["PNG Support"]=>
		  bool(true)
		  ["WBMP Support"]=>
		  bool(true)
		  ["XPM Support"]=>
		  bool(true)
		  ["XBM Support"]=>
		  bool(true)
		  ["WebP Support"]=>
		  bool(true)
		  ["BMP Support"]=>
		  bool(true)
		  ["TGA Read Support"]=>
		  bool(true)
		  ["JIS-mapped Japanese Font Support"]=>
		  bool(false)
		}
 [2019-07-20 13:42 UTC] pgnet dot dev at gmail dot com
-Status: +Status: Open -Package: memcached +Package: GD related -PHP Version: 5.4.5 +PHP Version: 7.4.0-dev
 [2019-07-20 13:42 UTC] pgnet dot dev at gmail dot com
the point is there's no freetype support,

	php -r 'var_dump(gd_info());'
		array(13) {
		  ["GD Version"]=>
		  string(5) "2.2.5"
		  ["FreeType Support"]=>
!!!		  bool(false)
		  ["GIF Read Support"]=>
		  bool(true)
		  ["GIF Create Support"]=>
		  bool(true)
		  ["JPEG Support"]=>
		  bool(true)
		  ["PNG Support"]=>
		  bool(true)
		  ["WBMP Support"]=>
		  bool(true)
		  ["XPM Support"]=>
		  bool(true)
		  ["XBM Support"]=>
		  bool(true)
		  ["WebP Support"]=>
		  bool(true)
		  ["BMP Support"]=>
		  bool(true)
		  ["TGA Read Support"]=>
		  bool(true)
		  ["JIS-mapped Japanese Font Support"]=>
		  bool(false)
		}
 [2019-07-20 13:47 UTC] cmb@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: cmb
 [2019-07-20 13:47 UTC] cmb@php.net
This has already been fixed Remi (see commit comment note above).
 [2019-07-20 14:04 UTC] requinix@php.net
-Summary: pgnd +Summary: ext gd.so, built & linked with freetype2, missing freetype support/functions -Assigned To: cmb +Assigned To: remi
 [2019-07-21 05:35 UTC] remi@php.net
$ sapi/cli/php  -v
PHP 7.4.0-dev (cli) (built: Jul 20 2019 07:43:46) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0-dev, Copyright (c) Zend Technologies

$ sapi/cli/php  --ri gd

gd

GD Support => enabled
GD headers Version => 2.2.5
GD library Version => 2.2.5
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.34
WBMP Support => enabled
XPM Support => enabled
libXpm Version => 30411
XBM Support => enabled
WebP Support => enabled
BMP Support => enabled
TGA Read Support => enabled

Directive => Local Value => Master Value
gd.jpeg_ignore_warning => 1 => 1
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Mar 28 10:01:26 2024 UTC