Hi,

I have 5 patches, 0001, 0002 and 0003 to make the code at
https://salsa.debian.org/chinese-team/zhcon.git compiles successfully, with
gcc-14 and debian 12.
The 0004 and 0005 patches are my test on configure.in, but not finished
yet. Since gettext deb package has m4 file related to iconv, I don't know
how to use. I suspect the configure.in is not correct, when I use
autoupdate && autoconf && automake, the generated ./configure is wrong when
detecting iconv.


-- System Information:
Debian Release: 12.0
  APT prefers testing
  APT policy: (500, 'testing')
Architecture: amd64 (x86_64)

Kernel: Linux 6.1.0-9-amd64 (SMP w/8 CPU threads; PREEMPT)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), LANGUAGE
not set
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages zhcon depends on:
ii  libc6       2.38-13
ii  libgcc-s1   14-20240330-1
ii  libgpm2     1.20.7-11
ii  libstdc++6  14-20240330-1
ii  libtinfo6   6.5-2
pn  zhcon-data  <none>

zhcon recommends no packages.

zhcon suggests no packages.

Regards.

Rafael Lee


On Wed, 03 Jul 2024 12:50:01 +0000 Matthias Klose <d...@debian.org> wrote:
> Package: src:zhcon
> Version: 1:0.2.6-19
> Severity: important
> Tags: sid trixie
> User: debian-...@lists.debian.org
> Usertags: ftbfs-gcc-14
>
> [This bug is targeted to the upcoming trixie release]
>
> Please keep this issue open in the bug tracker for the package it
> was filed for.  If a fix in another package is required, please
> file a bug for the other package (or clone), and add a block in this
> package. Please keep the issue open until the package can be built in
> a follow-up test rebuild.
>
> The package fails to build in a test rebuild on at least amd64 with
> gcc-14/g++-14, but succeeds to build with gcc-13/g++-13. The
> severity of this report will be raised before the trixie release.
>
> The full build log can be found at:
> http://qa-logs.debian.net/2024/07/01/zhcon_0.2.6-19_unstable_gccexp.log
> The last lines of the build log are at the end of this report.
>
> To build with GCC 14, either set CC=gcc-14 CXX=g++-14 explicitly,
> or install the gcc, g++, gfortran, ... packages from experimental.
>
>   apt-get -t=experimental install g++
>
> Common build failures are new warnings resulting in build failures with
> -Werror turned on, or new/dropped symbols in Debian symbols files.
> For other C/C++ related build failures see the porting guide at
> http://gcc.gnu.org/gcc-14/porting_to.html
>
> [...]
> winime.cpp:267:32: warning: ‘std::binder2nd<_Operation>
std::bind2nd(const _Operation&, const _Tp&) [with _Operation =
not_equal_to<char*>; _Tp = char*]’ is deprecated: use 'std::bind' instead
[-Wdeprecated-declarations]
>   267 |                         bind2nd(not_equal_to < char *>(),
>       |                         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
>   268 |                                 (char *) 0xffffffff));
>       |                                 ~~~~~~~~~~~~~~~~~~~~
> In file included from /usr/include/c++/14/bits/stl_function.h:1435,
>                  from /usr/include/c++/14/functional:49,
>                  from winime.cpp:26:
> /usr/include/c++/14/backward/binders.h:172:5: note: declared here
>   172 |     bind2nd(const _Operation& __fn, const _Tp& __x)
>       |     ^~~~~~~
> winime.cpp:276:17: warning: cast to pointer from integer of different
size [-Wint-to-pointer-cast]
>   276 |             p = (char *)(mpIndex2[Index(mInput[0]) * l +
Index(c)]);
>       |
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> g++ -DHAVE_CONFIG_H -I. -I..  -DSYSCONF_DIR=\"/etc\" -Wdate-time
-D_FORTIFY_SOURCE=2  -g -O2 -ffile-prefix-map=/<<PKGBUILDDIR>>=.
-fstack-protector-strong -fstack-clash-protection -Wformat
-Werror=format-security -fcf-protection -funsigned-char -O2 -DNDEBUG -Wall
-c -o zhcon-nativeinputserver.o `test -f 'nativeinputserver.cpp' || echo
'./'`nativeinputserver.cpp
> g++ -DHAVE_CONFIG_H -I. -I..  -DSYSCONF_DIR=\"/etc\" -Wdate-time
-D_FORTIFY_SOURCE=2  -g -O2 -ffile-prefix-map=/<<PKGBUILDDIR>>=.
-fstack-protector-strong -fstack-clash-protection -Wformat
-Werror=format-security -fcf-protection -funsigned-char -O2 -DNDEBUG -Wall
-c -o zhcon-inputclient.o `test -f 'inputclient.cpp' || echo
'./'`inputclient.cpp
> g++ -DHAVE_CONFIG_H -I. -I..  -DSYSCONF_DIR=\"/etc\" -Wdate-time
-D_FORTIFY_SOURCE=2  -g -O2 -ffile-prefix-map=/<<PKGBUILDDIR>>=.
-fstack-protector-strong -fstack-clash-protection -Wformat
-Werror=format-security -fcf-protection -funsigned-char -O2 -DNDEBUG -Wall
-c -o zhcon-inputmanager.o `test -f 'inputmanager.cpp' || echo
'./'`inputmanager.cpp
> g++ -DHAVE_CONFIG_H -I. -I..  -DSYSCONF_DIR=\"/etc\" -Wdate-time
-D_FORTIFY_SOURCE=2  -g -O2 -ffile-prefix-map=/<<PKGBUILDDIR>>=.
-fstack-protector-strong -fstack-clash-protection -Wformat
-Werror=format-security -fcf-protection -funsigned-char -O2 -DNDEBUG -Wall
-c -o zhcon-inputserver.o `test -f 'inputserver.cpp' || echo
'./'`inputserver.cpp
> g++ -DHAVE_CONFIG_H -I. -I..  -DSYSCONF_DIR=\"/etc\" -Wdate-time
-D_FORTIFY_SOURCE=2  -g -O2 -ffile-prefix-map=/<<PKGBUILDDIR>>=.
-fstack-protector-strong -fstack-clash-protection -Wformat
-Werror=format-security -fcf-protection -funsigned-char -O2 -DNDEBUG -Wall
-c -o zhcon-candilist.o `test -f 'candilist.cpp' || echo './'`candilist.cpp
> g++ -DHAVE_CONFIG_H -I. -I..  -DSYSCONF_DIR=\"/etc\" -Wdate-time
-D_FORTIFY_SOURCE=2  -g -O2 -ffile-prefix-map=/<<PKGBUILDDIR>>=.
-fstack-protector-strong -fstack-clash-protection -Wformat
-Werror=format-security -fcf-protection -funsigned-char -O2 -DNDEBUG -Wall
-c -o zhcon-uniconinputserver.o `test -f 'uniconinputserver.cpp' || echo
'./'`uniconinputserver.cpp
> g++ -DHAVE_CONFIG_H -I. -I..  -DSYSCONF_DIR=\"/etc\" -Wdate-time
-D_FORTIFY_SOURCE=2  -g -O2 -ffile-prefix-map=/<<PKGBUILDDIR>>=.
-fstack-protector-strong -fstack-clash-protection -Wformat
-Werror=format-security -fcf-protection -funsigned-char -O2 -DNDEBUG -Wall
-c -o zhcon-nativebarclient.o `test -f 'nativebarclient.cpp' || echo
'./'`nativebarclient.cpp
> g++ -DHAVE_CONFIG_H -I. -I..  -DSYSCONF_DIR=\"/etc\" -Wdate-time
-D_FORTIFY_SOURCE=2  -g -O2 -ffile-prefix-map=/<<PKGBUILDDIR>>=.
-fstack-protector-strong -fstack-clash-protection -Wformat
-Werror=format-security -fcf-protection -funsigned-char -O2 -DNDEBUG -Wall
-c -o zhcon-mouse.o `test -f 'mouse.cpp' || echo './'`mouse.cpp
> gcc -DHAVE_CONFIG_H -I. -I..  -DSYSCONF_DIR=\"/etc\" -Wdate-time
-D_FORTIFY_SOURCE=2  -g -O2 -Werror=implicit-function-declaration
-ffile-prefix-map=/<<PKGBUILDDIR>>=. - -fstack-clash-protection -Wformat
-Werror=format-security -fcf-protection -funsigned-char -O2 -DNDEBUG -Wall
-c -o zhcon-encfilter.o `test -f 'encfilter.c' || echo './'`encfilter.c
> gcc -DHAVE_CONFIG_H -I. -I..  -DSYSCONF_DIR=\"/etc\" -Wdate-time
-D_FORTIFY_SOURCE=2  -g -O2 -Werror=implicit-function-declaration
-ffile-prefix-map=/<<PKGBUILDDIR>>=. -fstack-protector-strong
-fstack-clash-protection -Wformat -Werror=format-security -fcf-protection
-funsigned-char -O2 -DNDEBUG -Wall -c -o zhcon-iconv_string.o `test -f
'iconv_string.c' || echo './'`iconv_string.c
> iconv_string.c: In function ‘iconv_string’:
> iconv_string.c:83:29: error: passing argument 2 of ‘iconv’ from
incompatible pointer type [-Wincompatible-pointer-types]
From db239297ccd4442d44231b88c03118b57dc4e7a2 Mon Sep 17 00:00:00 2001
From: Rafael Lee <rafaellee.img@gmail.com>
Date: Sun, 7 Jul 2024 00:12:07 +0900
Subject: [PATCH 1/5] Fix not found functions by adding headers

