2016-01-20 22:22:49 +08:00
|
|
|
##############################################################################
|
2018-03-25 03:13:52 +08:00
|
|
|
# Copyright (c) 2013-2018, Lawrence Livermore National Security, LLC.
|
2016-01-20 22:22:49 +08:00
|
|
|
# Produced at the Lawrence Livermore National Laboratory.
|
|
|
|
#
|
|
|
|
# This file is part of Spack.
|
2016-05-12 12:22:25 +08:00
|
|
|
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
|
2016-01-20 22:22:49 +08:00
|
|
|
# LLNL-CODE-647188
|
|
|
|
#
|
2017-11-05 08:08:04 +08:00
|
|
|
# For details, see https://github.com/spack/spack
|
2017-06-25 13:22:55 +08:00
|
|
|
# Please also see the NOTICE and LICENSE files for our notice and the LGPL.
|
2016-01-20 22:22:49 +08:00
|
|
|
#
|
|
|
|
# This program is free software; you can redistribute it and/or modify
|
2016-05-12 12:22:25 +08:00
|
|
|
# it under the terms of the GNU Lesser General Public License (as
|
|
|
|
# published by the Free Software Foundation) version 2.1, February 1999.
|
2016-01-20 22:22:49 +08:00
|
|
|
#
|
|
|
|
# This program is distributed in the hope that it will be useful, but
|
|
|
|
# WITHOUT ANY WARRANTY; without even the IMPLIED WARRANTY OF
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the terms and
|
2016-05-12 12:22:25 +08:00
|
|
|
# conditions of the GNU Lesser General Public License for more details.
|
2016-01-20 22:22:49 +08:00
|
|
|
#
|
2016-05-12 12:22:25 +08:00
|
|
|
# You should have received a copy of the GNU Lesser General Public
|
|
|
|
# License along with this program; if not, write to the Free Software
|
|
|
|
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
2016-01-20 22:22:49 +08:00
|
|
|
##############################################################################
|
2016-04-21 04:33:59 +08:00
|
|
|
import shutil
|
2017-09-24 12:34:00 +08:00
|
|
|
import sys
|
2014-06-02 23:35:01 +08:00
|
|
|
|
2017-06-10 03:07:20 +08:00
|
|
|
from spack import *
|
|
|
|
|
2016-01-20 22:22:49 +08:00
|
|
|
|
2017-06-19 20:16:18 +08:00
|
|
|
class Hdf5(AutotoolsPackage):
|
2014-06-02 23:35:01 +08:00
|
|
|
"""HDF5 is a data model, library, and file format for storing and managing
|
2016-07-13 15:21:49 +08:00
|
|
|
data. It supports an unlimited variety of datatypes, and is designed for
|
|
|
|
flexible and efficient I/O and for high volume and complex data.
|
2014-06-02 23:35:01 +08:00
|
|
|
"""
|
|
|
|
|
2017-06-30 10:38:47 +08:00
|
|
|
homepage = "https://support.hdfgroup.org/HDF5/"
|
|
|
|
url = "https://support.hdfgroup.org/ftp/HDF5/releases/hdf5-1.10/hdf5-1.10.1/src/hdf5-1.10.1.tar.gz"
|
|
|
|
list_url = "https://support.hdfgroup.org/ftp/HDF5/releases"
|
2014-06-02 23:35:01 +08:00
|
|
|
list_depth = 3
|
2015-12-24 11:49:42 +08:00
|
|
|
|
2018-08-29 16:58:24 +08:00
|
|
|
version('1.10.3', 'b600d7c914cfa80ae127cd1a1539981213fee9994ac22ebec9e3845e951d9b39')
|
2018-05-25 22:06:50 +08:00
|
|
|
version('1.10.2', '8d4eae84e533efa57496638fd0dca8c3')
|
2017-05-03 21:06:04 +08:00
|
|
|
version('1.10.1', '43a2f9466702fb1db31df98ae6677f15')
|
2016-06-01 00:18:17 +08:00
|
|
|
version('1.10.0-patch1', '9180ff0ef8dc2ef3f61bd37a7404f295')
|
2016-04-05 02:42:36 +08:00
|
|
|
version('1.10.0', 'bdc935337ee8282579cd6bc4270ad199')
|
2017-06-30 10:38:47 +08:00
|
|
|
version('1.8.19', '7f568e2464d4ab0a74d16b23956d900b')
|
|
|
|
version('1.8.18', 'dd2148b740713ca0295442ec683d7b1c')
|
2016-12-02 06:31:27 +08:00
|
|
|
version('1.8.17', '7d572f8f3b798a628b8245af0391a0ca')
|
2016-07-19 08:14:44 +08:00
|
|
|
version('1.8.16', 'b8ed9a36ae142317f88b0c7ef4b9c618')
|
2015-09-25 16:44:47 +08:00
|
|
|
version('1.8.15', '03cccb5b33dbe975fdcd8ae9dc021f24')
|
2017-01-08 01:03:50 +08:00
|
|
|
version('1.8.14', 'a482686e733514a51cde12d6fe5c5d95')
|
2014-07-31 14:30:07 +08:00
|
|
|
version('1.8.13', 'c03426e9e77d7766944654280b467289')
|
2016-09-09 04:27:47 +08:00
|
|
|
version('1.8.12', 'd804802feb99b87fc668a90e6fa34411')
|
2018-03-07 04:49:36 +08:00
|
|
|
version('1.8.10', '710aa9fb61a51d61a7e2c09bf0052157')
|
2014-06-02 23:35:01 +08:00
|
|
|
|
2016-08-10 16:50:00 +08:00
|
|
|
variant('debug', default=False,
|
|
|
|
description='Builds a debug version of the library')
|
|
|
|
variant('shared', default=True,
|
|
|
|
description='Builds a shared version of the library')
|
2016-01-20 22:22:49 +08:00
|
|
|
|
2017-10-24 17:09:08 +08:00
|
|
|
variant('hl', default=False, description='Enable the high-level library')
|
|
|
|
variant('cxx', default=False, description='Enable C++ support')
|
|
|
|
variant('fortran', default=False, description='Enable Fortran support')
|
|
|
|
variant('threadsafe', default=False,
|
|
|
|
description='Enable thread-safe capabilities')
|
2016-01-20 22:22:49 +08:00
|
|
|
|
2016-08-19 03:40:21 +08:00
|
|
|
variant('mpi', default=True, description='Enable MPI support')
|
2016-01-26 04:57:33 +08:00
|
|
|
variant('szip', default=False, description='Enable szip support')
|
2016-12-06 03:57:04 +08:00
|
|
|
variant('pic', default=True,
|
|
|
|
description='Produce position-independent code (for shared libs)')
|
2015-11-17 06:00:11 +08:00
|
|
|
|
2016-07-13 15:21:49 +08:00
|
|
|
depends_on('mpi', when='+mpi')
|
2017-09-24 12:34:00 +08:00
|
|
|
# numactl does not currently build on darwin
|
|
|
|
if sys.platform != 'darwin':
|
|
|
|
depends_on('numactl', when='+mpi+fortran')
|
2016-07-13 15:21:49 +08:00
|
|
|
depends_on('szip', when='+szip')
|
2016-10-11 22:28:08 +08:00
|
|
|
depends_on('zlib@1.1.2:')
|
2014-06-02 23:35:01 +08:00
|
|
|
|
2017-10-24 17:09:08 +08:00
|
|
|
# There are several officially unsupported combinations of the features:
|
|
|
|
# 1. Thread safety is not guaranteed via high-level C-API but in some cases
|
|
|
|
# it works.
|
|
|
|
# conflicts('+threadsafe+hl')
|
|
|
|
|
|
|
|
# 2. Thread safety is not guaranteed via Fortran (CXX) API, but it's
|
|
|
|
# possible for a dependency tree to contain a package that uses Fortran
|
|
|
|
# (CXX) API in a single thread and another one that uses low-level C-API
|
|
|
|
# in multiple threads. To allow for such scenarios, we don't specify the
|
|
|
|
# following conflicts.
|
|
|
|
# conflicts('+threadsafe+cxx')
|
|
|
|
# conflicts('+threadsafe+fortran')
|
|
|
|
|
|
|
|
# 3. Parallel features are not supported via CXX API, but for the reasons
|
|
|
|
# described in #2 we allow for such combination.
|
|
|
|
# conflicts('+mpi+cxx')
|
2017-04-07 17:18:34 +08:00
|
|
|
|
2017-12-08 16:55:06 +08:00
|
|
|
# There are known build failures with intel@18.0.1. This issue is
|
|
|
|
# discussed and patch is provided at
|
|
|
|
# https://software.intel.com/en-us/forums/intel-fortran-compiler-for-linux-and-mac-os-x/topic/747951.
|
|
|
|
patch('h5f90global-mult-obj-same-equivalence-same-common-block.patch',
|
|
|
|
when='@1.10.1%intel@18')
|
|
|
|
|
2018-03-07 04:49:36 +08:00
|
|
|
# Turn line comments into block comments to conform with pre-C99 language
|
|
|
|
# standards. Versions of hdf5 after 1.8.10 don't require this patch,
|
|
|
|
# either because they conform to pre-C99 or neglect to ask for pre-C99
|
|
|
|
# language standards from their compiler. The hdf5 build system adds
|
|
|
|
# the -ansi cflag (run 'man gcc' for info on -ansi) for some versions
|
|
|
|
# of some compilers (see hdf5-1.8.10/config/gnu-flags). The hdf5 build
|
|
|
|
# system does not provide an option to disable -ansi, but since the
|
|
|
|
# pre-C99 code is restricted to just five lines of line comments in
|
|
|
|
# three src files, this patch accomplishes the simple task of patching the
|
|
|
|
# three src files and leaves the hdf5 build system alone.
|
|
|
|
patch('pre-c99-comments.patch', when='@1.8.10')
|
|
|
|
|
2018-07-27 04:58:00 +08:00
|
|
|
# There are build errors with GCC 8, see
|
|
|
|
# https://forum.hdfgroup.org/t/1-10-2-h5detect-compile-error-gcc-8-1-0-on-centos-7-2-solved/4441
|
|
|
|
patch('https://salsa.debian.org/debian-gis-team/hdf5/raw/bf94804af5f80f662cad80a5527535b3c6537df6/debian/patches/gcc-8.patch', sha256='57cee5ff1992b4098eda079815c36fc2da9b10e00a9056df054f2384c4fc7523', when='@1.10.2%gcc@8:')
|
|
|
|
|
2017-08-02 21:37:52 +08:00
|
|
|
filter_compiler_wrappers('h5cc', 'h5c++', 'h5fc', relative_root='bin')
|
2017-06-19 20:16:18 +08:00
|
|
|
|
2017-06-30 10:38:47 +08:00
|
|
|
def url_for_version(self, version):
|
|
|
|
url = "https://support.hdfgroup.org/ftp/HDF5/releases/hdf5-{0}/hdf5-{1}/src/hdf5-{1}.tar.gz"
|
|
|
|
return url.format(version.up_to(2), version)
|
|
|
|
|
2017-04-07 17:18:34 +08:00
|
|
|
@property
|
|
|
|
def libs(self):
|
2017-05-10 23:10:31 +08:00
|
|
|
"""HDF5 can be queried for the following parameters:
|
2017-04-22 01:15:39 +08:00
|
|
|
|
2017-04-07 17:18:34 +08:00
|
|
|
- "hl": high-level interface
|
|
|
|
- "cxx": C++ APIs
|
2017-05-10 23:10:31 +08:00
|
|
|
- "fortran": Fortran APIs
|
2017-04-22 01:15:39 +08:00
|
|
|
|
2017-04-07 17:18:34 +08:00
|
|
|
:return: list of matching libraries
|
2016-01-20 22:22:49 +08:00
|
|
|
"""
|
2017-04-07 17:18:34 +08:00
|
|
|
query_parameters = self.spec.last_query.extra_parameters
|
|
|
|
|
|
|
|
shared = '+shared' in self.spec
|
|
|
|
|
|
|
|
# This map contains a translation from query_parameters
|
|
|
|
# to the libraries needed
|
|
|
|
query2libraries = {
|
|
|
|
tuple(): ['libhdf5'],
|
|
|
|
('cxx', 'fortran', 'hl'): [
|
|
|
|
'libhdf5hl_fortran',
|
|
|
|
'libhdf5_hl_cpp',
|
|
|
|
'libhdf5_hl',
|
|
|
|
'libhdf5_fortran',
|
|
|
|
'libhdf5',
|
|
|
|
],
|
|
|
|
('cxx', 'hl'): [
|
|
|
|
'libhdf5_hl_cpp',
|
|
|
|
'libhdf5_hl',
|
|
|
|
'libhdf5',
|
|
|
|
],
|
|
|
|
('fortran', 'hl'): [
|
|
|
|
'libhdf5hl_fortran',
|
|
|
|
'libhdf5_hl',
|
|
|
|
'libhdf5_fortran',
|
|
|
|
'libhdf5',
|
|
|
|
],
|
|
|
|
('hl',): [
|
|
|
|
'libhdf5_hl',
|
|
|
|
'libhdf5',
|
|
|
|
],
|
|
|
|
('cxx', 'fortran'): [
|
|
|
|
'libhdf5_fortran',
|
|
|
|
'libhdf5_cpp',
|
|
|
|
'libhdf5',
|
|
|
|
],
|
|
|
|
('cxx',): [
|
|
|
|
'libhdf5_cpp',
|
|
|
|
'libhdf5',
|
|
|
|
],
|
|
|
|
('fortran',): [
|
|
|
|
'libhdf5_fortran',
|
|
|
|
'libhdf5',
|
|
|
|
]
|
|
|
|
}
|
|
|
|
|
|
|
|
# Turn the query into the appropriate key
|
|
|
|
key = tuple(sorted(query_parameters))
|
|
|
|
libraries = query2libraries[key]
|
|
|
|
|
|
|
|
return find_libraries(
|
2017-08-03 23:21:40 +08:00
|
|
|
libraries, root=self.prefix, shared=shared, recursive=True
|
2017-04-07 17:18:34 +08:00
|
|
|
)
|
2016-01-20 22:22:49 +08:00
|
|
|
|
2017-04-07 17:18:34 +08:00
|
|
|
@run_before('configure')
|
|
|
|
def fortran_check(self):
|
2017-10-24 17:09:08 +08:00
|
|
|
if '+fortran' in self.spec and not self.compiler.fc:
|
2017-05-10 23:10:31 +08:00
|
|
|
msg = 'cannot build a Fortran variant without a Fortran compiler'
|
2016-01-20 22:22:49 +08:00
|
|
|
raise RuntimeError(msg)
|
|
|
|
|
2016-07-13 03:28:09 +08:00
|
|
|
def configure_args(self):
|
2016-03-10 03:16:35 +08:00
|
|
|
# Always enable this option. This does not actually enable any
|
|
|
|
# features: it only *allows* the user to specify certain
|
|
|
|
# combinations of other arguments. Enabling it just skips a
|
|
|
|
# sanity check in configure, so this doesn't merit a variant.
|
2017-10-24 17:09:08 +08:00
|
|
|
extra_args = ['--enable-unsupported']
|
|
|
|
extra_args += self.enable_or_disable('threadsafe')
|
|
|
|
extra_args += self.enable_or_disable('cxx')
|
|
|
|
extra_args += self.enable_or_disable('hl')
|
|
|
|
extra_args += self.enable_or_disable('fortran')
|
|
|
|
|
|
|
|
if '+szip' in self.spec:
|
|
|
|
extra_args.append('--with-szlib=%s' % self.spec['szip'].prefix)
|
|
|
|
else:
|
|
|
|
extra_args.append('--without-szlib')
|
2016-03-10 03:16:35 +08:00
|
|
|
|
2017-10-24 17:09:08 +08:00
|
|
|
if self.spec.satisfies('@1.10:'):
|
|
|
|
if '+debug' in self.spec:
|
2016-04-03 08:21:56 +08:00
|
|
|
extra_args.append('--enable-build-mode=debug')
|
|
|
|
else:
|
|
|
|
extra_args.append('--enable-build-mode=production')
|
2016-01-20 22:22:49 +08:00
|
|
|
else:
|
2017-10-24 17:09:08 +08:00
|
|
|
if '+debug' in self.spec:
|
2016-04-03 08:21:56 +08:00
|
|
|
extra_args.append('--enable-debug=all')
|
|
|
|
else:
|
|
|
|
extra_args.append('--enable-production')
|
2016-01-20 22:22:49 +08:00
|
|
|
|
2017-10-24 17:09:08 +08:00
|
|
|
# '--enable-fortran2003' no longer exists as of version 1.10.0
|
|
|
|
if '+fortran' in self.spec:
|
|
|
|
extra_args.append('--enable-fortran2003')
|
|
|
|
else:
|
|
|
|
extra_args.append('--disable-fortran2003')
|
|
|
|
|
|
|
|
if '+shared' in self.spec:
|
2016-02-18 03:51:24 +08:00
|
|
|
extra_args.append('--enable-shared')
|
|
|
|
else:
|
2017-09-22 09:14:31 +08:00
|
|
|
extra_args.append('--disable-shared')
|
2016-02-17 08:43:24 +08:00
|
|
|
extra_args.append('--enable-static-exec')
|
|
|
|
|
2017-10-24 17:09:08 +08:00
|
|
|
if '+pic' in self.spec:
|
|
|
|
extra_args += ['%s=%s' % (f, self.compiler.pic_flag)
|
|
|
|
for f in ['CFLAGS', 'CXXFLAGS', 'FCFLAGS']]
|
2016-01-20 22:22:49 +08:00
|
|
|
|
2017-10-24 17:09:08 +08:00
|
|
|
if '+mpi' in self.spec:
|
2015-12-24 11:49:42 +08:00
|
|
|
# The HDF5 configure script warns if cxx and mpi are enabled
|
|
|
|
# together. There doesn't seem to be a real reason for this, except
|
|
|
|
# that parts of the MPI interface are not accessible via the C++
|
|
|
|
# interface. Since they are still accessible via the C interface,
|
|
|
|
# this is not actually a problem.
|
2017-10-24 17:09:08 +08:00
|
|
|
extra_args += ['--enable-parallel',
|
|
|
|
'CC=%s' % self.spec['mpi'].mpicc]
|
2016-01-20 22:22:49 +08:00
|
|
|
|
2017-10-24 17:09:08 +08:00
|
|
|
if '+cxx' in self.spec:
|
|
|
|
extra_args.append('CXX=%s' % self.spec['mpi'].mpicxx)
|
2016-01-20 22:22:49 +08:00
|
|
|
|
2017-10-24 17:09:08 +08:00
|
|
|
if '+fortran' in self.spec:
|
|
|
|
extra_args.append('FC=%s' % self.spec['mpi'].mpifc)
|
2016-01-26 04:57:33 +08:00
|
|
|
|
2017-10-24 17:09:08 +08:00
|
|
|
extra_args.append('--with-zlib=%s' % self.spec['zlib'].prefix)
|
2015-01-23 03:50:01 +08:00
|
|
|
|
2017-10-24 17:09:08 +08:00
|
|
|
return extra_args
|
2016-07-13 03:28:09 +08:00
|
|
|
|
2017-04-07 17:18:34 +08:00
|
|
|
@run_after('configure')
|
|
|
|
def patch_postdeps(self):
|
|
|
|
if '@:1.8.14' in self.spec:
|
2017-01-08 01:03:50 +08:00
|
|
|
# On Ubuntu14, HDF5 1.8.12 (and maybe other versions)
|
|
|
|
# mysteriously end up with "-l -l" in the postdeps in the
|
|
|
|
# libtool script. Patch this by removing the spurious -l's.
|
|
|
|
filter_file(
|
|
|
|
r'postdeps="([^"]*)"',
|
|
|
|
lambda m: 'postdeps="%s"' % ' '.join(
|
|
|
|
arg for arg in m.group(1).split(' ') if arg != '-l'),
|
|
|
|
'libtool')
|
|
|
|
|
2017-01-25 23:57:01 +08:00
|
|
|
@run_after('install')
|
2017-04-22 01:15:39 +08:00
|
|
|
@on_package_attributes(run_tests=True)
|
2016-11-11 13:50:32 +08:00
|
|
|
def check_install(self):
|
2016-10-24 01:02:46 +08:00
|
|
|
# Build and run a small program to test the installed HDF5 library
|
2016-07-13 03:28:09 +08:00
|
|
|
spec = self.spec
|
2016-08-11 15:08:00 +08:00
|
|
|
print("Checking HDF5 installation...")
|
2016-04-21 04:33:59 +08:00
|
|
|
checkdir = "spack-check"
|
|
|
|
with working_dir(checkdir, create=True):
|
|
|
|
source = r"""
|
|
|
|
#include <hdf5.h>
|
|
|
|
#include <assert.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
int main(int argc, char **argv) {
|
|
|
|
unsigned majnum, minnum, relnum;
|
|
|
|
herr_t herr = H5get_libversion(&majnum, &minnum, &relnum);
|
|
|
|
assert(!herr);
|
|
|
|
printf("HDF5 version %d.%d.%d %u.%u.%u\n", H5_VERS_MAJOR, H5_VERS_MINOR,
|
|
|
|
H5_VERS_RELEASE, majnum, minnum, relnum);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
"""
|
|
|
|
expected = """\
|
|
|
|
HDF5 version {version} {version}
|
2016-06-23 03:40:51 +08:00
|
|
|
""".format(version=str(spec.version.up_to(3)))
|
2016-04-21 04:33:59 +08:00
|
|
|
with open("check.c", 'w') as f:
|
|
|
|
f.write(source)
|
|
|
|
if '+mpi' in spec:
|
2017-03-19 09:14:47 +08:00
|
|
|
cc = Executable(spec['mpi'].mpicc)
|
2016-04-21 04:33:59 +08:00
|
|
|
else:
|
2017-03-19 09:14:47 +08:00
|
|
|
cc = Executable(self.compiler.cc)
|
Python command, libraries, and headers (#3367)
## Motivation
Python installations are both important and unfortunately inconsistent. Depending on the Python version, OS, and the strength of the Earth's magnetic field when it was installed, the name of the Python executable, directory containing its libraries, library names, and the directory containing its headers can vary drastically.
I originally got into this mess with #3274, where I discovered that Boost could not be built with Python 3 because the executable is called `python3` and we were telling it to use `python`. I got deeper into this mess when I started hacking on #3140, where I discovered just how difficult it is to find the location and name of the Python libraries and headers.
Currently, half of the packages that depend on Python and need to know this information jump through hoops to determine the correct information. The other half are hard-coded to use `python`, `spec['python'].prefix.lib`, and `spec['python'].prefix.include`. Obviously, none of these packages would work for Python 3, and there's no reason to duplicate the effort. The Python package itself should contain all of the information necessary to use it properly. This is in line with the recent work by @alalazo and @davydden with respect to `spec['blas'].libs` and friends.
## Prefix
For most packages in Spack, we assume that the installation directory is `spec['python'].prefix`. This generally works for anything installed with Spack, but gets complicated when we include external packages. Python is a commonly used external package (it needs to be installed just to run Spack). If it was installed with Homebrew, `which python` would return `/usr/local/bin/python`, and most users would erroneously assume that `/usr/local` is the installation directory. If you peruse through #2173, you'll immediately see why this is not the case. Homebrew actually installs Python in `/usr/local/Cellar/python/2.7.12_2` and symlinks the executable to `/usr/local/bin/python`. `PYTHONHOME` (and presumably most things that need to know where Python is installed) needs to be set to the actual installation directory, not `/usr/local`.
Normally I would say, "sounds like user error, make sure to use the real installation directory in your `packages.yaml`". But I think we can make a special case for Python. That's what we decided in #2173 anyway. If we change our minds, I would be more than happy to simplify things.
To solve this problem, I created a `spec['python'].home` attribute that works the same way as `spec['python'].prefix` but queries Python to figure out where it was actually installed. @tgamblin Is there any way to overwrite `spec['python'].prefix`? I think it's currently immutable.
## Command
In general, Python 2 comes with both `python` and `python2` commands, while Python 3 only comes with a `python3` command. But this is up to the OS developers. For example, `/usr/bin/python` on Gentoo is actually Python 3. Worse yet, if someone is using an externally installed Python, all 3 commands may exist in the same directory! Here's what I'm thinking:
If the spec is for Python 3, try searching for the `python3` command.
If the spec is for Python 2, try searching for the `python2` command.
If neither are found, try searching for the `python` command.
## Libraries
Spack installs Python libraries in `spec['python'].prefix.lib`. Except on openSUSE 13, where it installs to `spec['python'].prefix.lib64` (see #2295 and #2253). On my CentOS 6 machine, the Python libraries are installed in `/usr/lib64`. Both need to work.
The libraries themselves change name depending on OS and Python version. For Python 2.7 on macOS, I'm seeing:
```
lib/libpython2.7.dylib
```
For Python 3.6 on CentOS 6, I'm seeing:
```
lib/libpython3.so
lib/libpython3.6m.so.1.0
lib/libpython3.6m.so -> lib/libpython3.6m.so.1.0
```
Notice the `m` after the version number. Yeah, that's a thing.
## Headers
In Python 2.7, I'm seeing:
```
include/python2.7/pyconfig.h
```
In Python 3.6, I'm seeing:
```
include/python3.6m/pyconfig.h
```
It looks like all Python 3 installations have this `m`. Tested with Python 3.2 and 3.6 on macOS and CentOS 6
Spack has really nice support for libraries (`find_libraries` and `LibraryList`), but nothing for headers. Fixed.
2017-04-30 08:24:13 +08:00
|
|
|
cc(*(['-c', "check.c"] + spec['hdf5'].headers.cpp_flags.split()))
|
2017-03-19 09:14:47 +08:00
|
|
|
cc(*(['-o', "check", "check.o"] +
|
|
|
|
spec['hdf5'].libs.ld_flags.split()))
|
2016-04-21 04:33:59 +08:00
|
|
|
try:
|
2016-04-23 09:52:11 +08:00
|
|
|
check = Executable('./check')
|
2017-06-15 17:27:18 +08:00
|
|
|
output = check(output=str)
|
2017-10-23 22:51:11 +08:00
|
|
|
except ProcessError:
|
2016-04-21 04:33:59 +08:00
|
|
|
output = ""
|
|
|
|
success = output == expected
|
|
|
|
if not success:
|
2016-08-11 15:08:00 +08:00
|
|
|
print("Produced output does not match expected output.")
|
|
|
|
print("Expected output:")
|
|
|
|
print('-' * 80)
|
|
|
|
print(expected)
|
|
|
|
print('-' * 80)
|
|
|
|
print("Produced output:")
|
|
|
|
print('-' * 80)
|
|
|
|
print(output)
|
|
|
|
print('-' * 80)
|
2016-04-21 04:33:59 +08:00
|
|
|
raise RuntimeError("HDF5 install check failed")
|
|
|
|
shutil.rmtree(checkdir)
|