From 34e34f6971444724542f921764a525efd2323bd7 Mon Sep 17 00:00:00 2001 From: Lukas Rieger Date: Fri, 13 Mar 2026 20:55:50 +0100 Subject: [PATCH] gnutls: fix cross-compilation failure since 3.8.12 The 3.8.12 release tarball is missing `stamp_error_codes` from EXTRA_DIST, causing the build system to regenerate it by compiling and running the `errcodes` tool. When cross-compiling, the resulting binary is for the target architecture and cannot execute on the build host: ./errcodes: cannot execute binary file: Exec format error Touch the stamp file during postPatch when cross-compiling so the build system skips regeneration. Upstream bug: https://gitlab.com/gnutls/gnutls/-/issues/1797 Fixes: https://github.com/NixOS/nixpkgs/issues/493526 Workaround suggested by @jackwilsdon in #493526. Co-Authored-By: Claude Opus 4.6 (1M context) --- pkgs/by-name/gn/gnutls/package.nix | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/pkgs/by-name/gn/gnutls/package.nix b/pkgs/by-name/gn/gnutls/package.nix index f47370729a2e..3a7326cc212c 100644 --- a/pkgs/by-name/gn/gnutls/package.nix +++ b/pkgs/by-name/gn/gnutls/package.nix @@ -117,6 +117,13 @@ stdenv.mkDerivation rec { # https://gitlab.com/gnutls/gnutls/-/issues/1721 + '' sed '2iexit 77' -i tests/system-override-compress-cert.sh + '' + # Upstream packaging bug: stamp_error_codes is missing from EXTRA_DIST in + # the release tarball, causing the build to try regenerating it by compiling + # and running `errcodes` — which fails when cross-compiling since the binary + # is for the target architecture. https://gitlab.com/gnutls/gnutls/-/issues/1797 + + lib.optionalString (stdenv.buildPlatform != stdenv.hostPlatform) '' + touch doc/stamp_error_codes ''; preConfigure = "patchShebangs .";