From 338fa8d7d6a3cabcb167063db44f9a00edb7088d Mon Sep 17 00:00:00 2001 From: Denis Davydov Date: Tue, 3 Apr 2018 17:15:09 +0200 Subject: [PATCH] fix dealii dependencies for Clang 9.1.0 C++17 (#7644) * fix boost and muparser for Clang 9.1.0 with C++17 * muparser: add C++11 flags * dealii: temporary disable python by default * dealii: make CMake find right python --- .../packages/boost/array_binary_tree.patch | 12 +++++ .../repos/builtin/packages/boost/package.py | 7 ++- .../repos/builtin/packages/dealii/package.py | 15 ++++-- .../builtin/packages/muparser/auto_ptr.patch | 52 +++++++++++++++++++ .../builtin/packages/muparser/package.py | 6 +++ 5 files changed, 88 insertions(+), 4 deletions(-) create mode 100644 var/spack/repos/builtin/packages/boost/array_binary_tree.patch create mode 100644 var/spack/repos/builtin/packages/muparser/auto_ptr.patch diff --git a/var/spack/repos/builtin/packages/boost/array_binary_tree.patch b/var/spack/repos/builtin/packages/boost/array_binary_tree.patch new file mode 100644 index 0000000000..51e1950528 --- /dev/null +++ b/var/spack/repos/builtin/packages/boost/array_binary_tree.patch @@ -0,0 +1,12 @@ +diff --git a/boost/graph/detail/array_binary_tree.hpp b/boost/graph/detail/array_binary_tree.hpp +index e59da9e..fd403d1 100644 +--- a/boost/graph/detail/array_binary_tree.hpp ++++ b/boost/graph/detail/array_binary_tree.hpp +@@ -14,6 +14,7 @@ + #include + #include + #include ++#include + + namespace boost { + diff --git a/var/spack/repos/builtin/packages/boost/package.py b/var/spack/repos/builtin/packages/boost/package.py index fdee5af217..09e71023b1 100644 --- a/var/spack/repos/builtin/packages/boost/package.py +++ b/var/spack/repos/builtin/packages/boost/package.py @@ -46,8 +46,10 @@ class Boost(Package): branch='develop', submodules=True) + version('1.67.0.b1', '3423a4a3ec5297051fd27091864630e2dce4c159', + url='https://dl.bintray.com/boostorg/beta/1.67.0.beta.1/source/boost_1_67_0_b1.tar.gz') version('1.66.0', 'b6b284acde2ad7ed49b44e856955d7b1ea4e9459', - url='https://dl.bintray.com/boostorg/release/1.66.0/source/boost_1_66_0.tar.bz2') + url='https://dl.bintray.com/boostorg/release/1.66.0/source/boost_1_66_0.tar.bz2', preferred=True) version('1.65.1', '41d7542ce40e171f3f7982aff008ff0d', url='https://dl.bintray.com/boostorg/release/1.65.1/source/boost_1_65_1.tar.bz2') version('1.65.0', '5512d3809801b0a1b9dd58447b70915d', @@ -151,6 +153,9 @@ class Boost(Package): conflicts('+taggedlayout', when='+versionedlayout') + # temporary fix https://svn.boost.org/trac10/ticket/13505 + patch('array_binary_tree.patch', when='@1.67.0.b1') + # Patch fix from https://svn.boost.org/trac/boost/ticket/11856 patch('boost_11856.patch', when='@1.60.0%gcc@4.4.7') diff --git a/var/spack/repos/builtin/packages/dealii/package.py b/var/spack/repos/builtin/packages/dealii/package.py index b45bb09041..77cd58f9db 100644 --- a/var/spack/repos/builtin/packages/dealii/package.py +++ b/var/spack/repos/builtin/packages/dealii/package.py @@ -77,7 +77,7 @@ class Dealii(CMakePackage, CudaPackage): description='Compile with Slepc (only with Petsc and MPI)') variant('trilinos', default=True, description='Compile with Trilinos (only with MPI)') - variant('python', default=True, + variant('python', default=False, description='Compile with Python bindings') variant('int64', default=False, description='Compile with 64 bit indices support') @@ -95,12 +95,12 @@ class Dealii(CMakePackage, CudaPackage): # https://github.com/dealii/dealii/issues/5262 # we take the patch from https://github.com/boostorg/serialization/pull/79 # more precisely its variation https://github.com/dealii/dealii/pull/5572#issuecomment-349742019 - depends_on('boost@1.59.0:1.63,1.65.1+thread+system+serialization+iostreams', + depends_on('boost@1.59.0:1.63,1.65.1,1.67.0:+thread+system+serialization+iostreams', patches=patch('boost_1.65.1_singleton.patch', level=1, when='@1.65.1'), when='~python') - depends_on('boost@1.59.0:1.63,1.65.1+thread+system+serialization+iostreams+python', + depends_on('boost@1.59.0:1.63,1.65.1,1.67.0:+thread+system+serialization+iostreams+python', patches=patch('boost_1.65.1_singleton.patch', level=1, when='@1.65.1'), @@ -223,6 +223,15 @@ def cmake_args(self): '-DDEAL_II_COMPONENT_PYTHON_BINDINGS=%s' % ('ON' if '+python' in spec else 'OFF') ]) + if '+python' in spec: + python_exe = spec['python'].command.path + python_library = spec['python'].libs[0] + python_include = spec['python'].headers.directories[0] + options.extend([ + '-DPYTHON_EXECUTABLE=%s' % python_exe, + '-DPYTHON_INCLUDE_DIR=%s' % python_include, + '-DPYTHON_LIBRARY=%s' % python_library + ]) # Set directory structure: if spec.satisfies('@:8.2.1'): diff --git a/var/spack/repos/builtin/packages/muparser/auto_ptr.patch b/var/spack/repos/builtin/packages/muparser/auto_ptr.patch new file mode 100644 index 0000000000..7e39ea603f --- /dev/null +++ b/var/spack/repos/builtin/packages/muparser/auto_ptr.patch @@ -0,0 +1,52 @@ +diff --git a/include/muParserBase.h b/include/muParserBase.h +index beb15bb..685f59f 100644 +--- a/include/muParserBase.h ++++ b/include/muParserBase.h +@@ -288,7 +288,7 @@ private: + mutable stringbuf_type m_vStringBuf; ///< String buffer, used for storing string function arguments + stringbuf_type m_vStringVarBuf; + +- std::auto_ptr m_pTokenReader; ///< Managed pointer to the token reader object. ++ std::unique_ptr m_pTokenReader; ///< Managed pointer to the token reader object. + + funmap_type m_FunDef; ///< Map of function names and pointers. + funmap_type m_PostOprtDef; ///< Postfix operator callbacks +diff --git a/include/muParserToken.h b/include/muParserToken.h +index fc91d78..0cca469 100644 +--- a/include/muParserToken.h ++++ b/include/muParserToken.h +@@ -69,7 +69,7 @@ namespace mu + TString m_strTok; ///< Token string + TString m_strVal; ///< Value for string variables + value_type m_fVal; ///< the value +- std::auto_ptr m_pCallback; ++ std::unique_ptr m_pCallback; + + public: + +diff --git a/src/muParserTest.cpp b/src/muParserTest.cpp +index 4006b27..8feaa2c 100644 +--- a/src/muParserTest.cpp ++++ b/src/muParserTest.cpp +@@ -1258,7 +1258,7 @@ namespace mu + + try + { +- std::auto_ptr p1; ++ std::unique_ptr p1; + Parser p2, p3; // three parser objects + // they will be used for testing copy and assignment operators + // p1 is a pointer since i'm going to delete it in order to test if +diff --git a/src/muParserTokenReader.cpp b/src/muParserTokenReader.cpp +index 8da1e40..49cee68 100644 +--- a/src/muParserTokenReader.cpp ++++ b/src/muParserTokenReader.cpp +@@ -147,7 +147,7 @@ namespace mu + */ + ParserTokenReader* ParserTokenReader::Clone(ParserBase *a_pParent) const + { +- std::auto_ptr ptr(new ParserTokenReader(*this)); ++ std::unique_ptr ptr(new ParserTokenReader(*this)); + ptr->SetParent(a_pParent); + return ptr.release(); + } diff --git a/var/spack/repos/builtin/packages/muparser/package.py b/var/spack/repos/builtin/packages/muparser/package.py index e2e6c22f72..964f47b0cf 100644 --- a/var/spack/repos/builtin/packages/muparser/package.py +++ b/var/spack/repos/builtin/packages/muparser/package.py @@ -32,9 +32,15 @@ class Muparser(Package): version('2.2.5', '02dae671aa5ad955fdcbcd3fee313fb7') + # Replace std::auto_ptr by std::unique_ptr + # https://github.com/beltoforion/muparser/pull/46 + patch('auto_ptr.patch', + when='@2.2.5') + def install(self, spec, prefix): options = ['--disable-debug', '--disable-dependency-tracking', + 'CXXFLAGS=-std=c++11', '--prefix=%s' % prefix] configure(*options)