From 7fee6ed25386a600d6bcdded728a7d3d6ad7e15c Mon Sep 17 00:00:00 2001 From: Moritz Angermann Date: Fri, 29 Nov 2024 21:41:16 +0900 Subject: [PATCH 1/2] fix potentially broken install_name_tool We by default try to pull the one from the targetCC, only if that fails fall back to the bintools one. --- compiler/ghc/default.nix | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/compiler/ghc/default.nix b/compiler/ghc/default.nix index 420e802697..c1bed5da83 100644 --- a/compiler/ghc/default.nix +++ b/compiler/ghc/default.nix @@ -434,7 +434,11 @@ stdenv.mkDerivation (rec { export STRIP="${bintoolsFor.strip}/bin/${bintoolsFor.strip.targetPrefix}strip" '' + lib.optionalString (stdenv.targetPlatform.linker == "cctools") '' export OTOOL="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}otool" - export INSTALL_NAME_TOOL="${bintoolsFor.install_name_tool}/bin/${bintoolsFor.install_name_tool.targetPrefix}install_name_tool" + if [ -f ${targetCC}/bin/install_name_tool ]; then + export INSTALL_NAME_TOOL="${targetCC}/bin/${targetCC.targetPrefix}install_name_tool" + else + export INSTALL_NAME_TOOL="${bintoolsFor.install_name_tool}/bin/${bintoolsFor.install_name_tool.targetPrefix}install_name_tool" + fi '') + lib.optionalString (targetPlatform == hostPlatform && useLdGold) # set LD explicitly if we want gold even if we aren't cross compiling '' From de3471c1240b61b64925ccf660fa0df97e55f103 Mon Sep 17 00:00:00 2001 From: Hamish Mackenzie Date: Tue, 3 Dec 2024 11:53:16 +1300 Subject: [PATCH 2/2] Consistent use of `${targetCC.targetPrefix}` --- compiler/ghc/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/ghc/default.nix b/compiler/ghc/default.nix index c1bed5da83..1bafff3d33 100644 --- a/compiler/ghc/default.nix +++ b/compiler/ghc/default.nix @@ -434,7 +434,7 @@ stdenv.mkDerivation (rec { export STRIP="${bintoolsFor.strip}/bin/${bintoolsFor.strip.targetPrefix}strip" '' + lib.optionalString (stdenv.targetPlatform.linker == "cctools") '' export OTOOL="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}otool" - if [ -f ${targetCC}/bin/install_name_tool ]; then + if [ -f ${targetCC}/bin/${targetCC.targetPrefix}install_name_tool ]; then export INSTALL_NAME_TOOL="${targetCC}/bin/${targetCC.targetPrefix}install_name_tool" else export INSTALL_NAME_TOOL="${bintoolsFor.install_name_tool}/bin/${bintoolsFor.install_name_tool.targetPrefix}install_name_tool"