mlterm icon indicating copy to clipboard operation
mlterm copied to clipboard

When building with GCC 14 need to set CFLAGS=-Wno-incompatible-pointer-types

Open bkmgit opened this issue 1 year ago • 1 comments

May want to ensure compatible pointer types are used.

bkmgit avatar Mar 29 '24 08:03 bkmgit

@arakiken, could you please look at the PR fixing this issue?

pgajdos avatar Jun 11 '24 08:06 pgajdos

Even with f971955cf54a721e6a53191c3b86fbdab4bfbfd5 and 3d38b723e0e4a6dd434af2d49aca53890982a828 gcc 14 still throws an error in the wnn code when building GIT head:

make[1]: Entering directory '/tmp/MLTERM/mlterm.git/buildA/inputmethod/wnn'
../../libtool --mode=compile gcc  -I../../baselib/include -I../../encodefilter/include -I/usr/X11R6/include -DUSE_COMPACT_TRUECOLOR -g -O2 -Werror=implicit-function-declaration -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection -DOPTIMIZE_REDRAWING -DUSE_IM_PLUGIN -DWNNLIBDIR=\"/usr/lib\" -I../../../vtemu -I../../../uitoolkit -I../../../common -I/usr/local/include -c ../../../inputmethod/wnn/wnnlib.c
libtool: compile:  gcc -I../../baselib/include -I../../encodefilter/include -I/usr/X11R6/include -DUSE_COMPACT_TRUECOLOR -g -O2 -Werror=implicit-function-declaration -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection -DOPTIMIZE_REDRAWING -DUSE_IM_PLUGIN -DWNNLIBDIR=\"/usr/lib\" -I../../../vtemu -I../../../uitoolkit -I../../../common -I/usr/local/include -c ../../../inputmethod/wnn/wnnlib.c  -fPIC -DPIC -o .libs/wnnlib.o
../../../inputmethod/wnn/wnnlib.c: In function 'jcOpen2':
../../../inputmethod/wnn/wnnlib.c:3446:48: error: passing argument 6 of 'jl_open_lang' from incompatible pointer type [-Wincompatible-pointer-types]
 3446 |                                 NULL, confirm, errmsg, timeout);
      |                                                ^~~~~~
      |                                                |
      |                                                void (*)()
In file included from /usr/include/wnn/jllib.h:40,
                 from ../../../inputmethod/wnn/wnnlib.h:65,
                 from ../../../inputmethod/wnn/wnnlib.c:610:
/usr/include/wnn/jllib.h:256:40: note: expected 'int (*)()' but argument is of type 'void (*)()'
  256 | extern struct wnn_buf *jl_open_lang    FRWNN_PARAMS((char *env_n, char *server_n, char *lang, char *wnnrc_n, int (*error_handler) (), int (*message_handler) (), int timeout));
      |                                        ^~~~~~~~~~~~
../../../inputmethod/wnn/wnnlib.c:3536:53: error: passing argument 4 of 'jl_set_env_wnnrc' from incompatible pointer type [-Wincompatible-pointer-types]
 3536 |     (void)jl_set_env_wnnrc(wnnenv, rcfile, confirm, errmsg);
      |                                                     ^~~~~~
      |                                                     |
      |                                                     void (*)()
/usr/include/wnn/jllib.h:287:30: note: expected 'int (*)()' but argument is of type 'void (*)()'
  287 | extern int jl_set_env_wnnrc  FRWNN_PARAMS((register struct wnn_env *env, char *wnnrc_n, int (*error_handler) (), int (*message_handler) () ));
      |                              ^~~~~~~~~~~~
make[1]: *** [Makefile:61: wnnlib.o] Error 1
make[1]: Leaving directory '/tmp/MLTERM/mlterm.git/buildA/inputmethod/wnn'
make: *** [Makefile:8: all] Error 2

I have previously asked this in the Debian BTS in Debian bug #1068503: Canna and freewnn are both very much dead upstream. Are they still relevant for writing Japanese/Chinese? Or is this some code nobody is using nowaydays anyway?

ametzler avatar Aug 10 '24 14:08 ametzler

Thank you. I fixed it except libvte compatible library in gtk/ directory. https://github.com/arakiken/mlterm/commit/08ba9859717ed27384675bd687a35f4504701f27

arakiken avatar Aug 12 '24 13:08 arakiken

Hello, thank you, that gets me further. I am still getting a canna-related error though (GIT head as of 08ba9859717ed27384675bd687a35f4504701f27) when building on Debian/sid:

make[1]: Entering directory '/tmp/MLTERM/mlterm.git/build/inputmethod/canna'
../../libtool --mode=compile gcc  -I../../baselib/include -I../../encodefilter/include -I/usr/X11R6/include -DUSE_COMPACT_TRUECOLOR -g -O2 -Werror=implicit-function-declaration -ffile-prefix-map=/tmp/MLTERM/mlterm=. -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection -DOPTIMIZE_REDRAWING -DUSE_IM_PLUGIN -I../../../vtemu -I../../../uitoolkit -I/usr/local/include -c ../../../inputmethod/canna/im_canna.c
libtool: compile:  gcc -I../../baselib/include -I../../encodefilter/include -I/usr/X11R6/include -DUSE_COMPACT_TRUECOLOR -g -O2 -Werror=implicit-function-declaration -ffile-prefix-map=/tmp/MLTERM/mlterm=. -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection -DOPTIMIZE_REDRAWING -DUSE_IM_PLUGIN -I../../../vtemu -I../../../uitoolkit -I/usr/local/include -c ../../../inputmethod/canna/im_canna.c  -fPIC -DPIC -o .libs/im_canna.o
../../../inputmethod/canna/im_canna.c: In function 'key_event':
../../../inputmethod/canna/im_canna.c:431:79: error: pointer type mismatch in conditional expression [-Wincompatible-pointer-types]
  431 |       preedit(canna, canna->key_status.length > 0 ? canna->key_status.echoStr : "",
      |                                                                               ^
../../../inputmethod/canna/im_canna.c:431:53: note: first expression has type 'unsigned char *'
  431 |       preedit(canna, canna->key_status.length > 0 ? canna->key_status.echoStr : "",
      |                                                     ^~~~~~~~~~~~~~~~~~~~~~~~~
../../../inputmethod/canna/im_canna.c:431:81: note: second expression has type 'char *'
  431 |       preedit(canna, canna->key_status.length > 0 ? canna->key_status.echoStr : "",
      |                                                                                 ^~
make[1]: *** [Makefile:60: im_canna.o] Error 1
make[1]: Leaving directory '/tmp/MLTERM/mlterm.git/build/inputmethod/canna'

Do you have any opinion regarding my previous comment whether it would make sense to drop canna and freewnn linkage? cu Andreas

ametzler avatar Aug 12 '24 17:08 ametzler

Thanks. Does this fix works? https://github.com/arakiken/mlterm/commit/8aef4fae3add8e8acfafde831e0034f1b2879dea

arakiken avatar Aug 13 '24 14:08 arakiken

Thanks. Does this fix works? 8aef4fa

I tested git head of at time of testing 5767e5aff08e5be4bc3f5d8f0e065d5bf867d79e which includes this commit and it worked for me. Thank you!

ametzler avatar Aug 14 '24 16:08 ametzler