From a8bfb6dcd76fe128ff9308a35f9d3fcc50652ed8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aleix=20Bon=C3=A9?= Date: Mon, 29 Sep 2025 15:37:26 +0200 Subject: [PATCH] Fix cross compilation for lmbench --- pkgs/lmbench/default.nix | 8 +++++++- pkgs/lmbench/fix-cross.patch | 13 +++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 pkgs/lmbench/fix-cross.patch diff --git a/pkgs/lmbench/default.nix b/pkgs/lmbench/default.nix index cfe23495..0c7b824c 100644 --- a/pkgs/lmbench/default.nix +++ b/pkgs/lmbench/default.nix @@ -22,7 +22,11 @@ stdenv.mkDerivation rec { ''; buildInputs = [ libtirpc ]; - patches = [ ./fix-install.patch ./gcc-14.patch ]; + patches = [ + ./fix-install.patch + ./gcc-14.patch + ./fix-cross.patch + ]; hardeningDisable = [ "all" ]; @@ -35,6 +39,8 @@ stdenv.mkDerivation rec { CFLAGS=-Wno-implicit-int CPPFLAGS=-I${libtirpc.dev}/include/tirpc LDFLAGS=-ltirpc + CC=${stdenv.cc.targetPrefix}cc + AR=${stdenv.cc.targetPrefix}ar ) ''; diff --git a/pkgs/lmbench/fix-cross.patch b/pkgs/lmbench/fix-cross.patch new file mode 100644 index 00000000..4125d5be --- /dev/null +++ b/pkgs/lmbench/fix-cross.patch @@ -0,0 +1,13 @@ +diff --git a/src/Makefile b/src/Makefile +index 2555014..356eeb3 100644 +--- a/src/Makefile ++++ b/src/Makefile +@@ -36,7 +36,7 @@ SHELL=/bin/sh + + CC=`../scripts/compiler` + MAKE=`../scripts/make` +-AR=ar ++AR?=ar + ARCREATE=cr + + # base of installation location