-
Notifications
You must be signed in to change notification settings - Fork 8k
Open
Description
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
php 8.4.13
Operating System
NetBSD