Closed embray closed 5 years ago
To add, this happens whether I use the Python included in Cygwin, or a Python built in Sage. So I don't think it's a problem with the Python headers themselves.
Which Python version is this?
2.7
I think the problem is originating from pari/parigen.h which contains this nonsense:
16 #ifdef _WIN64
17 typedef unsigned long long pari_ulong;
18 #define long long long
19 #define labs llabs
20 #else
21 typedef unsigned long pari_ulong;
22 #endif
where _WIN64
is being defined by including <windows.h>
. It's not a problem on the AppVeyor build because it's not including PARI (perhaps it should...)
Indeed.
That #define long long long
in parigen.h is just hard-coded there. That can't be right...
8913e0b66a9acea11a5971868d748cde368ae29b will probably fix this
Oh, I'll give that a try. I had a more complicated solution which also works:
diff --git a/src/cysignals/implementation.c b/src/cysignals/implementation.c
index dd5c13e..fc3de38 100644
--- a/src/cysignals/implementation.c
+++ b/src/cysignals/implementation.c
@@ -58,7 +58,17 @@ Interrupt and signal handling for Cython
#endif
#include <Python.h>
#if HAVE_PARI
+#ifdef _WIN64
+/* One of PARI's headers unhelpfully redefines 'long' in _WIN64 is defined;
+ for the purposes of including it here this is doubly unhelpful, so
+ temporarily undefined _WIN64 for now */
+#define WIN64_DEFINED
+#undef _WIN64
+#endif
#include <pari/pari.h>
+#ifdef WIN64_DEFINED
+#define _WIN64
+#endif
#else
/* Fake PARI variables */
static int PARI_SIGINT_block = 0;
8913e0b is good, thanks 👍
Yeesh. Now that this and #106 are dealt with I can finally move on with the actual issue which was to submit a workaround for https://trac.sagemath.org/ticket/27214#comment:10
On my local machine, ever since 64e2586f072c6e9048162bc14550a89c5febd304 when I try to build Cysignals I get:
If I define out the inclusion of
<windows.h>
(which shouldn't be needed on Cygwin anyways) it works.Curiously, I expected to see this on AppVeyor when working on #106, but it did not occur (despite being based on the latest master branch, including that commit).
It might be a bug in the windows headers included in Cygwin that is fixed in newer versions, but I'm not sure.