---
 src/basefont.cpp          | 1 +
 src/display/fblinear4.cpp | 1 +
 src/display/fblinear8.cpp | 1 +
 src/encfilter.c           | 1 +
 src/graphdev.cpp          | 1 +
 src/window.cpp            | 1 +
 src/winime.cpp            | 1 +
 src/zhcon.cpp             | 1 +
 8 files changed, 8 insertions(+)

diff --git a/src/basefont.cpp b/src/basefont.cpp
index 988e780..0e6233a 100644
--- a/src/basefont.cpp
+++ b/src/basefont.cpp
@@ -24,6 +24,7 @@
 #include <sys/stat.h>
 #include <stdexcept>
 #include <cassert>
+#include <cstring>
 #include "global.h"
 #include "debug.h"
 #include "hzdecoder.h"
diff --git a/src/display/fblinear4.cpp b/src/display/fblinear4.cpp
index f13a918..a3fda9e 100644
--- a/src/display/fblinear4.cpp
+++ b/src/display/fblinear4.cpp
@@ -19,6 +19,7 @@
 
 #include <assert.h>
 #include <endian.h>
+#include <cstring>
 #include "global.h"
 #include "fblinear4.h"
 
diff --git a/src/display/fblinear8.cpp b/src/display/fblinear8.cpp
index 5739e0d..396b0f2 100644
--- a/src/display/fblinear8.cpp
+++ b/src/display/fblinear8.cpp
@@ -19,6 +19,7 @@
 
 #include <assert.h>
 #include <endian.h>
