avy: fix build on aarch64-linux

This commit is contained in:
Weijia Wang 2022-11-01 17:17:55 +01:00
parent ee09ecaca2
commit fc653e9de0
3 changed files with 31 additions and 50 deletions

View file

@ -43,8 +43,5 @@ stdenv.mkDerivation rec {
license = lib.licenses.mit; license = lib.licenses.mit;
maintainers = with lib.maintainers; [ thoughtpolice ]; maintainers = with lib.maintainers; [ thoughtpolice ];
platforms = lib.platforms.linux; 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" ];
}; };
} }

View file

@ -1,24 +1,15 @@
From d6e0cb60270e8653bda3f339e3a07ce2cd2d6eb0 Mon Sep 17 00:00:00 2001
From: Will Dietz <w@wdtz.org>
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 diff --git a/core/Main.cc b/core/Main.cc
index c96aadd..994132b 100644 index fd8fca1..37d2ed5 100644
--- a/core/Main.cc --- a/core/Main.cc
+++ b/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] <input-file> <result-output-file>\n\n where input may be either in plain or gzipped DIMACS.\n");
// printf("This is MiniSat 2.0 beta\n"); // printf("This is MiniSat 2.0 beta\n");
#if defined(__linux__) -#if defined(__linux__)
- fpu_control_t oldcw, newcw; - fpu_control_t oldcw, newcw;
- _FPU_GETCW(oldcw); newcw = (oldcw & ~_FPU_EXTENDED) | _FPU_DOUBLE; _FPU_SETCW(newcw); - _FPU_GETCW(oldcw); newcw = (oldcw & ~_FPU_EXTENDED) | _FPU_DOUBLE; _FPU_SETCW(newcw);
+#if defined(__linux__) && defined(__x86_64__)
+ fenv_t fenv; + fenv_t fenv;
+ +
+ fegetenv(&fenv); + fegetenv(&fenv);
@ -29,15 +20,17 @@ index c96aadd..994132b 100644
#endif #endif
// Extra options: // Extra options:
diff --git a/simp/Main.cc b/simp/Main.cc diff --git a/simp/Main.cc b/simp/Main.cc
index 4f4772d..70c2e4b 100644 index 4f4772d..c605f6e 100644
--- a/simp/Main.cc --- a/simp/Main.cc
+++ b/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] <input-file> <result-output-file>\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_control_t oldcw, newcw;
- _FPU_GETCW(oldcw); newcw = (oldcw & ~_FPU_EXTENDED) | _FPU_DOUBLE; _FPU_SETCW(newcw); - _FPU_GETCW(oldcw); newcw = (oldcw & ~_FPU_EXTENDED) | _FPU_DOUBLE; _FPU_SETCW(newcw);
+#if defined(__linux__) && defined(__x86_64__)
+ fenv_t fenv; + fenv_t fenv;
+ +
+ fegetenv(&fenv); + fegetenv(&fenv);
@ -48,18 +41,17 @@ index 4f4772d..70c2e4b 100644
#endif #endif
// Extra options: // Extra options:
diff --git a/utils/System.h b/utils/System.h diff --git a/utils/System.h b/utils/System.h
index 004d498..a768e99 100644 index 004d498..2f6d922 100644
--- a/utils/System.h --- a/utils/System.h
+++ b/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 #define Glucose_System_h
#if defined(__linux__) -#if defined(__linux__)
-#include <fpu_control.h> -#include <fpu_control.h>
+#if defined(__linux__) && defined(__x86_64__)
+#include <fenv.h> +#include <fenv.h>
#endif #endif
#include "glucose/mtl/IntTypes.h" #include "glucose/mtl/IntTypes.h"
--
2.14.2

View file

@ -1,24 +1,15 @@
From 7f1016ceab9b0f57a935bd51ca6df3d18439b472 Mon Sep 17 00:00:00 2001
From: Will Dietz <w@wdtz.org>
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 diff --git a/core/Main.cc b/core/Main.cc
index 2b0d97b..8ad95fb 100644 index 2b0d97b..9ba985d 100644
--- a/core/Main.cc --- a/core/Main.cc
+++ b/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] <input-file> <result-output-file>\n\n where input may be either in plain or gzipped DIMACS.\n");
// printf("This is MiniSat 2.0 beta\n"); // printf("This is MiniSat 2.0 beta\n");
#if defined(__linux__) -#if defined(__linux__)
- fpu_control_t oldcw, newcw; - fpu_control_t oldcw, newcw;
- _FPU_GETCW(oldcw); newcw = (oldcw & ~_FPU_EXTENDED) | _FPU_DOUBLE; _FPU_SETCW(newcw); - _FPU_GETCW(oldcw); newcw = (oldcw & ~_FPU_EXTENDED) | _FPU_DOUBLE; _FPU_SETCW(newcw);
+#if defined(__linux__) && defined(__x86_64__)
+ fenv_t fenv; + fenv_t fenv;
+ +
+ fegetenv(&fenv); + fegetenv(&fenv);
@ -29,15 +20,17 @@ index 2b0d97b..8ad95fb 100644
#endif #endif
// Extra options: // Extra options:
diff --git a/simp/Main.cc b/simp/Main.cc diff --git a/simp/Main.cc b/simp/Main.cc
index 2804d7f..39bfb71 100644 index 2804d7f..7fbdb33 100644
--- a/simp/Main.cc --- a/simp/Main.cc
+++ b/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] <input-file> <result-output-file>\n\n where input may be either in plain or gzipped DIMACS.\n");
// printf("This is MiniSat 2.0 beta\n"); // printf("This is MiniSat 2.0 beta\n");
#if defined(__linux__) -#if defined(__linux__)
- fpu_control_t oldcw, newcw; - fpu_control_t oldcw, newcw;
- _FPU_GETCW(oldcw); newcw = (oldcw & ~_FPU_EXTENDED) | _FPU_DOUBLE; _FPU_SETCW(newcw); - _FPU_GETCW(oldcw); newcw = (oldcw & ~_FPU_EXTENDED) | _FPU_DOUBLE; _FPU_SETCW(newcw);
+#if defined(__linux__) && defined(__x86_64__)
+ fenv_t fenv; + fenv_t fenv;
+ +
+ fegetenv(&fenv); + fegetenv(&fenv);
@ -48,18 +41,17 @@ index 2804d7f..39bfb71 100644
#endif #endif
// Extra options: // Extra options:
diff --git a/utils/System.h b/utils/System.h diff --git a/utils/System.h b/utils/System.h
index 1758192..c0ad13a 100644 index 1758192..840bee5 100644
--- a/utils/System.h --- a/utils/System.h
+++ b/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 #define Minisat_System_h
#if defined(__linux__) -#if defined(__linux__)
-#include <fpu_control.h> -#include <fpu_control.h>
+#if defined(__linux__) && defined(__x86_64__)
+#include <fenv.h> +#include <fenv.h>
#endif #endif
#include "mtl/IntTypes.h" #include "mtl/IntTypes.h"
--
2.14.2