Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: Windows 10 + msys2 (with winiconv): passing argument 2 of 'iconv' from incompatible pointer type #762

Closed
vtorri opened this issue May 19, 2024 · 2 comments

Comments

@vtorri
Copy link
Contributor

vtorri commented May 19, 2024

libass version

0.17.2

Is it a regression?

yes (0.17.1 was fine)

How did you invoke configure?

CPPFLAGS="$CPPFLAGS -I$HOME/ewpi_64/include -I$HOME/ewpi_64/include/fribidi -I$HOME/ewpi_64/include/freetype2 -I$HOME/ewpi_64/include/harfbuzz" ./configure --prefix=$3 --host=$4 --disable-static

System Information

Window 10, using MSYS2+ mingw-w64

Toolchain

x86_64-w64-mingw32 gcc 14.1.0

Log of the error

libass/ass.c: In function 'sub_recode':
libass/ass.c:1401:35: error: passing argument 2 of 'iconv' from incompatible pointer type [-Wincompatible-pointer-types]
 1401 |                 rc = iconv(icdsc, &ip, &ileft, &op, &oleft);
      |                                   ^~~
      |                                   |
      |                                   char **
In file included from libass/ass.c:32:
C:/Documents/msys2/home/vincent.torri/ewpi_64/include/iconv.h:17:48: note: expected 'const char **' but argument is of type 'char **'
   17 | size_t iconv(iconv_t cd, WINICONV_CONST char **inbuf, size_t *inbytesleft, char **outbuf, size_t *outbytesleft);
      |                                              

Configuration log

No response

Additional info

using winiconv

@vtorri vtorri added the build label May 19, 2024
@TheOneric
Copy link
Member

TheOneric commented May 19, 2024

char ** or more specifically char **restrict is the correct type; your iconv headers are broken
See: https://pubs.opengroup.org/onlinepubs/9699919799/functions/iconv.html

(there used to be an error in the spec where the version documented in the iconv.h header didn’t match the version of the iconv’ function itself, but that was fixed ages ago. Some systems like NetBSD retain a const version anyway, but i guess they also configure their compilers to not error on this by default)

win-iconv defaults to a non-compliant setup and you need a build time toggle to make it behave correctly; win-iconv/win-iconv#25

Furthermore sub_recode wasn’t touched in 10 years; this exact setup working fine with 0.17.1 but not 0.17.2 is thus impossible; most likely the winiconv macro define got just lost inbetween or your compiler used to treat this as a non-fatal error before

@vtorri
Copy link
Contributor Author

vtorri commented May 19, 2024

actually, winiconv can modify the constness with WINICONV_CONST, now it works.
maybe gcc 14 changed something, but 0.17.1 did compile when i tried it, as its compilation was part of my package manager. So I'm sure it compiled.
anyway, it is fixed, now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants