Skip to contentSkip to conversation

GCC-14 related fixes

PATCH In review Khem Raj 2 participants 7 messages May 30, 2024

lore
Share & tools
lore

Khem Raj

author
#0 lore raw

cover GCC-14 related fixes

This series addresses the set of issues seen with mingw builds with GCC-14

Khem Raj (4):
mingw-w64: Upgrade to 12.0.0 release
curl: Disable incompatible-pointer-types warning as error on mingw
gettext: Disable incompatible-pointer-types warning as error on mingw
diffutils: Fix build with GCC-14

 recipes-core/gettext/gettext_%.bbappend       |  9 +++++
 ...in-the-ucrt-__imp_vfscanf-assignment.patch | 30 ---------------
 recipes-devtools/mingw-w64/mingw-w64.inc      |  3 +-
 ... => nativesdk-mingw-w64-headers_12.0.0.bb} |  0
 ... => nativesdk-mingw-w64-runtime_12.0.0.bb} |  2 +-
 ...nativesdk-mingw-w64-winpthreads_12.0.0.bb} |  0
 ...01-sdiff-Match-execvp-argument-types.patch | 37 +++++++++++++++++++
 ...efine-stricoll-as-_stricoll-on-mingw.patch | 37 +++++++++++++++++++
 .../diffutils/diffutils_%.bbappend            |  5 ++-
 recipes-support/curl/curl_%.bbappend          | 11 ++++++
 10 files changed, 100 insertions(+), 34 deletions(-)
 delete mode 100644 recipes-devtools/mingw-w64/files/0001-crt-Fix-a-typo-in-the-ucrt-__imp_vfscanf-assignment.patch
 rename recipes-devtools/mingw-w64/{nativesdk-mingw-w64-headers_9.0.0.bb => nativesdk-mingw-w64-headers_12.0.0.bb} (100%)
 rename recipes-devtools/mingw-w64/{nativesdk-mingw-w64-runtime_9.0.0.bb => nativesdk-mingw-w64-runtime_12.0.0.bb} (86%)
 rename recipes-devtools/mingw-w64/{nativesdk-mingw-w64-winpthreads_9.0.0.bb => nativesdk-mingw-w64-winpthreads_12.0.0.bb} (100%)
 create mode 100644 recipes-extended/diffutils/diffutils/0001-sdiff-Match-execvp-argument-types.patch
 create mode 100644 recipes-extended/diffutils/diffutils/0002-Define-stricoll-as-_stricoll-on-mingw.patch
Signature · 1 line
2.45.1
author
#1 lore raw

PATCH 1/4 mingw-w64: Upgrade to 12.0.0 release

Drop GCC-14 related backport, its not needed anymore

---
 ...in-the-ucrt-__imp_vfscanf-assignment.patch | 30 -------------------
 recipes-devtools/mingw-w64/mingw-w64.inc      |  3 +-
 ... => nativesdk-mingw-w64-headers_12.0.0.bb} |  0
 ... => nativesdk-mingw-w64-runtime_12.0.0.bb} |  2 +-
 ...nativesdk-mingw-w64-winpthreads_12.0.0.bb} |  0
 5 files changed, 2 insertions(+), 33 deletions(-)
 delete mode 100644 recipes-devtools/mingw-w64/files/0001-crt-Fix-a-typo-in-the-ucrt-__imp_vfscanf-assignment.patch
 rename recipes-devtools/mingw-w64/{nativesdk-mingw-w64-headers_9.0.0.bb => nativesdk-mingw-w64-headers_12.0.0.bb} (100%)
 rename recipes-devtools/mingw-w64/{nativesdk-mingw-w64-runtime_9.0.0.bb => nativesdk-mingw-w64-runtime_12.0.0.bb} (86%)
 rename recipes-devtools/mingw-w64/{nativesdk-mingw-w64-winpthreads_9.0.0.bb => nativesdk-mingw-w64-winpthreads_12.0.0.bb} (100%)
