From 4de4b6da1df2542acb2e165a51b6c9f86a52cd19 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aleix=20Bon=C3=A9?= Date: Tue, 2 Dec 2025 15:03:46 +0100 Subject: [PATCH] Fix papi cross compilation --- overlay.nix | 1 + pkgs/papi/default.nix | 22 ++++++++++++++++++++++ pkgs/papi/fix-ar-cross.patch | 19 +++++++++++++++++++ 3 files changed, 42 insertions(+) create mode 100644 pkgs/papi/default.nix create mode 100644 pkgs/papi/fix-ar-cross.patch diff --git a/overlay.nix b/overlay.nix index 0683b8b..27d92c5 100644 --- a/overlay.nix +++ b/overlay.nix @@ -49,6 +49,7 @@ let osumb = callPackage ./pkgs/osu/default.nix { }; ovni = callPackage ./pkgs/ovni/default.nix { }; ovniGit = final.ovni.override { useGit = true; }; + papi = callPackage ./pkgs/papi/default.nix { papi = prev.papi; }; paraverKernel = callPackage ./pkgs/paraver/kernel.nix { }; prometheus-slurm-exporter = prev.callPackage ./pkgs/slurm-exporter/default.nix { }; #pscom = callPackage ./pkgs/parastation/pscom.nix { }; # Unmaintaned diff --git a/pkgs/papi/default.nix b/pkgs/papi/default.nix new file mode 100644 index 0000000..57d8c10 --- /dev/null +++ b/pkgs/papi/default.nix @@ -0,0 +1,22 @@ +{ + stdenv, + papi, +}: + +if stdenv.hostPlatform == stdenv.buildPlatform then + papi +else + papi.overrideAttrs (old: { + configureFlags = (old.configureFlags or [ ]) ++ [ + "--enable-perf_event_uncore=no" + "--with-sysdetect=no" + "--with-ffsll" + "--with-tls=__thread" + "--with-virtualtimer=clock_thread_cputime_id" + "--with-walltimer=clock_realtime" + "--with-perf-events" + "--with-CPU=${stdenv.hostPlatform.uname.processor}" + "--with-arch=${stdenv.hostPlatform.uname.processor}" + ]; + patches = (old.patches or [ ]) ++ [ ./fix-ar-cross.patch ]; + }) diff --git a/pkgs/papi/fix-ar-cross.patch b/pkgs/papi/fix-ar-cross.patch new file mode 100644 index 0000000..7adc035 --- /dev/null +++ b/pkgs/papi/fix-ar-cross.patch @@ -0,0 +1,19 @@ +diff --git a/sde_lib/Makefile b/sde_lib/Makefile +index 8518f92..90a9953 100644 +--- a/sde_lib/Makefile ++++ b/sde_lib/Makefile +@@ -1,4 +1,5 @@ + CC ?= gcc ++AR ?= ar + SDE_INC = -I. -I.. + SDE_LD = -ldl -pthread + CFLAGS += -Wextra -Wall -O2 +@@ -18,7 +19,7 @@ dynamic: $(DOBJS) + rm -f *_d.o + + static: $(SOBJS) +- ar rs libsde.a $(SOBJS) ++ $(AR) rs libsde.a $(SOBJS) + rm -f *_s.o + + clean: