From 51ac0ed7fdb24f3c51d6b60e18191291a4d7a496 Mon Sep 17 00:00:00 2001 From: Amaan Qureshi Date: Mon, 26 Jan 2026 23:05:56 -0500 Subject: [PATCH] html-xml-utils: fix build with GCC 15 GCC 15 treats empty parentheses as (void), conflicting with the actual lookup_element signature generated by gperf. This was intentionally done, as version 7.7 removed the arguments because gperf 3.0 generates `unsigned int` while gperf 3.1 generates `size_t`. However, gperf 3.1 is nearly 10 years old, so it's reasonable to assume that practically every system that wants to use GCC 15 will have gperf 3.1 or later. Nixpkgs uses gperf 3.3, so we use `size_t` in the prototype. This commit also adds gperf to `nativeBuildInputs` since patching the .hash file triggers regeneration of the C source. Fixes #480448 --- pkgs/by-name/ht/html-xml-utils/gcc15.patch | 32 ++++++++++++++++++++++ pkgs/by-name/ht/html-xml-utils/package.nix | 5 ++++ 2 files changed, 37 insertions(+) create mode 100644 pkgs/by-name/ht/html-xml-utils/gcc15.patch diff --git a/pkgs/by-name/ht/html-xml-utils/gcc15.patch b/pkgs/by-name/ht/html-xml-utils/gcc15.patch new file mode 100644 index 000000000000..389b90c15297 --- /dev/null +++ b/pkgs/by-name/ht/html-xml-utils/gcc15.patch @@ -0,0 +1,32 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Amaan Qureshi +Date: Mon, 27 Jan 2026 00:00:00 -0500 +Subject: [PATCH] Fix GCC 15 build by adding proper function prototype + +GCC 15 treats empty parentheses as (void), conflicting with the actual +lookup_element signature generated by gperf. This was intentionally done, +as version 7.7 removed the arguments because gperf 3.0 generates `unsigned int` +while gperf 3.1 generates `size_t`. However, gperf 3.1 is nearly 10 years old, +so it's reasonable to assume that practically every system that wants +to use GCC 15 will have gperf 3.1 or later. + +This patch uses `size_t` to match gperf 3.1. + +--- + dtd.hash | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/dtd.hash b/dtd.hash +--- a/dtd.hash ++++ b/dtd.hash +@@ -43,8 +43,8 @@ EXPORT typedef struct _ElementType { + } ElementType; + + /* lookup_element -- look up the string in the hash table */ +-EXPORT const ElementType * lookup_element(/* register const char *str, +- register unsigned int len */); ++EXPORT const ElementType * lookup_element(register const char *str, ++ register size_t len); + + /* Different kinds of parent elements: */ + #define PHRASE "abbr", "acronym", "b", "bdi", "bdo", "big", "cite", "code", "dfn", "em", "i", "kbd", "q", "s", "samp", "small", "span", "strong", "sub", "sup", "time", "tt", "u", "var" diff --git a/pkgs/by-name/ht/html-xml-utils/package.nix b/pkgs/by-name/ht/html-xml-utils/package.nix index f2486ec224a1..c0bc244bb03c 100644 --- a/pkgs/by-name/ht/html-xml-utils/package.nix +++ b/pkgs/by-name/ht/html-xml-utils/package.nix @@ -3,6 +3,7 @@ stdenv, fetchurl, curl, + gperf, libiconv, }: @@ -15,6 +16,10 @@ stdenv.mkDerivation rec { sha256 = "sha256-iIoxYxp6cDCLsvMz4HfQQW9Lt4MX+Gl/+0qVGH9ncwE="; }; + patches = [ ./gcc15.patch ]; + + nativeBuildInputs = [ gperf ]; + buildInputs = [ curl libiconv