[php-src] Issue #23004: ext/gd: php86alpha3-gd fails to compile

[email protected] (BjarneDMat) Mon, 3 Aug 2026 10:49:09 +0000
Newsgroups php.bugs
Message-ID <1msheaYAifOxjblEiYjh80bCYmHh75BDlUSZhgJkVhI@main.internal.php.net>
Issue: https://github.com/php/php-src/issues/23004
Author: BjarneDMat

### Description

I can see, that you've completely re-structured the ext/gd code beyween php86alpha2 & php86alpha3
When i try to install php86alpha3-gd, it fails to compile w/ the following errors:
```
/opt/local/var/macports/build/php86-gd-1a751304/work/php-8.6.0alpha3/ext/gd/libgd/gdkanji.c:27:1: error: unknown type name 'iconv_t'
   27 | iconv_t iconv_open(const char *, const char *);
      | ^
/opt/local/var/macports/build/php86-gd-1a751304/work/php-8.6.0alpha3/ext/gd/libgd/gdkanji.c:28:14: error: unknown type name 'iconv_t'
   28 | size_t iconv(iconv_t, ICONV_CONST char **, size_t *, char **, size_t *);
      |              ^
/opt/local/var/macports/build/php86-gd-1a751304/work/php-8.6.0alpha3/ext/gd/libgd/gdkanji.c:29:17: error: unknown type name 'iconv_t'
   29 | int iconv_close(iconv_t);
      |                 ^
/opt/local/var/macports/build/php86-gd-1a751304/work/php-8.6.0alpha3/ext/gd/libgd/gdkanji.c:31:1: error: unknown type name 'iconv_t'
   31 | iconv_t iconv_open(const char *tocode, const char *fromcode)
      | ^
/opt/local/var/macports/build/php86-gd-1a751304/work/php-8.6.0alpha3/ext/gd/libgd/gdkanji.c:35:13: error: use of undeclared identifier 'iconv_t'; did you mean 'const'?
   35 |     return (iconv_t)(-1);
      |             ^~~~~~~
      |             const
/opt/local/var/macports/build/php86-gd-1a751304/work/php-8.6.0alpha3/ext/gd/libgd/gdkanji.c:35:13: error: use of undeclared identifier 'iconv'
/opt/local/var/macports/build/php86-gd-1a751304/work/php-8.6.0alpha3/ext/gd/libgd/gdkanji.c:38:14: error: unknown type name 'iconv_t'
   38 | size_t iconv(iconv_t cd, ICONV_CONST char **inbuf, size_t *inbytesleft, char **outbuf,
      |              ^
/opt/local/var/macports/build/php86-gd-1a751304/work/php-8.6.0alpha3/ext/gd/libgd/gdkanji.c:49:17: error: unknown type name 'iconv_t'
   49 | int iconv_close(iconv_t cd)
      |                 ^
8 errors generated.
```
I've got libiconv installed : 
```
$=> port contents libiconv
Port libiconv @1.19_0 contains:
  /opt/local/bin/iconv
  /opt/local/include/iconv.h
  /opt/local/include/libcharset.h
  /opt/local/include/localcharset.h
  /opt/local/lib/libcharset.1.dylib
  /opt/local/lib/libcharset.a
  /opt/local/lib/libcharset.dylib
  /opt/local/lib/libiconv.2.dylib
  /opt/local/lib/libiconv.a
  /opt/local/lib/libiconv.dylib
  /opt/local/share/doc/libiconv/iconv.1.html
  /opt/local/share/doc/libiconv/iconv.3.html
  /opt/local/share/doc/libiconv/iconv_close.3.html
  /opt/local/share/doc/libiconv/iconv_open.3.html
  /opt/local/share/doc/libiconv/iconv_open_into.3.html
  /opt/local/share/doc/libiconv/iconvctl.3.html
  /opt/local/share/man/man1/iconv.1.gz
  /opt/local/share/man/man3/iconv.3.gz
  /opt/local/share/man/man3/iconv_close.3.gz
  /opt/local/share/man/man3/iconv_open.3.gz
  /opt/local/share/man/man3/iconv_open_into.3.gz
  /opt/local/share/man/man3/iconvctl.3.gz
```
It seems to me as if the whole testing i lines 13..23 is incosistent; in particular : the tests in line 13 & line 18 are different. Should line 19 be moved into the line 13 test & the line 18 test removed 🤔

Platforms tested : 
```
Model Identifier: Mac14,3       macOS 26.5.2 25F84 arm64
Xcode not installed             Command Line Tools 26.6.0.0.1781586589

Model Identifier: MacPro5,1     macOS 15.7.8 24G824 x86_64
Xcode 26.3 17C529               Command Line Tools 26.3.0.0.1.1771626560

Model Identifier: Macmini6,1    macOS 10.15.8 19H2036 x86_64
Xcode 12.4 12D4e                Command Line Tools 12.4.0.0.1.161013581
```


### PHP Version

```plain
PHP 8.6.0alpha3 (cli) (built: Jul 31 2026 19:57:20) (NTS)
Copyright © The PHP Group and Contributors
Zend Engine v4.6.0-dev, Copyright © Zend by Perforce
    with Zend OPcache v8.6.0alpha3, Copyright ©, by Zend by Perforce
```

### Operating System

_No response_