+#include <cstring>
 #include "global.h"
 #include "fblinear8.h"
 
diff --git a/src/encfilter.c b/src/encfilter.c
index 6964245..c656d9b 100644
--- a/src/encfilter.c
+++ b/src/encfilter.c
@@ -37,6 +37,7 @@
 #include <stdlib.h>
 #include <errno.h>
 #include <assert.h>
+#include <string.h>
 
 #include "encfilter.h"
 
diff --git a/src/graphdev.cpp b/src/graphdev.cpp
index 787d086..5ba0268 100644
--- a/src/graphdev.cpp
+++ b/src/graphdev.cpp
@@ -26,6 +26,7 @@
 #include <sys/mman.h>
 #include <assert.h>
 #include <iostream>
+#include <cstring>
 #include "debug.h"
 
 #include "display/fbdev.h"
diff --git a/src/window.cpp b/src/window.cpp
index 2bc9ff1..cd856f5 100644
--- a/src/window.cpp
+++ b/src/window.cpp
@@ -20,6 +20,7 @@
 #include <algorithm>
 #include <sys/time.h>
 #include <algorithm>
+#include <cstring>
 #include "global.h"
 #include "debug.h"
 #include "window.h"
diff --git a/src/winime.cpp b/src/winime.cpp
index 0c52393..2498a46 100644
--- a/src/winime.cpp
+++ b/src/winime.cpp
@@ -26,6 +26,7 @@
 #include <functional>
 #include <algorithm>
 #include <stdexcept>
