summaryrefslogtreecommitdiff
path: root/gnu/packages/patches
diff options
context:
space:
mode:
authorEric Bavier <bavier@posteo.net>2022-02-04 23:13:57 -0600
committerEric Bavier <bavier@posteo.net>2022-02-05 00:24:33 -0600
commit41b11c459bda26b0a7c20ef39486eef917416860 (patch)
tree61f638bc9749769703b5b2702e5eed235fde3c34 /gnu/packages/patches
parentdd823172d86f82dedf8b0a7eb65925db4b164d26 (diff)
gnu: fenics-dolfin: Fix build.
* gnu/packages/patches/fenics-dolfin-algorithm.patch, gnu/packages/patches/fenics-dolfin-boost.patch, gnu/packages/patches/fenics-dolfin-config-slepc.patch, gnu/packages/patches/fenics-dolfin-demo-init.patch: New patches. * gnu/local.mk (dist_patch_DATA): Register them. * gnu/packages/simulation.scm (fenics-dolfin)[source]: Use them.
Diffstat (limited to 'gnu/packages/patches')
-rw-r--r--gnu/packages/patches/fenics-dolfin-algorithm.patch37
-rw-r--r--gnu/packages/patches/fenics-dolfin-boost.patch45
-rw-r--r--gnu/packages/patches/fenics-dolfin-config-slepc.patch48
-rw-r--r--gnu/packages/patches/fenics-dolfin-demo-init.patch39
4 files changed, 169 insertions, 0 deletions
diff --git a/gnu/packages/patches/fenics-dolfin-algorithm.patch b/gnu/packages/patches/fenics-dolfin-algorithm.patch
new file mode 100644
index 0000000000..e2a3148a64
--- /dev/null
+++ b/gnu/packages/patches/fenics-dolfin-algorithm.patch
@@ -0,0 +1,37 @@
+Fix compilation errors:
+
+ dolfin/geometry/IntersectionConstruction.cpp: In static member function ‘static std::vector<dolfin::Point> dolfin::IntersectionConstruction::intersection_segment_segment_2d(const dolfin::Point&, const dolfin::Point&, const dolfin::Point&, const dolfin::Point&)’:
+ dolfin/geometry/IntersectionConstruction.cpp:442:24: error: ‘min_element’ is not a member of ‘std’; did you mean ‘tuple_element’?
+ 442 | const auto it = std::min_element(oo.begin(), oo.end());
+ | ^~~~~~~~~~~
+ | tuple_element
+
+ dolfin/mesh/MeshFunction.h: In member function ‘std::vector<long unsigned int> dolfin::MeshFunction<T>::where_equal(T)’:
+ dolfin/mesh/MeshFunction.h:652:26: error: ‘count’ is not a member of ‘std’; did you mean ‘cout’?
+ 652 | std::size_t n = std::count(_values.get(), _values.get() + _size, value);
+ | ^~~~~
+ | cout
+
+Submitted upstream at https://bitbucket.org/fenics-project/dolfin/issues/1128
+
+--- a/dolfin/geometry/IntersectionConstruction.cpp
++++ b/dolfin/geometry/IntersectionConstruction.cpp
+@@ -18,7 +18,8 @@
+ // First added: 2014-02-03
+ // Last changed: 2017-12-12
+
++#include <algorithm>
+ #include <iomanip>
+ #include <dolfin/mesh/MeshEntity.h>
+ #include "predicates.h"
+
+--- a/dolfin/mesh/MeshFunction.h
++++ b/dolfin/mesh/MeshFunction.h
+@@ -24,6 +24,7 @@
+ #ifndef __MESH_FUNCTION_H
+ #define __MESH_FUNCTION_H
+
++#include <algorithm>
+ #include <map>
+ #include <vector>
+
diff --git a/gnu/packages/patches/fenics-dolfin-boost.patch b/gnu/packages/patches/fenics-dolfin-boost.patch
new file mode 100644
index 0000000000..de56ebb9b3
--- /dev/null
+++ b/gnu/packages/patches/fenics-dolfin-boost.patch
@@ -0,0 +1,45 @@
+The `BOOST_LITTLE_ENDIAN` and `BOOST_BIG_ENDIAN` macros, along with the
+"boost/detail/endian.hpp" header, were deprecated in boost 1.69.0 and finally
+removed in boost 1.73.0. They are superseded by the BOOST_ENDIAN_LITTLE_BYTE
+and BOOST_ENDIAN_BIG_BYTE macros and "boost/predef/other/endian.h" header.
+
+Deprecated: https://github.com/boostorg/predef/commit/32d4581c1689370444f2e565cfbb8421d5071807
+Removed: https://github.com/boostorg/predef/commit/aa6e232bf170ad8b856aff9e7c70334f77441c7f
+
+Adaptation of patch from https://bitbucket.org/fenics-project/dolfin/issues/1116
+
+--- a/dolfin/io/VTKFile.cpp
++++ b/dolfin/io/VTKFile.cpp
+@@ -20,7 +20,7 @@
+ #include <vector>
+ #include <iomanip>
+ #include <boost/cstdint.hpp>
+-#include <boost/detail/endian.hpp>
++#include <boost/predef/other/endian.h>
+
+ #include "pugixml.hpp"
+
+@@ -614,9 +614,9 @@
+ std::string endianness = "";
+ if (encode_string == "binary")
+ {
+- #if defined BOOST_LITTLE_ENDIAN
++ #if defined BOOST_ENDIAN_LITTLE_BYTE
+ endianness = "byte_order=\"LittleEndian\"";
+- #elif defined BOOST_BIG_ENDIAN
++ #elif defined BOOST_ENDIAN_BIG_BYTE
+ endianness = "byte_order=\"BigEndian\"";;
+ #else
+ dolfin_error("VTKFile.cpp",
+
+--- a/dolfin/io/VTKWriter.cpp
++++ b/dolfin/io/VTKWriter.cpp
+@@ -24,7 +24,6 @@
+ #include <sstream>
+ #include <vector>
+ #include <iomanip>
+-#include <boost/detail/endian.hpp>
+
+ #include <dolfin/fem/GenericDofMap.h>
+ #include <dolfin/fem/FiniteElement.h>
+ \ No newline at end of file
diff --git a/gnu/packages/patches/fenics-dolfin-config-slepc.patch b/gnu/packages/patches/fenics-dolfin-config-slepc.patch
new file mode 100644
index 0000000000..fa06179285
--- /dev/null
+++ b/gnu/packages/patches/fenics-dolfin-config-slepc.patch
@@ -0,0 +1,48 @@
+From https://bitbucket.org/fenics-project/dolfin/issues/1120
+
+From f627a442350560e50dbbb11f7828b6d807369533 Mon Sep 17 00:00:00 2001
+From: Alexei Colin <acolin@isi.edu>
+Date: Sun, 11 Apr 2021 20:40:00 -0400
+Subject: [PATCH] cmake: PETSc,SLEPc: match lowercase .pc pkg-config files
+
+Upstream has moved to lowercase. PETSc has kept the mixed-case file for
+compatibility, but SLEPc hasn't.
+
+pkg_search_module takes multiple patterns and succeeds on first match,
+so this commit is backward-compatible with older installations of PETSc,
+SLEPc.
+
+---
+ cmake/modules/FindPETSc.cmake | 2 +-
+ cmake/modules/FindSLEPc.cmake | 2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/cmake/modules/FindPETSc.cmake b/cmake/modules/FindPETSc.cmake
+index 80faffdad..728a6ec30 100644
+--- a/cmake/modules/FindPETSc.cmake
++++ b/cmake/modules/FindPETSc.cmake
+@@ -51,7 +51,7 @@ find_package(PkgConfig REQUIRED)
+
+ # Find PETSc pkg-config file. Note: craypetsc_real is on Cray systems
+ set(ENV{PKG_CONFIG_PATH} "$ENV{CRAY_PETSC_PREFIX_DIR}/lib/pkgconfig:$ENV{PETSC_DIR}/$ENV{PETSC_ARCH}/lib/pkgconfig:$ENV{PETSC_DIR}/lib/pkgconfig:$ENV{PKG_CONFIG_PATH}")
+-pkg_search_module(PETSC craypetsc_real PETSc)
++pkg_search_module(PETSC craypetsc_real petsc PETSc)
+
+ # Extract major, minor, etc from version string
+ if (PETSC_VERSION)
+diff --git a/cmake/modules/FindSLEPc.cmake b/cmake/modules/FindSLEPc.cmake
+index 327cffc23..dec26fcc4 100644
+--- a/cmake/modules/FindSLEPc.cmake
++++ b/cmake/modules/FindSLEPc.cmake
+@@ -48,7 +48,7 @@ find_package(PkgConfig REQUIRED)
+ set(ENV{PKG_CONFIG_PATH} "$ENV{SLEPC_DIR}/$ENV{PETSC_ARCH}/lib/pkgconfig:$ENV{SLEPC_DIR}/lib/pkgconfig:$ENV{PKG_CONFIG_PATH}")
+ set(ENV{PKG_CONFIG_PATH} "$ENV{PETSC_DIR}/$ENV{PETSC_ARCH}/lib/pkgconfig:$ENV{PETSC_DIR}/lib/pkgconfig:$ENV{PKG_CONFIG_PATH}")
+ set(ENV{PKG_CONFIG_PATH} "$ENV{PETSC_DIR}/$ENV{PETSC_ARCH}:$ENV{PETSC_DIR}:$ENV{PKG_CONFIG_PATH}")
+-pkg_search_module(SLEPC crayslepc_real SLEPc)
++pkg_search_module(SLEPC crayslepc_real slepc SLEPc)
+
+ # Extract major, minor, etc from version string
+ if (SLEPC_VERSION)
+--
+2.30.0
+
diff --git a/gnu/packages/patches/fenics-dolfin-demo-init.patch b/gnu/packages/patches/fenics-dolfin-demo-init.patch
new file mode 100644
index 0000000000..5a01320147
--- /dev/null
+++ b/gnu/packages/patches/fenics-dolfin-demo-init.patch
@@ -0,0 +1,39 @@
+Ensure MPI is initialized before getting rank, which may be called early by
+Logger::write() via dolfin::info().
+
+Fixes "MPI_Comm_rank called before MPI_INIT" error from
+`demo_stokes-iterative_serial` and `demo_waveguide_serial` tests.
+
+Submitted upstream at https://bitbucket.org/fenics-project/dolfin/issues/1127
+
+--- a/dolfin/common/MPI.cpp
++++ b/dolfin/common/MPI.cpp
+@@ -143,6 +143,7 @@ MPI_Info& dolfin::MPIInfo::operator*()
+ unsigned int dolfin::MPI::rank(const MPI_Comm comm)
+ {
+ #ifdef HAS_MPI
++ SubSystemsManager::init_mpi();
+ int rank;
+ MPI_Comm_rank(comm, &rank);
+ return rank;
+diff --git a/dolfin/common/MPI.h b/dolfin/common/MPI.h
+index b93f6df30..854114a3f 100644
+--- a/dolfin/common/MPI.h
++++ b/dolfin/common/MPI.h
+@@ -102,12 +102,13 @@ namespace dolfin
+ /// communicator
+ void reset(MPI_Comm comm);
+
+- /// Return process rank for the communicator
++ /// Return process rank for the communicator. This function will
++ /// also initialize MPI if it hasn't already been initialised.
+ unsigned int rank() const;
+
+ /// Return size of the group (number of processes) associated
+- /// with the communicator. This function will also intialise MPI
+- /// if it hasn't already been intialised.
++ /// with the communicator. This function will also initialise MPI
++ /// if it hasn't already been initialised.
+ unsigned int size() const;
+
+ /// Set a barrier (synchronization point)