summaryrefslogtreecommitdiff
path: root/var
diff options
context:
space:
mode:
author百地 希留耶 <65301509+KiruyaMomochi@users.noreply.github.com>2022-10-27 04:45:35 +0800
committerGitHub <noreply@github.com>2022-10-26 13:45:35 -0700
commit4ff8a6a9b703002db9f1c5a949a4b00c4978363d (patch)
tree0b318fd83b06175298062ffa0a6256e6e75c2c9d /var
parent5d0ae001a1184a7cf4cea3e2043b39fcc278dae6 (diff)
downloadspack-4ff8a6a9b703002db9f1c5a949a4b00c4978363d.tar.gz
spack-4ff8a6a9b703002db9f1c5a949a4b00c4978363d.tar.bz2
spack-4ff8a6a9b703002db9f1c5a949a4b00c4978363d.tar.xz
spack-4ff8a6a9b703002db9f1c5a949a4b00c4978363d.zip
Windows: fix bootstrap and package install failure (#32942)
* Add patches for building clingo with MSVC * Help python find clingo DLL * If an executable is located in "C:\Program Files", Executable was running into issues with the extra space. This quotes the exe to ensure that it is treated as a single value. Signed-off-by: Kiruya Momochi <65301509+KiruyaMomochi@users.noreply.github.com>
Diffstat (limited to 'var')
-rw-r--r--var/spack/repos/builtin/packages/clingo/package.py2
-rw-r--r--var/spack/repos/builtin/packages/clingo/size-t.patch22
-rw-r--r--var/spack/repos/builtin/packages/clingo/vs2022.patch18
3 files changed, 42 insertions, 0 deletions
diff --git a/var/spack/repos/builtin/packages/clingo/package.py b/var/spack/repos/builtin/packages/clingo/package.py
index be477fdf5b..a3d39d8e62 100644
--- a/var/spack/repos/builtin/packages/clingo/package.py
+++ b/var/spack/repos/builtin/packages/clingo/package.py
@@ -64,6 +64,8 @@ class Clingo(CMakePackage):
depends_on("py-cffi", type=("build", "run"), when="@5.5.0: platform=cray")
patch("python38.patch", when="@5.3:5.4.0")
+ patch("size-t.patch", when="%msvc")
+ patch("vs2022.patch", when="%msvc@19.30:")
def patch(self):
# Doxygen is optional but can't be disabled with a -D, so patch
diff --git a/var/spack/repos/builtin/packages/clingo/size-t.patch b/var/spack/repos/builtin/packages/clingo/size-t.patch
new file mode 100644
index 0000000000..52f7db2062
--- /dev/null
+++ b/var/spack/repos/builtin/packages/clingo/size-t.patch
@@ -0,0 +1,22 @@
+diff --git a/libpyclingo/pyclingo.cc b/libpyclingo/pyclingo.cc
+index ec4a33c..88b6669 100644
+--- a/libpyclingo/pyclingo.cc
++++ b/libpyclingo/pyclingo.cc
+@@ -116,7 +116,7 @@ struct ObjectProtocoll {
+ Object call(char const *name, Args &&... args);
+ template <class... Args>
+ Object operator()(Args &&... args);
+- ssize_t size();
++ Py_ssize_t size();
+ bool empty() { return size() == 0; }
+ Object getItem(Reference o);
+ Object getItem(char const *key);
+@@ -232,7 +232,7 @@ Object ObjectProtocoll<T>::operator()(Args &&... args) {
+ return PyObject_CallFunctionObjArgs(toPy_(), Reference(args).toPy()..., nullptr);
+ }
+ template <class T>
+-ssize_t ObjectProtocoll<T>::size() {
++Py_ssize_t ObjectProtocoll<T>::size() {
+ auto ret = PyObject_Size(toPy_());
+ if (PyErr_Occurred()) { throw PyException(); }
+ return ret;
diff --git a/var/spack/repos/builtin/packages/clingo/vs2022.patch b/var/spack/repos/builtin/packages/clingo/vs2022.patch
new file mode 100644
index 0000000000..8a27fc8679
--- /dev/null
+++ b/var/spack/repos/builtin/packages/clingo/vs2022.patch
@@ -0,0 +1,18 @@
+diff --git a/libpyclingo/pyclingo.cc b/libpyclingo/pyclingo.cc
+index 88b6669..58e73bd 100644
+--- a/libpyclingo/pyclingo.cc
++++ b/libpyclingo/pyclingo.cc
+@@ -25,6 +25,13 @@
+ // NOTE: the python header has a linker pragma to link with python_d.lib
+ // when _DEBUG is set which is not part of official python releases
+ #if defined(_MSC_VER) && defined(_DEBUG) && !defined(CLINGO_UNDEF__DEBUG)
++// Workaround for a VS 2022 issue.
++// NOTE: This workaround knowingly violates the Python.h include order requirement:
++// https://docs.python.org/3/c-api/intro.html#include-files
++# include <yvals.h>
++# if _MSVC_STL_VERSION >= 143
++# include <crtdefs.h>
++# endif
+ #undef _DEBUG
+ #include <Python.h>
+ #define _DEBUG