You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
NetBSD: iconv(3) prototype changed in NetBSD 10 #20089
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.
quick question, I ve not touched netbsd since couple of months however I believe there is the system's libiconv and the pkgsrc one correct ? If that s the case which one are you using ? I may have a look later otherwise.
Another simple approach is to remove the "iconv const check" and always cast the argument to void * which will then be implicitly converted to either char ** or const char **.
Activity
devnexen commentedon Oct 7, 2025
quick question, I ve not touched netbsd since couple of months however I believe there is the system's libiconv and the pkgsrc one correct ? If that s the case which one are you using ? I may have a look later otherwise.
0-wiz-0 commentedon Oct 7, 2025
That's with the native iconv(3) implementation.
From NetBSD 10 onwards, they both use the same interface.
NattyNarwhal commentedon Oct 7, 2025
If I may toot my own horn, GH-16847 should handle this more gracefully.
nwellnhof commentedon Oct 8, 2025
Another simple approach is to remove the "iconv const check" and always cast the argument to
void *which will then be implicitly converted to eitherchar **orconst char **.petk commentedon Oct 15, 2025
Same warning happens also on Solaris 11.4. Solaris 10 and some illumos-based distributions need the
constin there.NattyNarwhal commentedon Oct 29, 2025
GH-20247 is merged and should fix this. Reopen if this still needs work.