diff --git a/pkgs/development/libraries/science/math/spooles/allocate.patch b/pkgs/development/libraries/science/math/spooles/allocate.patch new file mode 100644 index 000000000000..71f539711e7b --- /dev/null +++ b/pkgs/development/libraries/science/math/spooles/allocate.patch @@ -0,0 +1,38 @@ +From cc153b180829c6b561765cbbb9b621d1142ff1cd Mon Sep 17 00:00:00 2001 +From: annalee <150648636+a-n-n-a-l-e-e@users.noreply.github.com> +Date: Tue, 28 Nov 2023 13:13:44 +0000 +Subject: [PATCH] use proper format specifier for size_t + +--- + Utilities/MM.h | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/Utilities/MM.h b/Utilities/MM.h +index 11e86c5..301c3ec 100644 +--- a/Utilities/MM.h ++++ b/Utilities/MM.h +@@ -33,18 +33,18 @@ if ( (count) > 0 ) { \ + if ( (ptr = (type *)malloc((unsigned long)((count)*sizeof(type)))) \ + == NULL ) {\ + fprintf(stderr, \ +- "\n ALLOCATE failure : bytes %d, line %d, file %s", \ ++ "\n ALLOCATE failure : bytes %zu, line %d, file %s", \ + (count)*sizeof(type), __LINE__, __FILE__) ; \ + exit(-1) ; } \ + else if ( MEMORY_DEBUG > 0 ) { \ + fprintf(stderr, \ +- "\n ALLOCATE : address %p, bytes %d, line %d, file %s", \ ++ "\n ALLOCATE : address %p, bytes %zu, line %d, file %s", \ + ptr, (count)*sizeof(type), __LINE__, __FILE__) ; } } \ + else if ( (count) == 0 ) { \ + ptr = NULL ; } \ + else { \ + fprintf(stderr, \ +- "\n ALLOCATE error : bytes %d, line %d, file %s", \ ++ "\n ALLOCATE error : bytes %zu, line %d, file %s", \ + (count)*sizeof(type), __LINE__, __FILE__) ; \ + exit(-1) ; } + /* +-- +2.42.0 + diff --git a/pkgs/development/libraries/science/math/spooles/default.nix b/pkgs/development/libraries/science/math/spooles/default.nix index 6e94d093a2cb..47738008b02d 100644 --- a/pkgs/development/libraries/science/math/spooles/default.nix +++ b/pkgs/development/libraries/science/math/spooles/default.nix @@ -13,10 +13,14 @@ stdenv.mkDerivation rec { patches = [ ./spooles.patch + # fix compiler error where NULL is used as a zero parameter + ./transform.patch + # use proper format specifier for size_t + ./allocate.patch ]; postPatch = lib.optionalString stdenv.hostPlatform.isDarwin '' - substituteInPlace makefile --replace '-Wl,-soname' '-Wl,-install_name' + substituteInPlace makefile --replace "-Wl,-soname," "-Wl,-install_name,$out/lib/" ''; buildPhase = '' diff --git a/pkgs/development/libraries/science/math/spooles/transform.patch b/pkgs/development/libraries/science/math/spooles/transform.patch new file mode 100644 index 000000000000..3be3babe9d65 --- /dev/null +++ b/pkgs/development/libraries/science/math/spooles/transform.patch @@ -0,0 +1,43 @@ +From c5d0574182d76af3bf286dce0bb147ae3f098916 Mon Sep 17 00:00:00 2001 +From: annalee <150648636+a-n-n-a-l-e-e@users.noreply.github.com> +Date: Tue, 28 Nov 2023 12:57:18 +0000 +Subject: [PATCH] fix compiler error: use zero, not NULL, in calls to IVinit + +--- + ETree/src/transform.c | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/ETree/src/transform.c b/ETree/src/transform.c +index 1e36981..dbdfc70 100644 +--- a/ETree/src/transform.c ++++ b/ETree/src/transform.c +@@ -291,7 +291,7 @@ etree2 = ETree_compress(etree, mapIV) ; + remap the nzeros[] vector + ------------------------- + */ +-temp = IVinit(nfront, NULL) ; ++temp = IVinit(nfront, 0) ; + IVcopy(nfront, temp, nzeros) ; + IV_setSize(nzerosIV, nnew) ; + nzeros = IV_entries(nzerosIV) ; +@@ -453,7 +453,7 @@ etree2 = ETree_compress(etree, mapIV) ; + remap the nzeros[] vector + ------------------------- + */ +-temp = IVinit(nfront, NULL) ; ++temp = IVinit(nfront, 0) ; + IVcopy(nfront, temp, nzeros) ; + IV_setSize(nzerosIV, nnew) ; + nzeros = IV_entries(nzerosIV) ; +@@ -614,7 +614,7 @@ etree2 = ETree_compress(etree, mapIV) ; + remap the nzeros[] vector + ------------------------- + */ +-temp = IVinit(nfront, NULL) ; ++temp = IVinit(nfront, 0) ; + IVcopy(nfront, temp, nzeros) ; + IV_setSize(nzerosIV, nnew) ; + nzeros = IV_entries(nzerosIV) ; +-- +2.42.0 +