From 6b4db724eb52eaeb0a78b11f707fbe211e844dc1 Mon Sep 17 00:00:00 2001 From: Xiangyan Sun Date: Thu, 2 Apr 2026 13:57:54 -0700 Subject: [PATCH] fastcap: fix build with gcc15 --- .../fastcap-mulglobal-add-ualloc-declaration.patch | 12 ++++++++++++ pkgs/by-name/fa/fastcap/package.nix | 13 ++++++++++--- 2 files changed, 22 insertions(+), 3 deletions(-) create mode 100644 pkgs/by-name/fa/fastcap/fastcap-mulglobal-add-ualloc-declaration.patch diff --git a/pkgs/by-name/fa/fastcap/fastcap-mulglobal-add-ualloc-declaration.patch b/pkgs/by-name/fa/fastcap/fastcap-mulglobal-add-ualloc-declaration.patch new file mode 100644 index 000000000000..4ca9628bb905 --- /dev/null +++ b/pkgs/by-name/fa/fastcap/fastcap-mulglobal-add-ualloc-declaration.patch @@ -0,0 +1,12 @@ +Fix implicit int truncating points in 64 bit systems. +--- a/src/mulGlobal.h ++++ b/src/mulGlobal.h +@@ -77,6 +77,8 @@ + /* #define MALCORE malloc */ + #define MALCORE ualloc + ++extern char *ualloc(unsigned int); ++ + /* counts of memory usage by multipole matrix type */ + extern long memcount; + extern long memQ2M; diff --git a/pkgs/by-name/fa/fastcap/package.nix b/pkgs/by-name/fa/fastcap/package.nix index cc6cb1a41d38..b0f5b9490943 100644 --- a/pkgs/by-name/fa/fastcap/package.nix +++ b/pkgs/by-name/fa/fastcap/package.nix @@ -19,6 +19,7 @@ stdenv.mkDerivation (finalAttrs: { patches = [ ./fastcap-mulglobal-drop-conflicting-lib.patch ./fastcap-mulsetup-add-forward-declarations.patch + ./fastcap-mulglobal-add-ualloc-declaration.patch ]; nativeBuildInputs = [ @@ -28,7 +29,7 @@ stdenv.mkDerivation (finalAttrs: { postPatch = '' substituteInPlace ./doc/Makefile \ - --replace '/bin/rm' 'rm' + --replace-fail '/bin/rm' 'rm' for f in "doc/*.tex" ; do sed -i -E $f \ @@ -54,8 +55,14 @@ stdenv.mkDerivation (finalAttrs: { "all" ]; - # GCC 14 makes these errors by default - env.NIX_CFLAGS_COMPILE = "-Wno-error=implicit-function-declaration -Wno-error=return-mismatch -Wno-error=implicit-int"; + env.NIX_CFLAGS_COMPILE = toString [ + # gcc14 + "-Wno-error=implicit-function-declaration" + "-Wno-error=return-mismatch" + "-Wno-error=implicit-int" + # gcc15 + "-std=gnu17" + ]; outputs = [ "out"