From 7459aa6c95fddafd9f7d3f46b2fe37d68e25ae01 Mon Sep 17 00:00:00 2001 From: "Seth R. Johnson" Date: Mon, 21 Feb 2022 03:08:08 -0500 Subject: Various package fixes for macOS (#29024) * trilinos: disable dl on macOS * py-sphinx-argparse: add explicit poetry dependency * libzmq: fix libbsd dependency libbsd is *always* required when +libbsd (introduced in #28503) . #20893 had previously removed the macos dependency because libbsd wasn't always enabled. Libbsd support is only available after 4.3.2 so change it to a conflict rather than bumping the dependency. * hdf5: work around GCC11.2 monterey fortran bug * go-bootstrap: mark conflict for monterey --- .../repos/builtin/packages/go-bootstrap/package.py | 1 + .../builtin/packages/hdf5/fortran-kinds-2.patch | 24 ++++++++++++++++++++++ var/spack/repos/builtin/packages/hdf5/package.py | 8 ++++++++ var/spack/repos/builtin/packages/libzmq/package.py | 7 +++---- .../builtin/packages/py-sphinx-argparse/package.py | 1 + .../repos/builtin/packages/trilinos/package.py | 8 +++++++- 6 files changed, 44 insertions(+), 5 deletions(-) create mode 100644 var/spack/repos/builtin/packages/hdf5/fortran-kinds-2.patch diff --git a/var/spack/repos/builtin/packages/go-bootstrap/package.py b/var/spack/repos/builtin/packages/go-bootstrap/package.py index 92c4d59898..2549d526a0 100644 --- a/var/spack/repos/builtin/packages/go-bootstrap/package.py +++ b/var/spack/repos/builtin/packages/go-bootstrap/package.py @@ -35,6 +35,7 @@ class GoBootstrap(Package): depends_on('git', type=('build', 'link', 'run')) + conflicts('os=monterey', msg="go-bootstrap won't build on new macOS") conflicts('target=aarch64:', when='platform=darwin', msg='Go bootstrap is too old for Apple Silicon') diff --git a/var/spack/repos/builtin/packages/hdf5/fortran-kinds-2.patch b/var/spack/repos/builtin/packages/hdf5/fortran-kinds-2.patch new file mode 100644 index 0000000000..caee520103 --- /dev/null +++ b/var/spack/repos/builtin/packages/hdf5/fortran-kinds-2.patch @@ -0,0 +1,24 @@ +From 598df49b738fd99df9f2671e4e967fd9c33ae8a9 Mon Sep 17 00:00:00 2001 +From: Seth R Johnson +Date: Wed, 16 Feb 2022 20:38:03 -0500 +Subject: [PATCH] Close file to work around GCC11.2/macOS12 bug + +--- + m4/aclocal_fc.f90 | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/m4/aclocal_fc.f90 b/m4/aclocal_fc.f90 +index e9a11c0ab5..bfda49aa40 100644 +--- a/m4/aclocal_fc.f90 ++++ b/m4/aclocal_fc.f90 +@@ -151,6 +151,7 @@ PROGRAM FC_AVAIL_KINDS + WRITE(8,'(I0)') max_decimal_prec + WRITE(8,'(I0)') num_ikinds + WRITE(8,'(I0)') num_rkinds ++ CLOSE(8) + END PROGRAM FC_AVAIL_KINDS + !---- END ----- Determine the available KINDs for REALs and INTEGERs + +-- +2.32.0 + diff --git a/var/spack/repos/builtin/packages/hdf5/package.py b/var/spack/repos/builtin/packages/hdf5/package.py index 47af3ea830..c177fbc3da 100644 --- a/var/spack/repos/builtin/packages/hdf5/package.py +++ b/var/spack/repos/builtin/packages/hdf5/package.py @@ -162,6 +162,14 @@ class Hdf5(CMakePackage): patch('fortran-kinds.patch', when='@1.10.7') + # This patch may only be needed with GCC11.2 on macOS, but it's valid for + # any of the head HDF5 versions as of 12/2021. Since it's impossible to + # tell what Fortran version is part of a mixed apple-clang toolchain on + # macOS (which is the norm), and this might be an issue for other compilers + # as well, we just apply it to all platforms. + # See https://github.com/HDFGroup/hdf5/issues/1157 + patch('fortran-kinds-2.patch', when='@1.10.8,1.12.1') + # The argument 'buf_size' of the C function 'h5fget_file_image_c' is # declared as intent(in) though it is modified by the invocation. As a # result, aggressive compilers such as Fujitsu's may do a wrong diff --git a/var/spack/repos/builtin/packages/libzmq/package.py b/var/spack/repos/builtin/packages/libzmq/package.py index 1827f986e3..5bc1717fa4 100644 --- a/var/spack/repos/builtin/packages/libzmq/package.py +++ b/var/spack/repos/builtin/packages/libzmq/package.py @@ -3,7 +3,7 @@ # # SPDX-License-Identifier: (Apache-2.0 OR MIT) -from spack import * +import sys class Libzmq(AutotoolsPackage): @@ -37,7 +37,7 @@ class Libzmq(AutotoolsPackage): variant("docs", default=True, description="Build documentation") - variant("libbsd", default=True, + variant("libbsd", when='@4.3.3:', default=(sys.platform != 'darwin'), description="Use strlcpy from libbsd " + "(will use own implementation if false)") @@ -51,8 +51,7 @@ class Libzmq(AutotoolsPackage): depends_on('docbook-xml', type='build', when='+docs') depends_on('docbook-xsl', type='build', when='+docs') - depends_on('libbsd', when='@4.3.3: platform=linux +libbsd') - depends_on('libbsd', when='@4.3.3: platform=cray +libbsd') + depends_on('libbsd', when='+libbsd') conflicts('%gcc@8:', when='@:4.2.2') diff --git a/var/spack/repos/builtin/packages/py-sphinx-argparse/package.py b/var/spack/repos/builtin/packages/py-sphinx-argparse/package.py index a3158fcfc6..6ac0c39d67 100644 --- a/var/spack/repos/builtin/packages/py-sphinx-argparse/package.py +++ b/var/spack/repos/builtin/packages/py-sphinx-argparse/package.py @@ -18,4 +18,5 @@ class PySphinxArgparse(PythonPackage): depends_on('python@2.7.0:2.7,3.5:', type=('build', 'run')) depends_on('py-sphinx@1.2.0:', type=('build', 'run')) + depends_on('py-poetry-core', type='build') depends_on('py-setuptools', type='build') diff --git a/var/spack/repos/builtin/packages/trilinos/package.py b/var/spack/repos/builtin/packages/trilinos/package.py index 6bfbb31583..5ac68ff6ee 100644 --- a/var/spack/repos/builtin/packages/trilinos/package.py +++ b/var/spack/repos/builtin/packages/trilinos/package.py @@ -528,7 +528,6 @@ class Trilinos(CMakePackage, CudaPackage, ROCmPackage): define_trilinos_enable('TrilinosCouplings'), define_trilinos_enable('Zoltan'), define_trilinos_enable('Zoltan2'), - define_tpl_enable('Cholmod', False), define_from_variant('EpetraExt_BUILD_BTF', 'epetraextbtf'), define_from_variant('EpetraExt_BUILD_EXPERIMENTAL', 'epetraextexperimental'), @@ -688,6 +687,13 @@ class Trilinos(CMakePackage, CudaPackage, ROCmPackage): define('PNetCDF_ROOT', spec['parallel-netcdf'].prefix), ]) + options.append(define_tpl_enable('Cholmod', False)) + + if spec.satisfies('platform=darwin'): + # Don't let TriBITS define `libdl` as an absolute path to + # the MacOSX{nn.n}.sdk since that breaks at every xcode update + options.append(define_tpl_enable('DLlib', False)) + # ################# Explicit template instantiation ################# complex_s = spec.variants['complex'].value -- cgit v1.2.3-70-g09d2