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 1904b4d1cd71..182fbc77cda0 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 (finalAttrs: {
sha256 = "sha256-iIoxYxp6cDCLsvMz4HfQQW9Lt4MX+Gl/+0qVGH9ncwE=";
};
+ patches = [ ./gcc15.patch ];
+
+ nativeBuildInputs = [ gperf ];
+
buildInputs = [
curl
libiconv