Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

spooles: fix compiler errors and link properly; fix darwin build #270901

Merged
merged 1 commit into from Dec 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions pkgs/development/libraries/science/math/spooles/allocate.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
From cc153b180829c6b561765cbbb9b621d1142ff1cd Mon Sep 17 00:00:00 2001
From: annalee <[email protected]>
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

6 changes: 5 additions & 1 deletion pkgs/development/libraries/science/math/spooles/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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 = ''
Expand Down
43 changes: 43 additions & 0 deletions pkgs/development/libraries/science/math/spooles/transform.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
From c5d0574182d76af3bf286dce0bb147ae3f098916 Mon Sep 17 00:00:00 2001
From: annalee <[email protected]>
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