+#include <cstdint>
 
 #include "candilist.h"
 #include "winime.h"
diff --git a/src/zhcon.cpp b/src/zhcon.cpp
index 672ae5c..1d32a23 100644
--- a/src/zhcon.cpp
+++ b/src/zhcon.cpp
@@ -23,6 +23,7 @@
 #include <unistd.h>
 #include <cstdlib>
 #include <cstdio>
+#include <cstring>
 #include <sys/ioctl.h>
 
 #if defined(linux)
-- 
2.43.0

From 9f4c467a79aac8d220044f6a1d905bd9833744c1 Mon Sep 17 00:00:00 2001
From: Rafael Lee <rafaellee.img@gmail.com>
Date: Sun, 7 Jul 2024 00:13:02 +0900
Subject: [PATCH 2/5] Fix type error by adding "restrict" to pointer

---
 src/iconv_string.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/iconv_string.c b/src/iconv_string.c
index f2c4b52..bdc6e66 100644
--- a/src/iconv_string.c
+++ b/src/iconv_string.c
@@ -74,7 +74,7 @@ int iconv_string (const char* tocode, const char* fromcode,
     while (insize > 0) {
       char* outptr = tmpbuf;
       size_t outsize = tmpbufsize;
-      size_t res = iconv(cd,&inptr,&insize,&outptr,&outsize);
+      size_t res = iconv(cd,(char ** restrict)&inptr,&insize,&outptr,&outsize);
       if (res == (size_t)(-1) && errno != E2BIG) {
         if (errno == EINVAL)
           break;
@@ -126,7 +126,7 @@ int iconv_string (const char* tocode, const char* fromcode,
     char* outptr = result;
     size_t outsize = length;
     while (insize > 0) {
-      size_t res = iconv(cd,&inptr,&insize,&outptr,&outsize);
+      size_t res = iconv(cd,(char ** restrict)&inptr,&insize,&outptr,&outsize);
       if (res == (size_t)(-1)) {
         if (errno == EINVAL)
           break;
-- 
2.43.0

From b11c7403128cd41412091afbcb219e116aa551a8 Mon Sep 17 00:00:00 2001
From: Rafael Lee <rafaellee.img@gmail.com>
Date: Sun, 7 Jul 2024 00:13:33 +0900
Subject: [PATCH 3/5] Fix type error, convert type of (char*)mpText to "long
 unsigned int" for arithmetic operations

---
 src/winime.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/winime.cpp b/src/winime.cpp
index 2498a46..184b5f6 100644
--- a/src/winime.cpp
+++ b/src/winime.cpp
@@ -251,7 +251,7 @@ int WinIme::Search(char c) {
 
         if (p == (char *) 0xffffffff)
             found = false;
-        p = (unsigned int) p + mpText;
+        p = p + (long unsigned int)mpText;
     } //2nd level index
     else if (mNum == 1) {
         int l = strlen(mHead.mCodeSet);
@@ -272,7 +272,7 @@ int WinIme::Search(char c) {
         if (p == (char *) 0xffffffff)
             found = false;
 
-        p = (unsigned int) p + mpText;
+        p = p + (long unsigned int)mpText;
     } else if (mNum < mHead.mMaxCodes) {
         p = mpOffset[mNum - 1];
         if (p == (char *) 0xffffffff)
-- 
2.43.0

From 63b8b8680a655ba0da7f0d054618bb4d1bad2645 Mon Sep 17 00:00:00 2001
From: Rafael Lee <rafaellee.img@gmail.com>
Date: Sat, 6 Jul 2024 23:19:38 +0900
Subject: [PATCH 4/5] Fix iconv detection in configure.in

---
 configure.in | 37 ++++++++++++++++++++++++++++++++++---
 1 file changed, 34 insertions(+), 3 deletions(-)

diff --git a/configure.in b/configure.in
index debe13a..a390b9d 100644
--- a/configure.in
+++ b/configure.in
@@ -132,13 +132,34 @@ fi
 AC_SUBST(ZHCON_LOCALE_DIR)
 
 AC_CHECK_LIB(util, forkpty)
-AC_CHECK_LIB(curses, main)
 
 dnl for freebsd
 dnl AC_CHECK_LIB(c, i386_set_ioperm)
 
-dnl check for iconv
-if test "$am_cv_func_iconv" != 'yes'; then
+
+dnl-----------------------------------------------------------------------
+dnl Checks for ncurses
+dnl-----------------------------------------------------------------------
+has_ncurses="yes"
+AC_CHECK_HEADERS(term.h,,has_ncurses="no")
+AC_CHECK_LIB(curses, main)
+if test "$has_ncurses" = 'no';then
+    echo ""
+    echo "*** libncurses-dev not found on this system"
+    echo "***  please install with \"apt-get install libncurses-dev\""
+    echo "*** http://www.gnu.org/software/libiconv/ first!"
+    echo ""
+    exit 1
+fi
+
+
+dnl-----------------------------------------------------------------------
+dnl Checks for iconv
+dnl-----------------------------------------------------------------------
+has_iconv="yes"
+AC_CHECK_HEADERS(iconv.h,,has_iconv="no") # check if iconv.h exists
+AC_CHECK_LIB(iconv, main,,has_iconv="no") # check libiconv.so
+if test "$has_iconv" = 'no';then
     echo ""
     echo "*** iconv() not found on this system, which is required for utf8 support"
     echo "***  please install libiconv from"
@@ -184,6 +205,16 @@ if test "$useggi" = 'yes';then
 	AC_DEFINE(HAVE_GGI_LIB)
 fi
 
+
+
+AC_CHECK_FUNCS([gettimeofday])
+AC_CHECK_FUNCS([munmap])
+AC_CHECK_FUNCS([select])
+AC_CHECK_FUNCS([setenv])
+AC_CHECK_FUNCS([setlocale])
+AC_CHECK_HEADERS([libintl.h])
+AC_CHECK_HEADERS([sys/time.h])
+
 AC_OUTPUT([Makefile
         doc/Makefile
         doc/zhcon.1
-- 
2.43.0

From ac4297825f2642468a05c8bb2715d423229e21a3 Mon Sep 17 00:00:00 2001
From: Rafael Lee <rafaellee.img@gmail.com>
Date: Sat, 6 Jul 2024 23:29:22 +0900
Subject: [PATCH 5/5] Add file "compile" for file detection

---
 compile | 0
 1 file changed, 0 insertions(+), 0 deletions(-)
 create mode 100644 compile

diff --git a/compile b/compile
new file mode 100644
index 0000000..e69de29
-- 
2.43.0

Reply via email to