[php-src] Issue #20089: NetBSD: iconv(3) prototype changed in NetBSD 10
| From: | 0-wiz-0 | Date: | Tue, 07 Oct 2025 08:31:51 +0000 |
| Subject: | [php-src] Issue #20089: NetBSD: iconv(3) prototype changed in NetBSD 10 | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-251009@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/20089
Author: 0-wiz-0
### Description
Compiling the iconv module on NetBSD 11.99.3 fails:
```
/scratch/converters/php-iconv/work/php-8.4.13/ext/iconv/iconv.c: In function
'_php_iconv_appendl':
/scratch/converters/php-iconv/work/php-8.4.13/ext/iconv/iconv.c:370:39: error: passing argument 2 of
'iconv' from incompatible pointer type [-Wincompatible-pointer-types]
370 | if (iconv(cd, (ICONV_CONST char **)&in_p, &in_left, (char
**) &out_p, &out_left) == (size_t)-1) {
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
| |
| const char **
```
(and many more similar errors) because NetBSD changed their iconv(3) prototype in NetBSD 10 to
follow
what other operating systems are doing.
The following patch works for me:
```
--- iconv.c.orig 2025-10-07 08:26:27.242448383 +0000
+++ iconv.c
@@ -44,6 +44,10 @@
#endif
#if defined(__NetBSD__)
+#include <sys/param.h>
+#endif
+
+#if defined(__NetBSD__) && (__NetBSD_Version__ < 1000000000)
// unfortunately, netbsd has still the old non posix conformant signature
// libiconv tends to match the eventual system's iconv too.
#define ICONV_CONST const
```
The comment would need to be changed too of course, I'll leave that up to you.
### PHP Version
```plain
php 8.4.13
```
### Operating System
NetBSD