From 42a6b873a601f5069a9cd7c153c200534e41bd23 Mon Sep 17 00:00:00 2001 From: Randy Eckenrode Date: Sat, 21 Sep 2024 08:34:44 -0400 Subject: [PATCH] hello: make sure libiconv is linked MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Because the Darwin SDK automatically propagates libiconv, it is no longer linked automatically (because that would link libiconv to everything whether it wanted it or not). hello is failing to link not because it assumes libiconv comes with libc but because of a bug in its build system. The `configure` script detects how to link libiconv, but `Makefile.am` does not make use of that to link libiconv when it is needed. Unfortunately, patching `Makefile.am` can’t be done because using `autoreconfHook` will update some gettext stuff with an incompatible version, causing an error when building. --- pkgs/by-name/he/hello/package.nix | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/pkgs/by-name/he/hello/package.nix b/pkgs/by-name/he/hello/package.nix index 659899bd5f9b..d56423eea6cf 100644 --- a/pkgs/by-name/he/hello/package.nix +++ b/pkgs/by-name/he/hello/package.nix @@ -17,6 +17,13 @@ stdenv.mkDerivation (finalAttrs: { hash = "sha256-jZkUKv2SV28wsM18tCqNxoCZmLxdYH2Idh9RLibH2yA="; }; + # The GNU Hello `configure` script detects how to link libiconv but fails to actually make use of that. + # Unfortunately, this cannot be a patch to `Makefile.am` because `autoreconfHook` causes a gettext + # infrastructure mismatch error when trying to build `hello`. + env = lib.optionalAttrs stdenv.hostPlatform.isDarwin { + NIX_LDFLAGS = "-liconv"; + }; + doCheck = true; doInstallCheck = true;