From 462a4a1353bfcf68e75036d322bd3b668d2b8756 Mon Sep 17 00:00:00 2001
From: Denis Davydov <davydden@gmail.com>
Date: Thu, 22 Sep 2016 22:47:22 +0200
Subject: [PATCH] boost: fix a bug which broke it on macOS with clang+gfortran
 (#1816)

* dealii: add missing python dependency

* boost: fix a bug which  broke it on macOS with clang+gfortran

Boost was using gcc compiler instead of clang++, which lead to
cryptic Undefined symbols linking errors for boost::python::objects::function_object()
when building other packages against boost+python.

* boost: add exceptions for intel

* boost: use spack_cxx
---
 .../repos/builtin/packages/boost/package.py   | 22 +++++++++++++++----
 .../repos/builtin/packages/dealii/package.py  |  1 +
 2 files changed, 19 insertions(+), 4 deletions(-)

diff --git a/var/spack/repos/builtin/packages/boost/package.py b/var/spack/repos/builtin/packages/boost/package.py
index 0d4ccc7ea3..2b78dbd858 100644
--- a/var/spack/repos/builtin/packages/boost/package.py
+++ b/var/spack/repos/builtin/packages/boost/package.py
@@ -138,15 +138,13 @@ def url_for_version(self, version):
     def determine_toolset(self, spec):
         if spec.satisfies("platform=darwin"):
             return 'darwin'
-        else:
-            platform = 'linux'
 
         toolsets = {'g++': 'gcc',
                     'icpc': 'intel',
                     'clang++': 'clang'}
 
         if spec.satisfies('@1.47:'):
-            toolsets['icpc'] += '-' + platform
+            toolsets['icpc'] += '-linux'
         for cc, toolset in toolsets.iteritems():
             if cc in self.compiler.cxx_names:
                 return toolset
@@ -164,6 +162,16 @@ def determine_bootstrap_options(self, spec, withLibs, options):
                            join_path(spec['python'].prefix.bin, 'python'))
 
         with open('user-config.jam', 'w') as f:
+            # Boost may end up using gcc even though clang+gfortran is set in
+            # compilers.yaml. Make sure this does not happen:
+            if not spec.satisfies('%intel'):
+                # using intel-linux : : spack_cxx in user-config.jam leads to
+                # error: at project-config.jam:12
+                # error: duplicate initialization of intel-linux with the following parameters:  # noqa
+                # error: version = <unspecified>
+                # error: previous initialization at ./user-config.jam:1
+                f.write("using {0} : : {1} ;\n".format(boostToolsetId,
+                                                       spack_cxx))
 
             if '+mpi' in spec:
                 f.write('using mpi : %s ;\n' %
@@ -204,7 +212,13 @@ def determine_b2_options(self, spec, options):
 
         options.extend([
             'link=%s' % ','.join(linkTypes),
-            '--layout=tagged'])
+            '--layout=tagged'
+        ])
+
+        if not spec.satisfies('%intel'):
+            options.extend([
+                'toolset=%s' % self.determine_toolset(spec)
+            ])
 
         return threadingOpts
 
diff --git a/var/spack/repos/builtin/packages/dealii/package.py b/var/spack/repos/builtin/packages/dealii/package.py
index 89732f98b8..0d293e5d92 100644
--- a/var/spack/repos/builtin/packages/dealii/package.py
+++ b/var/spack/repos/builtin/packages/dealii/package.py
@@ -104,6 +104,7 @@ class Dealii(Package):
     depends_on("oce",              when='+oce')
     depends_on("p4est",            when='+p4est+mpi')
     depends_on("petsc+mpi",        when='@8.4.2:+petsc+mpi')
+    depends_on('python',           when='@8.5.0:+python')
     depends_on("slepc",            when='@8.4.2:+slepc+petsc+mpi')
     depends_on("petsc@:3.6.4+mpi", when='@:8.4.1+petsc+mpi')
     depends_on("slepc@:3.6.3",     when='@:8.4.1+slepc+petsc+mpi')
-- 
GitLab