Fix lmbench build issues with GCC 14

Reviewed-by: Aleix Boné <abonerib@bsc.es>
Tested-by: Rodrigo Arias Mallo <rodrigo.arias@bsc.es>
This commit is contained in:
Rodrigo Arias 2025-07-21 17:52:06 +02:00
parent 88d4d8e317
commit 974bb56dc3
3 changed files with 82 additions and 7 deletions

View File

@ -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
)

View File

@ -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

77
pkgs/lmbench/gcc-14.patch Normal file
View File

@ -0,0 +1,77 @@
From a3c6e7d303cd8368e8d4e35be7cbc1997e801257 Mon Sep 17 00:00:00 2001
From: Rodrigo Arias Mallo <rodrigo.arias@bsc.es>
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 <math.h>
/*
* 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