From b57280ab08f2639b202315f89ce581052415fdbc Mon Sep 17 00:00:00 2001 From: Dmitry Bogatov Date: Wed, 25 Jun 2025 20:00:00 -0400 Subject: [PATCH 1/6] pkg-config: Fix build with gcc-15 --- .../pk/pkg-config-unwrapped/gcc-15.patch | 35 +++++++++++++++++++ .../pk/pkg-config-unwrapped/package.nix | 3 +- 2 files changed, 37 insertions(+), 1 deletion(-) create mode 100644 pkgs/by-name/pk/pkg-config-unwrapped/gcc-15.patch diff --git a/pkgs/by-name/pk/pkg-config-unwrapped/gcc-15.patch b/pkgs/by-name/pk/pkg-config-unwrapped/gcc-15.patch new file mode 100644 index 000000000000..b210395ef113 --- /dev/null +++ b/pkgs/by-name/pk/pkg-config-unwrapped/gcc-15.patch @@ -0,0 +1,35 @@ +From 4444e3e5b7130c1664d7617e079e776ac0437661 Mon Sep 17 00:00:00 2001 +From: Dmitry Bogatov +Date: Thu, 26 Jun 2025 00:26:31 +0000 +Subject: [PATCH] Avoid using "bool" as identifier (was made a keyword in + gcc-15) + +--- + glib/glib/goption.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/glib/glib/goption.c b/glib/glib/goption.c +index 0a22f6f..bdd8837 100644 +--- a/glib/glib/goption.c ++++ b/glib/glib/goption.c +@@ -166,7 +166,7 @@ typedef struct + gpointer arg_data; + union + { +- gboolean bool; ++ gboolean bool_value; + gint integer; + gchar *str; + gchar **array; +@@ -1600,7 +1600,7 @@ free_changes_list (GOptionContext *context, + switch (change->arg_type) + { + case G_OPTION_ARG_NONE: +- *(gboolean *)change->arg_data = change->prev.bool; ++ *(gboolean *)change->arg_data = change->prev.bool_value; + break; + case G_OPTION_ARG_INT: + *(gint *)change->arg_data = change->prev.integer; +-- +2.47.2 + diff --git a/pkgs/by-name/pk/pkg-config-unwrapped/package.nix b/pkgs/by-name/pk/pkg-config-unwrapped/package.nix index bcd386b134b4..c11b6cbbf0aa 100644 --- a/pkgs/by-name/pk/pkg-config-unwrapped/package.nix +++ b/pkgs/by-name/pk/pkg-config-unwrapped/package.nix @@ -26,7 +26,8 @@ stdenv.mkDerivation rec { # http://bugs.freedesktop.org/show_bug.cgi?id=4738, migrated to # https://gitlab.freedesktop.org/pkg-config/pkg-config/issues/28 patches = - lib.optional (!vanilla) ./requires-private.patch + [ ./gcc-15.patch ] + ++ lib.optional (!vanilla) ./requires-private.patch ++ lib.optional stdenv.hostPlatform.isCygwin ./2.36.3-not-win32.patch; # These three tests fail due to a (desired) behavior change from our ./requires-private.patch From 351b2b10c2ead903c71837b48990cfe880da2232 Mon Sep 17 00:00:00 2001 From: Dmitry Bogatov Date: Fri, 27 Jun 2025 20:00:00 -0400 Subject: [PATCH 2/6] bash: Fix build with gcc-15 --- pkgs/shells/bash/5.nix | 29 +++++++++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-) diff --git a/pkgs/shells/bash/5.nix b/pkgs/shells/bash/5.nix index 66172bddd125..d11f363592f2 100644 --- a/pkgs/shells/bash/5.nix +++ b/pkgs/shells/bash/5.nix @@ -133,10 +133,31 @@ lib.warnIf (withDocs != null) enableParallelBuilding = true; - makeFlags = lib.optionals stdenv.hostPlatform.isCygwin [ - "LOCAL_LDFLAGS=-Wl,--export-all,--out-implib,libbash.dll.a" - "SHOBJ_LIBS=-lbash" - ]; + makeFlags = + lib.optionals stdenv.hostPlatform.isCygwin [ + "LOCAL_LDFLAGS=-Wl,--export-all,--out-implib,libbash.dll.a" + "SHOBJ_LIBS=-lbash" + ] + # GNU Bash extensively uses function prototypes with unspecified signature, like + # + # extern void add_unwind_protect () + # + # to implicitly cast all kinds of word-sized arguments. GCC-15 switched C standard + # from gnu17 to gnu23, which changed the meaning of the prototype above to + # + # extern void add_unwind_protect (void) + # + # Note that Bash 5.3, quoting the release announcement: + # + # > The source code has been updated for C23 conformance. This means that bash + # > will no longer compile with K&R-style C compilers. + # + # So this workaround won't be necessary after upgrade to bash=5.3. + # + # => https://lists.gnu.org/archive/html/bug-bash/2025-07/msg00005.html + # + # ~kaction 2025-07-19 + ++ [ "LOCAL_CFLAGS=-std=c99" ]; nativeCheckInputs = [ util-linux ]; doCheck = false; # dependency cycle, needs to be interactive From 2a9a83e489e867280f65ae00fc61dc14be1de883 Mon Sep 17 00:00:00 2001 From: Dmitry Bogatov Date: Fri, 27 Jun 2025 20:00:00 -0400 Subject: [PATCH 3/6] glibc: Fix build with gcc-15 --- pkgs/development/libraries/glibc/common.nix | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/pkgs/development/libraries/glibc/common.nix b/pkgs/development/libraries/glibc/common.nix index e4b9d66f7dd0..f6c9aa6755c4 100644 --- a/pkgs/development/libraries/glibc/common.nix +++ b/pkgs/development/libraries/glibc/common.nix @@ -162,6 +162,15 @@ stdenv.mkDerivation ( -#define LIBIDN2_SONAME "libidn2.so.0" +#define LIBIDN2_SONAME "${lib.getLib libidn2}/lib/libidn2.so.0" EOF + '' + # For some reason, with gcc-15 build fails with the following error: + # + # zic.c:3767:1: note: did you mean to specify it after ')' following function parameters? + # zic.c:3781:1: error: standard 'reproducible' attribute can only be applied to function declarators or type specifiers with function type [] + + '' + for path in timezone/zic.c timezone/zdump.c ; do + substituteInPlace $path --replace-fail "ATTRIBUTE_REPRODUCIBLE" "" + done ''; configureFlags = From 88686e2fe3a9657520a7bed0e0eb53e736345485 Mon Sep 17 00:00:00 2001 From: Dmitry Bogatov Date: Sun, 29 Jun 2025 01:06:06 +0000 Subject: [PATCH 4/6] gmp: Fix build with gcc-15 --- pkgs/development/libraries/gmp/6.x.nix | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pkgs/development/libraries/gmp/6.x.nix b/pkgs/development/libraries/gmp/6.x.nix index 2e3fdc532059..25e0a324ec12 100644 --- a/pkgs/development/libraries/gmp/6.x.nix +++ b/pkgs/development/libraries/gmp/6.x.nix @@ -48,6 +48,12 @@ let configureFlags = [ "--with-pic" + # gcc-15 have c23 standard by default, where "void foo()" now means "void foo(void)". + # + # The "configure" script relies on c17 and below semantics for "long long + # reliability test 1" (defined in aclocal.m4) + "CFLAGS=-std=c99" + (lib.enableFeature cxx "cxx") # Build a "fat binary", with routines for several sub-architectures # (x86), except on Solaris where some tests crash with "Memory fault". From 88b848ca71a8561be457b3e83ace14e2cc7a6501 Mon Sep 17 00:00:00 2001 From: Dmitry Bogatov Date: Sat, 28 Jun 2025 20:00:00 -0400 Subject: [PATCH 5/6] unzip: Fix build with gcc-15 --- pkgs/by-name/un/unzip/package.nix | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pkgs/by-name/un/unzip/package.nix b/pkgs/by-name/un/unzip/package.nix index 7a2f8fc8bd33..ebcc3d27c351 100644 --- a/pkgs/by-name/un/unzip/package.nix +++ b/pkgs/by-name/un/unzip/package.nix @@ -86,6 +86,11 @@ stdenv.mkDerivation rec { sha256 = "67ab260ae6adf8e7c5eda2d1d7846929b43562943ec4aff629bd7018954058b1"; }); + # gcc-15 uses c23 standard, which removed non-prototype function declarations. + postPatch = '' + sed -i '/localtime()/ d' unix/unxcfg.h + ''; + nativeBuildInputs = [ bzip2 ]; buildInputs = [ bzip2 ] ++ lib.optional enableNLS libnatspec; From 7b9606965db1764d6b473b64670535ccdbc75592 Mon Sep 17 00:00:00 2001 From: Dmitry Bogatov Date: Sun, 29 Jun 2025 20:54:27 +0000 Subject: [PATCH 6/6] ncurses: fix build with gcc-15 --- .../development/libraries/ncurses/default.nix | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/pkgs/development/libraries/ncurses/default.nix b/pkgs/development/libraries/ncurses/default.nix index df558034c7e0..6abb6e13acdb 100644 --- a/pkgs/development/libraries/ncurses/default.nix +++ b/pkgs/development/libraries/ncurses/default.nix @@ -33,6 +33,10 @@ stdenv.mkDerivation (finalAttrs: { ]; setOutputFlags = false; # some aren't supported + postPatch = '' + sed -i '1i #include ' include/curses.h.in + ''; + # see other isOpenBSD clause below configurePlatforms = if stdenv.hostPlatform.isOpenBSD then @@ -95,6 +99,22 @@ stdenv.mkDerivation (finalAttrs: { # which assumes that your openbsd is from the 90s, leading to a truly awful compiler/linker configuration. # No, autoreconfHook doesn't work. "--host=${stdenv.hostPlatform.config}${stdenv.cc.libc.version}" + ] + # Without this override, the upstream configure system results in + # + # typedef unsigned char NCURSES_BOOL; + # #define bool NCURSES_BOOL; + # + # Which breaks C++ bindings: + # + # > /nix/store/[...]-gcc-15.1.0/include/c++/15.1.0/cstddef:81:21: error: redefinition of 'struct std::__byte_operand' + # > 81 | template<> struct __byte_operand { using __type = byte; }; + # > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + # > /nix/store/[...]-gcc-15.1.0/include/c++/15.1.0/cstddef:78:21: note: previous definition of 'struct std::__byte_operand' + # > 78 | template<> struct __byte_operand { using __type = byte; }; + # + ++ [ + "cf_cv_type_of_bool=bool" ]; # Only the C compiler, and explicitly not C++ compiler needs this flag on solaris: