The package rpms/xcfun.git has added or updated architecture specific content in its
spec file (ExclusiveArch/ExcludeArch or %ifarch/%ifnarch) in commit(s):
https://src.fedoraproject.org/cgit/rpms/xcfun.git/commit/?id=8005d1ec9a0c....
Change:
-ExcludeArch: %{arm} %{ix86}
Thanks.
Full change:
============
commit 8005d1ec9a0c679414ca09ff36da971e55d97b30
Author: Susi Lehtola <jussilehtola(a)fedoraproject.org>
Date: Wed Sep 8 11:48:41 2021 +0000
Fix 32-bit builds and potential array overflow
diff --git a/154.patch b/154.patch
new file mode 100644
index 0000000..7944790
--- /dev/null
+++ b/154.patch
@@ -0,0 +1,53 @@
+From 5d37981978494681a6e55224ac6e6f765eb59edb Mon Sep 17 00:00:00 2001
+From: Roberto Di Remigio <roberto.diremigio(a)gmail.com>
+Date: Mon, 23 Aug 2021 08:23:23 +0200
+Subject: [PATCH] Always use a temporary of large enough size
+
+Should fix #151
+---
+ src/functionals/brx.cpp | 15 +++++++++++----
+ 1 file changed, 11 insertions(+), 4 deletions(-)
+
+diff --git a/src/functionals/brx.cpp b/src/functionals/brx.cpp
+index 260a0ed..acaaafc 100644
+--- a/src/functionals/brx.cpp
++++ b/src/functionals/brx.cpp
+@@ -50,11 +50,15 @@ static double BR(double z) {
+ // Obtain the Taylor expansion of x(y), which is the
+ // inverse of BR_y. Use linear method for simplicity.
+ template <typename T, int Ndeg>
+-void BR_taylor(const T & z0, taylor<T, 1, Ndeg> & t) {
+- taylor<T, 1, Ndeg> f, d;
++taylor <T, 1, Ndeg> BR_taylor(const T & z0) {
++ static_assert(Ndeg >= 3);
++
++ taylor<T, 1, Ndeg> t;
+ t = 0;
+ t[0] = BR(z0);
+ t[1] = 1;
++
++ taylor<T, 1, Ndeg> f;
+ f = BR_z(t);
+ t[1] = 1 / f[1];
+ // Linear method, for quadratic see i.e. Brent & Kung ~197x
+@@ -62,6 +66,8 @@ void BR_taylor(const T & z0, taylor<T, 1, Ndeg> & t) {
+ f = BR_z(t);
+ t[i] = -f[i] * t[1];
+ }
++
++ return t;
+ }
+
+ /* This is a fully differentiable solver for Eq.(21) in
+@@ -70,8 +76,9 @@ void BR_taylor(const T & z0, taylor<T, 1, Ndeg> & t) {
+ */
+ template <typename T, int Nvar>
+ static ctaylor<T, Nvar> BR(const ctaylor<T, Nvar> & t) {
+- taylor<T, 1, Nvar> tmp;
+- BR_taylor(t.c[0], tmp);
++ // temporary has dimension 3 at least. See:
https://github.com/dftlibs/xcfun/issues/151
++ // in C++14 and later can use std::max(Nvar, 3) for the second template argument
++ auto tmp = BR_taylor<T, (Nvar >= 3) ? Nvar : 3>(t.c[0]);
+
+ ctaylor<T, Nvar> res = tmp[0];
+ for (int i = 1; i <= Nvar; i++)
diff --git a/155.patch b/155.patch
new file mode 100644
index 0000000..94cb35a
--- /dev/null
+++ b/155.patch
@@ -0,0 +1,70 @@
+From 1c03a9078b8ed2d47be36db6f0d3b8c0d9ba9ddd Mon Sep 17 00:00:00 2001
+From: Roberto Di Remigio <robertodr(a)users.noreply.github.com>
+Date: Wed, 8 Sep 2021 10:32:00 +0200
+Subject: [PATCH 1/3] Patch py::array_t CTOR usage
+
+---
+ python/export_xcfun.cpp | 3 +--
+ 1 file changed, 1 insertion(+), 2 deletions(-)
+
+diff --git a/python/export_xcfun.cpp b/python/export_xcfun.cpp
+index df5631a..7004299 100644
+--- a/python/export_xcfun.cpp
++++ b/python/export_xcfun.cpp
+@@ -141,8 +141,7 @@ PYBIND11_MODULE(_xcfun, m) {
+ }
+ auto nr_points = density.shape(0);
+ auto output =
+- py::array_t<double, py::array::c_style | py::array::forcecast>(
+- {{nr_points, output_len}});
++ py::array_t<double, py::array::c_style |
py::array::forcecast>({nr_points, output_len});
+
+ if (dens_ndim == 1) {
+ xcfun::xcfun_eval(fun, density.data(), output.mutable_data());
+
+From ee56726019aa57ab104b3a5cc73967db0ab528f3 Mon Sep 17 00:00:00 2001
+From: Roberto Di Remigio <robertodr(a)users.noreply.github.com>
+Date: Wed, 8 Sep 2021 10:54:45 +0200
+Subject: [PATCH 2/3] Use correct CTOR
+
+We want to use this one:
https://github.com/pybind/pybind11/blob/v2.7.1/include/pybind11/numpy.h#L876
+---
+ python/export_xcfun.cpp | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/python/export_xcfun.cpp b/python/export_xcfun.cpp
+index 7004299..37fdb92 100644
+--- a/python/export_xcfun.cpp
++++ b/python/export_xcfun.cpp
+@@ -141,7 +141,7 @@ PYBIND11_MODULE(_xcfun, m) {
+ }
+ auto nr_points = density.shape(0);
+ auto output =
+- py::array_t<double, py::array::c_style |
py::array::forcecast>({nr_points, output_len});
++ py::array_t<double, py::array::c_style |
py::array::forcecast>({nr_points, output_len}, nullptr);
+
+ if (dens_ndim == 1) {
+ xcfun::xcfun_eval(fun, density.data(), output.mutable_data());
+
+From 30c3846671696b585ec16fffac6f9579a81ccedd Mon Sep 17 00:00:00 2001
+From: Roberto Di Remigio <robertodr(a)users.noreply.github.com>
+Date: Wed, 8 Sep 2021 11:06:53 +0200
+Subject: [PATCH 3/3] Finagling with the CTOR
+
+---
+ python/export_xcfun.cpp | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/python/export_xcfun.cpp b/python/export_xcfun.cpp
+index 37fdb92..9b74df2 100644
+--- a/python/export_xcfun.cpp
++++ b/python/export_xcfun.cpp
+@@ -141,7 +141,7 @@ PYBIND11_MODULE(_xcfun, m) {
+ }
+ auto nr_points = density.shape(0);
+ auto output =
+- py::array_t<double, py::array::c_style |
py::array::forcecast>({nr_points, output_len}, nullptr);
++ py::array_t<double, py::array::c_style |
py::array::forcecast>({{nr_points, output_len}}, nullptr);
+
+ if (dens_ndim == 1) {
+ xcfun::xcfun_eval(fun, density.data(), output.mutable_data());
diff --git a/xcfun.spec b/xcfun.spec
index 0257248..ffddf7f 100644
--- a/xcfun.spec
+++ b/xcfun.spec
@@ -2,14 +2,16 @@
Name: xcfun
Version: 2.1.1
-Release: 3%{?dist}
+Release: 4%{?dist}
Summary: A library of approximate exchange-correlation functionals
License: MPLv2.0
URL:
https://xcfun.readthedocs.io
Source0:
https://github.com/dftlibs/xcfun/archive/v%{version}/%{name}-%{version}.t...
-# xcfun does not build at the moment on 32-bit architectures
-ExcludeArch: %{arm} %{ix86}
+# Patch out potential array overflow
+Patch0:
https://github.com/dftlibs/xcfun/pull/154.patch
+# Fix build on 32-bit architectures
+Patch1:
https://github.com/dftlibs/xcfun/pull/155.patch
BuildRequires: cmake
BuildRequires: gcc-c++
@@ -68,6 +70,8 @@ This package contains the Python bindings for XCFun.
%prep
%setup -q
+%patch0 -p1 -b .overflow
+%patch1 -p1 -b .32bit
%build
%cmake -B %{_host} -DCMAKE_BUILD_TYPE=RelWithDebInfo -DLIB=%{_lib}
-DXCFUN_PYTHON_INTERFACE=ON -DPYMOD_INSTALL_LIBDIR=../../%{python3_sitearch}
@@ -96,6 +100,9 @@ ctest --output-on-failure
%{python3_sitearch}/xcfun
%changelog
+* Wed Sep 08 2021 Susi Lehtola <jussilehtola(a)fedoraproject.org> - 2.1.1-5
+- Patches to fix 32-bit builds and potential array overflow.
+
* Fri Jul 30 2021 Susi Lehtola <jussilehtola(a)fedoraproject.org> - 2.1.1-4
- Disable 32-bit architectures which are not supported by xcfun.