recipes-devtools/mingw-w64/files/0001-crt-Fix-a-typo-in-the-ucrt-__imp_vfscanf-assignment.patch deleted +0 -30
deleted file mode 100644
index bc41482..0000000
@@ -1,30 +0,0 @@
-From b0dcc496228373417e4f6134beb2f13ca3ed807e Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Martin=20Storsj=C3=B6?= <[email protected]>
-Date: Thu, 5 Aug 2021 11:08:39 +0300
-Subject: [PATCH] crt: Fix a typo in the ucrt __imp_vfscanf assignment
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-The wrong function was assigned; this was a bug present since
-0dd9563a3ad71ad75cab1699ba5cfef2dd0bf9d8 (April 2021).
-
-Upstream-Status: Backport [https://sourceforge.net/p/mingw-w64/mingw-w64/ci/b0dcc496228373417e4f6134beb2f13ca3ed807e]
-Signed-off-by: Martin Storsjö <[email protected]>
----
- mingw-w64-crt/stdio/ucrt_vfscanf.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/mingw-w64-crt/stdio/ucrt_vfscanf.c b/mingw-w64-crt/stdio/ucrt_vfscanf.c
-index fe44cdf71..8d1a76a8b 100644
---- a/mingw-w64-crt/stdio/ucrt_vfscanf.c
-+++ b/mingw-w64-crt/stdio/ucrt_vfscanf.c
-@@ -11,4 +11,4 @@
- int __cdecl vfscanf (FILE *__stream,  const char *__format, __builtin_va_list __local_argv) {
-   return __stdio_common_vfscanf(0, __stream, __format, NULL, __local_argv);
- }
--int __cdecl (*__MINGW_IMP_SYMBOL(vfscanf))(FILE *, const char *, __builtin_va_list) = vsscanf;
-+int __cdecl (*__MINGW_IMP_SYMBOL(vfscanf))(FILE *, const char *, __builtin_va_list) = vfscanf;
--- 
-2.43.0
-
recipes-devtools/mingw-w64/mingw-w64.inc +1 -2
index ce5d0db..97315f4 100644
@@ -4,8 +4,7 @@ LIC_FILES_CHKSUM = "file://${WORKDIR}/mingw-w64-v${PV}/COPYING;md5=bb936f0e04d8f
 COMPATIBLE_HOST = ".*-mingw.*"
 
 SRC_URI = "${SOURCEFORGE_MIRROR}/project/mingw-w64/mingw-w64/mingw-w64-release/mingw-w64-v${PV}.tar.bz2"
-
-SRC_URI[sha256sum] = "1929b94b402f5ff4d7d37a9fe88daa9cc55515a6134805c104d1794ae22a4181"
+SRC_URI[sha256sum] = "cc41898aac4b6e8dd5cffd7331b9d9515b912df4420a3a612b5ea2955bbeed2f"
 
 UPSTREAM_CHECK_URI = "http://sourceforge.net/projects/mingw-w64/files/mingw-w64/mingw-w64-release/"
 UPSTREAM_CHECK_REGEX = "mingw-w64-v(?P<pver>(\d+[\.\-_]*)+)\.tar"
recipes-devtools/mingw-w64/nativesdk-mingw-w64-headers_12.0.0.bb renamed from recipes-devtools/mingw-w64/nativesdk-mingw-w64-headers_9.0.0.bb +0 -0
similarity index 100%
rename from recipes-devtools/mingw-w64/nativesdk-mingw-w64-headers_9.0.0.bb
rename to recipes-devtools/mingw-w64/nativesdk-mingw-w64-headers_12.0.0.bb
recipes-devtools/mingw-w64/nativesdk-mingw-w64-runtime_12.0.0.bb renamed from recipes-devtools/mingw-w64/nativesdk-mingw-w64-runtime_9.0.0.bb +1 -1
similarity index 86%
rename from recipes-devtools/mingw-w64/nativesdk-mingw-w64-runtime_9.0.0.bb
rename to recipes-devtools/mingw-w64/nativesdk-mingw-w64-runtime_12.0.0.bb
index 1aa470e..6d01d35 100644
@@ -2,7 +2,7 @@ DESCRIPTION = "Runtime libraries from MinGW-w64 project"
 
 require mingw-w64.inc
 
-SRC_URI += "file://0001-crt-Fix-a-typo-in-the-ucrt-__imp_vfscanf-assignment.patch;striplevel=2"
+#SRC_URI += "file://0001-crt-Fix-a-typo-in-the-ucrt-__imp_vfscanf-assignment.patch;striplevel=2"
 
 S = "${WORKDIR}/mingw-w64-v${PV}/mingw-w64-crt"
 B = "${WORKDIR}/build-${TARGET_SYS}"
recipes-devtools/mingw-w64/nativesdk-mingw-w64-winpthreads_12.0.0.bb renamed from recipes-devtools/mingw-w64/nativesdk-mingw-w64-winpthreads_9.0.0.bb +0 -0
similarity index 100%
rename from recipes-devtools/mingw-w64/nativesdk-mingw-w64-winpthreads_9.0.0.bb
rename to recipes-devtools/mingw-w64/nativesdk-mingw-w64-winpthreads_12.0.0.bb
Signature · 1 line
2.45.1
author
#2 lore raw

PATCH 2/4 curl: Disable incompatible-pointer-types warning as error on mingw

In reply to Khem Raj

GCC-14 promoted this warning into error by default but code does not build cleanly and now this warning becomes a hard error.

---
 recipes-support/curl/curl_%.bbappend | 11 +++++++++++
 1 file changed, 11 insertions(+)
recipes-support/curl/curl_%.bbappend +11 -0
index a55c126..95b00f5 100644
@@ -1,3 +1,14 @@
 PACKAGECONFIG:remove:class-nativesdk:mingw32 = "openssl"
 EXTRA_OECONF:append:class-nativesdk:mingw32 = " --without-ssl"
 RRECOMMENDS:lib${BPN}:remove:mingw32 = "ca-certificates"
+
+# Configure tests for ioctlsocket FIONBIO fails with GCC-14
+# because gcc can now find warnings when compiling the test
+# and these warnings are treated as errors
+#  conftest.c: In function 'main':
+#   conftest.c:137:41: error: passing argument 3 of 'ioctlsocket' from incompatible pointer type [-Wincompatible-pointer-types]
+#     137 |         if(0 != ioctlsocket(0, FIONBIO, &flags))
+#         |                                         ^~~~~~
+#         |                                         |
+#         |                                         int *
+CFLAGS:append:mingw32 = "-Wno-error=incompatible-pointer-types"
Signature · 1 line
2.45.1
author
#3 lore raw

PATCH 3/4 gettext: Disable incompatible-pointer-types warning as error on mingw

In reply to Khem Raj

GCC-14 promoted this warning into error by default but code does not build cleanly and now this warning becomes a hard error.

---
 recipes-core/gettext/gettext_%.bbappend | 9 +++++++++
 1 file changed, 9 insertions(+)
recipes-core/gettext/gettext_%.bbappend +9 -0
index 7bb9a4f..5d2fa33 100644
@@ -1,5 +1,14 @@
 EXTRA_OECONF:append:mingw32 = " --enable-static"
 
+# GCC-14 treats this warning as error which results in
+# build failures on gnulib imported code which is dated in
+# gettext
+# ../../../gettext-0.22.5/gettext-tools/gnulib-lib/localtime.c: In function 'rpl_localtime':
+#../../../gettext-0.22.5/gettext-tools/gnulib-lib/localtime.c:66:24: error: initialization of 'char *' from incompatible pointer type 'char **' [-Wincompatible-pointer-types]
+#   66 |         for (char *s = env; *s != NULL; s++)
+#      |                        ^~~
+CFLAGS:append:mingw32 = "-Wno-error=incompatible-pointer-types"
+
 FILESEXTRAPATHS:prepend:mingw32 := "${THISDIR}/${BPN}:"
 SRC_URI:append:mingw32 = " \
 		"
Signature · 1 line
2.45.1
author
#4 lore raw

PATCH 4/4 diffutils: Fix build with GCC-14

In reply to Khem Raj
---
 ...01-sdiff-Match-execvp-argument-types.patch | 37 +++++++++++++++++++
 ...efine-stricoll-as-_stricoll-on-mingw.patch | 37 +++++++++++++++++++
 .../diffutils/diffutils_%.bbappend            |  5 ++-
 3 files changed, 78 insertions(+), 1 deletion(-)
 create mode 100644 recipes-extended/diffutils/diffutils/0001-sdiff-Match-execvp-argument-types.patch
 create mode 100644 recipes-extended/diffutils/diffutils/0002-Define-stricoll-as-_stricoll-on-mingw.patch
recipes-extended/diffutils/diffutils/0001-sdiff-Match-execvp-argument-types.patch new file +37 -0
new file mode 100644
index 0000000..2dff6db
@@ -0,0 +1,37 @@
+From 197c0c72a6cb60a647db02c2874a8103be4557d6 Mon Sep 17 00:00:00 2001
+From: Khem Raj <[email protected]>
+Date: Wed, 29 May 2024 10:58:54 -0700
+Subject: [PATCH 1/2] sdiff: Match execvp argument types
+
+Fixes build with GCC-14
+
+../../diffutils-3.10/src/sdiff.c:579:28: error: passing argument 2 of '_execvp' from incompatible pointer type [-Wincompatible-pointer-types]
+  579 |       execvp (diffargv[0], (char **) diffargv);
+      |                            ^~~~~~~~~~~~~~~~~~
+      |                            |
+      |                            char **
+
+* src/sdiff.c (main): execpv expects const pointer.
+
+Upstream-Status: Submitted [https://lists.gnu.org/archive/html/bug-diffutils/2024-05/msg00003.html]
+Signed-off-by: Khem Raj <[email protected]>
+---
+ src/sdiff.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/sdiff.c b/src/sdiff.c
+index 0b638d4..a4642b1 100644
+--- a/src/sdiff.c
++++ b/src/sdiff.c
+@@ -576,7 +576,7 @@ main (int argc, char *argv[])
+       diffarg (argv[optind]);
+       diffarg (argv[optind + 1]);
+       diffarg (0);
+-      execvp (diffargv[0], (char **) diffargv);
++      execvp (diffargv[0], diffargv);
+       perror_fatal (diffargv[0]);
+     }
+   else
+-- 
+2.45.1
+
recipes-extended/diffutils/diffutils/0002-Define-stricoll-as-_stricoll-on-mingw.patch new file +37 -0
new file mode 100644
index 0000000..23807c6
@@ -0,0 +1,37 @@
+From 9e1318440a5f7f4a00f077fc3cbd1edc07e0985d Mon Sep 17 00:00:00 2001
+From: Khem Raj <[email protected]>
+Date: Wed, 29 May 2024 21:20:12 -0700
+Subject: [PATCH 2/2] Define stricoll as _stricoll on mingw
+
+* src/system.h: Define stricoll as _stricoll on mingw.
+
+Upstream-Status: Submitted [https://lists.gnu.org/archive/html/bug-diffutils/2024-05/msg00004.html]
+Signed-off-by: Khem Raj <[email protected]>
+---
+ src/system.h | 10 ++++++++++
+ 1 file changed, 10 insertions(+)
+
+diff --git a/src/system.h b/src/system.h
+index b37893f..4c7a318 100644
+--- a/src/system.h
++++ b/src/system.h
+@@ -63,6 +63,16 @@
+ #include <inttypes.h>
+ 
+ #include <string.h>
++/* stricoll is not provided by any headers on windows/mingw
++   only _stricoll is provided, the function is however aliased
++   to provide stricoll in runtime libraries, the configure check
++   to detect stricoll defines the prototype in generated test
++   itself and thus test passes, however compiling fails with
++   GCC-14 which enables implicit-function-declaration as error  */ 
++#if defined _WIN32 && ! defined __CYGWIN__
++#define stricoll _stricoll
++#endif
++
+ #if ! HAVE_STRCASECOLL
+ # if HAVE_STRICOLL || defined stricoll
+ #  define strcasecoll(a, b) stricoll (a, b)
+-- 
+2.45.1
+
recipes-extended/diffutils/diffutils_%.bbappend +4 -1
index 8b54cb0..284f8cb 100644
@@ -3,6 +3,10 @@ FILESEXTRAPATHS:prepend:mingw32 := "${THISDIR}/${BPN}:"
 # Add some definitions for POSIX signals..
 CFLAGS:append:mingw32 = " -DSIGALRM=14 -DSIGHUP=1 -DSIGQUIT=3 -DSIGPIPE=13 -DSIGTSTP=18 -DSIGSTOP=17 "
 
+SRC_URI:append:mingw32 = "\
+       file://0001-sdiff-Match-execvp-argument-types.patch \
+       file://0002-Define-stricoll-as-_stricoll-on-mingw.patch"
+
 do_configure:prepend:mingw32 () {
     # Remove building of "man" and "gnulib-tests". The tests don't
     # cross-compile for mingw, but we aren't using them anyway
@@ -11,4 +15,3 @@ do_configure:prepend:mingw32 () {
         -e 's:^SUBDIRS =\(.*\) gnulib-tests\>:SUBDIRS = \1 :g' \
         ${S}/Makefile.am
 }
-
Signature · 1 line
2.45.1
#5 lore raw
In reply to Khem Raj
Quoted 7 lines · Khem Raj via lists.yoctoproject.org

This series addresses the set of issues seen with mingw builds with GCC-14

Khem Raj (4):
  mingw-w64: Upgrade to 12.0.0 release
  curl: Disable incompatible-pointer-types warning as error on mingw
  gettext: Disable incompatible-pointer-types warning as error on mingw
  diffutils: Fix build with GCC-14

These let the build with gcc14 get further thanks. I did have to add some whitespace to the CFLAGS appends.

There was a failure in qemu these patches exposed so I've sent a cflags fix for that which lets mingw build cleanly.

I also realised my config was using the wrong list for patches, I've changed it to yocto-patches now (README was already changed).

Cheers,

Richard

author
#6 lore raw
Quoted 10 lines · Richard Purdie
Quoted 7 lines · Khem Raj via lists.yoctoproject.org

This series addresses the set of issues seen with mingw builds with GCC-14

Khem Raj (4):
mingw-w64: Upgrade to 12.0.0 release
curl: Disable incompatible-pointer-types warning as error on mingw
gettext: Disable incompatible-pointer-types warning as error on mingw
diffutils: Fix build with GCC-14

Quoted 8 lines

These let the build with gcc14 get further thanks. I did have to add some whitespace to the CFLAGS appends.

There was a failure in qemu these patches exposed so I've sent a cflags fix for that which lets mingw build cleanly.

I also realised my config was using the wrong list for patches, I've changed it to yocto-patches now (README was already changed).

ah, I should have realized the mailing list change :)

Quoted 4 lines

Cheers,

Richard