diff --git a/pkgs/lmbench/default.nix b/pkgs/lmbench/default.nix index 9c48dd12..cfe23495 100644 --- a/pkgs/lmbench/default.nix +++ b/pkgs/lmbench/default.nix @@ -17,16 +17,12 @@ stdenv.mkDerivation rec { sha256 = "sha256-SzwplRBO3V0R3m3p15n71ivYBMGoLsajFK2TapYxdqk="; }; - postUnpack = '' - export sourceRoot="$sourceRoot/src" - ''; - postPatch = '' sed -i "s@/bin/rm@rm@g" $(find . -name Makefile) ''; buildInputs = [ libtirpc ]; - patches = [ ./fix-install.patch ]; + patches = [ ./fix-install.patch ./gcc-14.patch ]; hardeningDisable = [ "all" ]; @@ -34,7 +30,9 @@ stdenv.mkDerivation rec { preBuild = '' makeFlagsArray+=( + -C src BASE=$out + CFLAGS=-Wno-implicit-int CPPFLAGS=-I${libtirpc.dev}/include/tirpc LDFLAGS=-ltirpc ) diff --git a/pkgs/lmbench/fix-install.patch b/pkgs/lmbench/fix-install.patch index f539254a..89543b83 100644 --- a/pkgs/lmbench/fix-install.patch +++ b/pkgs/lmbench/fix-install.patch @@ -1,5 +1,5 @@ ---- a/Makefile -+++ b/Makefile +--- a/src/Makefile ++++ b/src/Makefile @@ -144,6 +144,7 @@ install-target: if [ ! -d $(BASE)/include ]; then mkdir $(BASE)/include; fi if [ ! -d $(BASE)/lib ]; then mkdir $(BASE)/lib; fi diff --git a/pkgs/lmbench/gcc-14.patch b/pkgs/lmbench/gcc-14.patch new file mode 100644 index 00000000..0af0c427 --- /dev/null +++ b/pkgs/lmbench/gcc-14.patch @@ -0,0 +1,77 @@ +From a3c6e7d303cd8368e8d4e35be7cbc1997e801257 Mon Sep 17 00:00:00 2001 +From: Rodrigo Arias Mallo +Date: Mon, 21 Jul 2025 17:38:58 +0200 +Subject: [PATCH] Misc fixes to build with gcc 14 + +--- + src/bench.h | 2 ++ + src/lat_select.c | 2 +- + src/lib_debug.c | 1 + + src/lib_sched.c | 2 +- + src/lib_timing.c | 2 +- + 5 files changed, 6 insertions(+), 3 deletions(-) + +diff --git a/src/bench.h b/src/bench.h +index 8166408..4da9079 100644 +--- a/src/bench.h ++++ b/src/bench.h +@@ -320,4 +320,6 @@ extern int handle_scheduler(int childno, int benchproc, int nbenchprocs); + extern char *rpc_xact_1(); + extern char *client_rpc_xact_1(); + ++void lmbench_usage(int argc, char *argv[], char* usage); ++ + #endif /* _BENCH_H */ +diff --git a/src/lat_select.c b/src/lat_select.c +index 583b505..39df369 100644 +--- a/src/lat_select.c ++++ b/src/lat_select.c +@@ -164,7 +164,7 @@ doit(iter_t iterations, void * cookie) + state_t * state = (state_t *)cookie; + fd_set nosave; + static struct timeval tv; +- static count = 0; ++ static int count = 0; + + tv.tv_sec = 0; + tv.tv_usec = 0; +diff --git a/src/lib_debug.c b/src/lib_debug.c +index e8347dd..cf65312 100644 +--- a/src/lib_debug.c ++++ b/src/lib_debug.c +@@ -1,5 +1,6 @@ + #include "bench.h" + #include "lib_debug.h" ++#include + + /* + * return micro-seconds / iteration at the the fraction point. +diff --git a/src/lib_sched.c b/src/lib_sched.c +index aa83ae0..4f16bbf 100644 +--- a/src/lib_sched.c ++++ b/src/lib_sched.c +@@ -91,7 +91,7 @@ handle_scheduler(int childno, int benchproc, int nbenchprocs) + childno * (nbenchprocs + 1) + benchproc); + } else { + /* default action: do nothing */ +- return; ++ return 0; + } + + return sched_pin(cpu % sched_ncpus()); +diff --git a/src/lib_timing.c b/src/lib_timing.c +index af8cf68..7ec9652 100644 +--- a/src/lib_timing.c ++++ b/src/lib_timing.c +@@ -1623,7 +1623,7 @@ bread(void* buf, long nbytes) + void + touch(char *buf, int nbytes) + { +- static psize; ++ static int psize; + + if (!psize) { + psize = getpagesize(); +-- +2.49.0 +