Repository: spack/spack

Issue:
Unable to build Boost with Python 3
I'm trying to build Boost 1.63.0 with Python 3.6.0, but it is failing. The build output contains lines like:
```
./boost/python/detail/wrap_python.hpp:50:23: fatal error: pyconfig.h: No such file or directory
 # include <pyconfig.h>
                       ^
compilation terminated.
```
My `user-config.jam` looks like:
```
using gcc : : /blues/gpfs/home/software/spack-0.10.0/lib/spack/env/gcc/g++ ;
using python : 3.6 : /blues/gpfs/home/software/spack-0.10.0/opt/spack/linux-centos6-x86_64/gcc-6.1.0/python-3.6.0-prk6gk3ufbfetjc2bthqokmkjtjnce3j/bin/python : /blues/gpfs/home/software/spack-0.10.0/opt/spack/linux-centos6-x86_64/gcc-6.1.0/python-3.6.0-prk6gk3ufbfetjc2bthqokmkjtjnce3j/include/python3.6m :  ;
```
`/blues/gpfs/home/software/spack-0.10.0/opt/spack/linux-centos6-x86_64/gcc-6.1.0/python-3.6.0-prk6gk3ufbfetjc2bthqokmkjtjnce3j/include/python3.6m` does indeed contain `pyconfig.h`, so I'm surprised by this error message. Anyone ever built Boost with Python 3 before?


Discussion:
Can you try:

`
using python  
 :  3.6 : /blues/gpfs/home/software/spack-0.10.0/opt/spack/linux-centos6-x86_64/gcc-6.1.0/python-3.6.0-prk6gk3ufbfetjc2bthqokmkjtjnce3j ;
`

I've run into a path length issue before on the BG/Q that was solved by using the prefix.


Unfortunately that didn't solve the problem. Same error message.
I have not tried building boost with python3.

Does the following link look relevant? https://svn.boost.org/trac/boost/ticket/11120
Thanks @scheibelp, the patch at the very bottom worked! I also had to change the `--with-python=%s` line, as we were passing `python` instead of `python3`. I'll send out a PR shortly.

Resolving patch:
diff --git a/var/spack/repos/builtin/packages/boost/package.py b/var/spack/repos/builtin/packages/boost/package.py
--- a/var/spack/repos/builtin/packages/boost/package.py
+++ b/var/spack/repos/builtin/packages/boost/package.py
@@ -130,6 +130,9 @@ class Boost(Package):
     # Patch fix from https://svn.boost.org/trac/boost/ticket/11856
     patch('boost_11856.patch', when='@1.60.0%gcc@4.4.7')
 
+    # Patch fix from https://svn.boost.org/trac/boost/ticket/11120
+    patch('python_jam.patch', when='^python@3:')
+
     # Patch fix from https://svn.boost.org/trac/boost/ticket/10125
     patch('boost_10125.patch', when='@1.55.0%gcc@5.0:5.9')
 
@@ -153,7 +156,7 @@ def determine_toolset(self, spec):
 
         toolsets = {'g++': 'gcc',
                     'icpc': 'intel',
-                    'clang++': 'clang', 
+                    'clang++': 'clang',
                     'xlc++': 'xlcpp',
                     'xlc++_r': 'xlcpp'}
 
@@ -192,8 +195,7 @@ def determine_bootstrap_options(self, spec, withLibs, options):
         options.append("--with-libraries=%s" % ','.join(withLibs))
 
         if '+python' in spec:
-            options.append('--with-python=%s' %
-                           join_path(spec['python'].prefix.bin, 'python'))
+            options.append('--with-python=%s' % python_exe)
 
         with open('user-config.jam', 'w') as f:
             # Boost may end up using gcc even though clang+gfortran is set in
diff --git a/var/spack/repos/builtin/packages/python/package.py b/var/spack/repos/builtin/packages/python/package.py
--- a/var/spack/repos/builtin/packages/python/package.py
+++ b/var/spack/repos/builtin/packages/python/package.py
@@ -387,6 +387,7 @@ def setup_dependent_package(self, module, ext_spec):
             'python{0}'.format('3' if self.spec.satisfies('@3') else '')
         )
 
+        module.python_exe = python_path
         module.python = Executable(python_path)
         module.setup_py = Executable(python_path + ' setup.py --no-user-cfg')
 


Test patch: