From 017015a82b6ceb8045e2ba446664b19218f77c9a Mon Sep 17 00:00:00 2001 From: Weijia Wang <9713184+wegank@users.noreply.github.com> Date: Tue, 1 Nov 2022 16:21:54 +0100 Subject: [PATCH 1/4] aspino: fix build --- pkgs/applications/science/logic/aspino/default.nix | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/pkgs/applications/science/logic/aspino/default.nix b/pkgs/applications/science/logic/aspino/default.nix index a9e39b3daf33..13ee15bc781d 100644 --- a/pkgs/applications/science/logic/aspino/default.nix +++ b/pkgs/applications/science/logic/aspino/default.nix @@ -23,7 +23,10 @@ stdenv.mkDerivation { postPatch = '' substituteInPlace Makefile \ --replace "GCC = g++" "GCC = c++" - + substituteInPlace src/main.cc \ + --replace "defined(__linux__)" "defined(__linux__) && defined(__x86_64__)" + substituteInPlace src/MaxSatSolver.cc \ + --replace "occ[i][sign(softLiterals[j])] > 0" "occ[i][sign(softLiterals[j])] != 0" patchShebangs . ''; @@ -45,9 +48,5 @@ stdenv.mkDerivation { platforms = platforms.unix; license = licenses.asl20; homepage = "https://alviano.net/software/maxino/"; - # See pkgs/applications/science/logic/glucose/default.nix - badPlatforms = [ "aarch64-linux" ]; - # src/MaxSatSolver.cc:280:62: error: ordered comparison between pointer and zero ('unsigned int *' and 'int') - broken = (stdenv.isDarwin && stdenv.isx86_64); # broken since 2019-05-07 on hydra }; } From ee09ecaca2da84b31df8bd25ac8c7f0274607354 Mon Sep 17 00:00:00 2001 From: Weijia Wang <9713184+wegank@users.noreply.github.com> Date: Tue, 1 Nov 2022 16:22:30 +0100 Subject: [PATCH 2/4] glucose: fix build on aarch64-linux --- pkgs/applications/science/logic/glucose/default.nix | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/pkgs/applications/science/logic/glucose/default.nix b/pkgs/applications/science/logic/glucose/default.nix index 5ba8208d6e18..b9ca741a3477 100644 --- a/pkgs/applications/science/logic/glucose/default.nix +++ b/pkgs/applications/science/logic/glucose/default.nix @@ -8,6 +8,11 @@ stdenv.mkDerivation rec { sha256 = "0aahrkaq7n0z986fpqz66yz946nxardfi6dh8calzcfjpvqiraji"; }; + postPatch = '' + substituteInPlace Main.cc \ + --replace "defined(__linux__)" "defined(__linux__) && defined(__x86_64__)" + ''; + buildInputs = [ zlib ]; sourceRoot = "glucose-syrup-${version}/simp"; @@ -23,7 +28,5 @@ stdenv.mkDerivation rec { license = licenses.mit; platforms = platforms.unix; maintainers = with maintainers; [ gebner ]; - # Build uses _FPU_EXTENDED macro - badPlatforms = [ "aarch64-linux" ]; }; } From fc653e9de001fd38e6bed96405f66959ebc97a34 Mon Sep 17 00:00:00 2001 From: Weijia Wang <9713184+wegank@users.noreply.github.com> Date: Tue, 1 Nov 2022 17:17:55 +0100 Subject: [PATCH 3/4] avy: fix build on aarch64-linux --- .../science/logic/avy/default.nix | 3 -- .../science/logic/avy/glucose-fenv.patch | 40 ++++++++----------- .../science/logic/avy/minisat-fenv.patch | 38 +++++++----------- 3 files changed, 31 insertions(+), 50 deletions(-) diff --git a/pkgs/applications/science/logic/avy/default.nix b/pkgs/applications/science/logic/avy/default.nix index fe2f30a55a33..f6f43f1b0bb3 100644 --- a/pkgs/applications/science/logic/avy/default.nix +++ b/pkgs/applications/science/logic/avy/default.nix @@ -43,8 +43,5 @@ stdenv.mkDerivation rec { license = lib.licenses.mit; maintainers = with lib.maintainers; [ thoughtpolice ]; platforms = lib.platforms.linux; - # See pkgs/applications/science/logic/glucose/default.nix - # (The error is different due to glucose-fenv.patch, but the same) - badPlatforms = [ "aarch64-linux" ]; }; } diff --git a/pkgs/applications/science/logic/avy/glucose-fenv.patch b/pkgs/applications/science/logic/avy/glucose-fenv.patch index dd19f7ec80e7..eb0b196966b8 100644 --- a/pkgs/applications/science/logic/avy/glucose-fenv.patch +++ b/pkgs/applications/science/logic/avy/glucose-fenv.patch @@ -1,24 +1,15 @@ -From d6e0cb60270e8653bda3f339e3a07ce2cd2d6eb0 Mon Sep 17 00:00:00 2001 -From: Will Dietz -Date: Tue, 17 Oct 2017 23:01:36 -0500 -Subject: [PATCH] glucose: use fenv to set double precision - ---- - core/Main.cc | 8 ++++++-- - simp/Main.cc | 8 ++++++-- - utils/System.h | 2 +- - 3 files changed, 13 insertions(+), 5 deletions(-) - diff --git a/core/Main.cc b/core/Main.cc -index c96aadd..994132b 100644 +index fd8fca1..37d2ed5 100644 --- a/core/Main.cc +++ b/core/Main.cc -@@ -96,8 +96,12 @@ int main(int argc, char** argv) +@@ -95,9 +95,13 @@ int main(int argc, char** argv) + setUsageHelp("c USAGE: %s [options] \n\n where input may be either in plain or gzipped DIMACS.\n"); // printf("This is MiniSat 2.0 beta\n"); - - #if defined(__linux__) + +-#if defined(__linux__) - fpu_control_t oldcw, newcw; - _FPU_GETCW(oldcw); newcw = (oldcw & ~_FPU_EXTENDED) | _FPU_DOUBLE; _FPU_SETCW(newcw); ++#if defined(__linux__) && defined(__x86_64__) + fenv_t fenv; + + fegetenv(&fenv); @@ -29,15 +20,17 @@ index c96aadd..994132b 100644 #endif // Extra options: diff --git a/simp/Main.cc b/simp/Main.cc -index 4f4772d..70c2e4b 100644 +index 4f4772d..c605f6e 100644 --- a/simp/Main.cc +++ b/simp/Main.cc -@@ -97,8 +97,12 @@ int main(int argc, char** argv) +@@ -96,9 +96,13 @@ int main(int argc, char** argv) + setUsageHelp("c USAGE: %s [options] \n\n where input may be either in plain or gzipped DIMACS.\n"); - #if defined(__linux__) +-#if defined(__linux__) - fpu_control_t oldcw, newcw; - _FPU_GETCW(oldcw); newcw = (oldcw & ~_FPU_EXTENDED) | _FPU_DOUBLE; _FPU_SETCW(newcw); ++#if defined(__linux__) && defined(__x86_64__) + fenv_t fenv; + + fegetenv(&fenv); @@ -48,18 +41,17 @@ index 4f4772d..70c2e4b 100644 #endif // Extra options: diff --git a/utils/System.h b/utils/System.h -index 004d498..a768e99 100644 +index 004d498..2f6d922 100644 --- a/utils/System.h +++ b/utils/System.h -@@ -22,7 +22,7 @@ OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWA +@@ -21,8 +21,8 @@ OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWA + #ifndef Glucose_System_h #define Glucose_System_h - #if defined(__linux__) +-#if defined(__linux__) -#include ++#if defined(__linux__) && defined(__x86_64__) +#include #endif #include "glucose/mtl/IntTypes.h" --- -2.14.2 - diff --git a/pkgs/applications/science/logic/avy/minisat-fenv.patch b/pkgs/applications/science/logic/avy/minisat-fenv.patch index 686d5a1c5b49..31e481bd6696 100644 --- a/pkgs/applications/science/logic/avy/minisat-fenv.patch +++ b/pkgs/applications/science/logic/avy/minisat-fenv.patch @@ -1,24 +1,15 @@ -From 7f1016ceab9b0f57a935bd51ca6df3d18439b472 Mon Sep 17 00:00:00 2001 -From: Will Dietz -Date: Tue, 17 Oct 2017 22:57:02 -0500 -Subject: [PATCH] use fenv instead of non-standard fpu_control - ---- - core/Main.cc | 8 ++++++-- - simp/Main.cc | 8 ++++++-- - utils/System.h | 2 +- - 3 files changed, 13 insertions(+), 5 deletions(-) - diff --git a/core/Main.cc b/core/Main.cc -index 2b0d97b..8ad95fb 100644 +index 2b0d97b..9ba985d 100644 --- a/core/Main.cc +++ b/core/Main.cc -@@ -78,8 +78,12 @@ int main(int argc, char** argv) +@@ -77,9 +77,13 @@ int main(int argc, char** argv) + setUsageHelp("USAGE: %s [options] \n\n where input may be either in plain or gzipped DIMACS.\n"); // printf("This is MiniSat 2.0 beta\n"); - #if defined(__linux__) +-#if defined(__linux__) - fpu_control_t oldcw, newcw; - _FPU_GETCW(oldcw); newcw = (oldcw & ~_FPU_EXTENDED) | _FPU_DOUBLE; _FPU_SETCW(newcw); ++#if defined(__linux__) && defined(__x86_64__) + fenv_t fenv; + + fegetenv(&fenv); @@ -29,15 +20,17 @@ index 2b0d97b..8ad95fb 100644 #endif // Extra options: diff --git a/simp/Main.cc b/simp/Main.cc -index 2804d7f..39bfb71 100644 +index 2804d7f..7fbdb33 100644 --- a/simp/Main.cc +++ b/simp/Main.cc -@@ -79,8 +79,12 @@ int main(int argc, char** argv) +@@ -78,9 +78,13 @@ int main(int argc, char** argv) + setUsageHelp("USAGE: %s [options] \n\n where input may be either in plain or gzipped DIMACS.\n"); // printf("This is MiniSat 2.0 beta\n"); - #if defined(__linux__) +-#if defined(__linux__) - fpu_control_t oldcw, newcw; - _FPU_GETCW(oldcw); newcw = (oldcw & ~_FPU_EXTENDED) | _FPU_DOUBLE; _FPU_SETCW(newcw); ++#if defined(__linux__) && defined(__x86_64__) + fenv_t fenv; + + fegetenv(&fenv); @@ -48,18 +41,17 @@ index 2804d7f..39bfb71 100644 #endif // Extra options: diff --git a/utils/System.h b/utils/System.h -index 1758192..c0ad13a 100644 +index 1758192..840bee5 100644 --- a/utils/System.h +++ b/utils/System.h -@@ -22,7 +22,7 @@ OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWA +@@ -21,8 +21,8 @@ OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWA + #ifndef Minisat_System_h #define Minisat_System_h - #if defined(__linux__) +-#if defined(__linux__) -#include ++#if defined(__linux__) && defined(__x86_64__) +#include #endif #include "mtl/IntTypes.h" --- -2.14.2 - From c00ddaf144e85a3d1202437b19960f800fa3aeb7 Mon Sep 17 00:00:00 2001 From: Weijia Wang <9713184+wegank@users.noreply.github.com> Date: Fri, 25 Nov 2022 16:48:27 +0100 Subject: [PATCH 4/4] aspino: remove patchShebangs --- pkgs/applications/science/logic/aspino/default.nix | 1 - 1 file changed, 1 deletion(-) diff --git a/pkgs/applications/science/logic/aspino/default.nix b/pkgs/applications/science/logic/aspino/default.nix index 13ee15bc781d..6b0e75de8066 100644 --- a/pkgs/applications/science/logic/aspino/default.nix +++ b/pkgs/applications/science/logic/aspino/default.nix @@ -27,7 +27,6 @@ stdenv.mkDerivation { --replace "defined(__linux__)" "defined(__linux__) && defined(__x86_64__)" substituteInPlace src/MaxSatSolver.cc \ --replace "occ[i][sign(softLiterals[j])] > 0" "occ[i][sign(softLiterals[j])] != 0" - patchShebangs . ''; preBuild = ''