diff options
author | Massimiliano Culpo <massimiliano.culpo@gmail.com> | 2020-06-25 18:18:48 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-25 11:18:48 -0500 |
commit | 14599f09be6cd6eac4dc4d9d2d01a0ad001ae3f5 (patch) | |
tree | 62b50d312323e206a11a0d8c7b4db58024768439 /var | |
parent | a31c115d799c364f60e82fed02ba1fcc80bd935f (diff) | |
download | spack-14599f09be6cd6eac4dc4d9d2d01a0ad001ae3f5.tar.gz spack-14599f09be6cd6eac4dc4d9d2d01a0ad001ae3f5.tar.bz2 spack-14599f09be6cd6eac4dc4d9d2d01a0ad001ae3f5.tar.xz spack-14599f09be6cd6eac4dc4d9d2d01a0ad001ae3f5.zip |
Separate Apple Clang from LLVM Clang (#17110)
* Separate Apple Clang from LLVM Clang
Apple Clang is a compiler of its own. All places
referring to "-apple" suffix have been updated.
* Hack to use a dash in 'apple-clang'
To be able to use autodoc from Sphinx we need
a valid Python name for the module that contains
Apple's Clang code.
* Updated packages to account for the existence of apple-clang
Co-authored-by: Adam J. Stewart <ajstewart426@gmail.com>
* Added unit test for XCode related functions
Co-authored-by: Gregory Becker <becker33@llnl.gov>
Co-authored-by: Adam J. Stewart <ajstewart426@gmail.com>
Diffstat (limited to 'var')
62 files changed, 136 insertions, 94 deletions
diff --git a/var/spack/repos/builtin/packages/allpaths-lg/package.py b/var/spack/repos/builtin/packages/allpaths-lg/package.py index 6ebca2eee6..b0bb49b3a1 100644 --- a/var/spack/repos/builtin/packages/allpaths-lg/package.py +++ b/var/spack/repos/builtin/packages/allpaths-lg/package.py @@ -18,6 +18,7 @@ class AllpathsLg(AutotoolsPackage): # compiles with gcc 4.7.0 to 4.9.4) conflicts('%gcc@:4.6.4,5.1.0:') conflicts('%cce') + conflicts('%apple-clang') conflicts('%clang') conflicts('%intel') conflicts('%nag') diff --git a/var/spack/repos/builtin/packages/aluminum/package.py b/var/spack/repos/builtin/packages/aluminum/package.py index 5edc4c3792..c5d6a45ed8 100644 --- a/var/spack/repos/builtin/packages/aluminum/package.py +++ b/var/spack/repos/builtin/packages/aluminum/package.py @@ -47,8 +47,8 @@ class Aluminum(CMakePackage): '-DALUMINUM_ENABLE_MPI_CUDA:BOOL=%s' % ('+mpi_cuda' in spec), '-DALUMINUM_ENABLE_NCCL:BOOL=%s' % ('+nccl' in spec)] - # Add support for OS X to find OpenMP - if (self.spec.satisfies('%clang platform=darwin')): + # Add support for OS X to find OpenMP (LLVM installed via brew) + if self.spec.satisfies('%clang platform=darwin'): clang = self.compiler.cc clang_bin = os.path.dirname(clang) clang_root = os.path.dirname(clang_bin) diff --git a/var/spack/repos/builtin/packages/amber/package.py b/var/spack/repos/builtin/packages/amber/package.py index d2ec13fb3e..481377047c 100644 --- a/var/spack/repos/builtin/packages/amber/package.py +++ b/var/spack/repos/builtin/packages/amber/package.py @@ -100,12 +100,10 @@ class Amber(Package, CudaPackage): depends_on('cuda@7.5.18', when='@:16+cuda') # conflicts - conflicts('+x11', when='platform=cray', - msg='x11 amber applications not available for cray') - conflicts('+openmp', when='%clang', - msg='openmp optimizations not available for the clang compiler') - conflicts('+openmp', when='%pgi', - msg='openmp optimizations not available for the pgi compiler') + conflicts('+x11', when='platform=cray', msg='x11 amber applications not available for cray') + conflicts('+openmp', when='%clang', msg='OpenMP optimizations not available for the clang compiler') + conflicts('+openmp', when='%apple-clang', msg='OpenMP optimizations not available for the Apple clang compiler') + conflicts('+openmp', when='%pgi', msg='OpenMP optimizations not available for the pgi compiler') def setup_build_environment(self, env): amber_src = self.stage.source_path diff --git a/var/spack/repos/builtin/packages/amrex/package.py b/var/spack/repos/builtin/packages/amrex/package.py index 32da808f1d..f6cb778f4b 100644 --- a/var/spack/repos/builtin/packages/amrex/package.py +++ b/var/spack/repos/builtin/packages/amrex/package.py @@ -65,6 +65,7 @@ class Amrex(CMakePackage): depends_on('cmake@3.5:', type='build', when='@:18.10.99') depends_on('cmake@3.13:', type='build', when='@18.11:') depends_on('cmake@3.14:', type='build', when='@19.04:') + conflicts('%apple-clang') conflicts('%clang') def url_for_version(self, version): diff --git a/var/spack/repos/builtin/packages/ape/package.py b/var/spack/repos/builtin/packages/ape/package.py index 114185aaa4..bf9f895e68 100644 --- a/var/spack/repos/builtin/packages/ape/package.py +++ b/var/spack/repos/builtin/packages/ape/package.py @@ -29,11 +29,13 @@ class Ape(Package): # When preprocessor expands macros (i.e. CFLAGS) defined as quoted # strings the result may be > 132 chars and is terminated. # This will look to a compiler as an Unterminated character constant - # and produce Line truncated errors. To vercome this, add flags to + # and produce Line truncated errors. To overcome this, add flags to # let compiler know that the entire line is meaningful. # TODO: For the lack of better approach, assume that clang is mixed - # with GNU fortran. - if spec.satisfies('%clang') or spec.satisfies('%gcc'): + # TODO: with GNU fortran. + if (spec.satisfies('%apple-clang') or + spec.satisfies('%clang') or + spec.satisfies('%gcc')): args.extend([ 'FCFLAGS=-O2 -ffree-line-length-none' ]) diff --git a/var/spack/repos/builtin/packages/atlas/package.py b/var/spack/repos/builtin/packages/atlas/package.py index 4d56d0016d..2a355dfca7 100644 --- a/var/spack/repos/builtin/packages/atlas/package.py +++ b/var/spack/repos/builtin/packages/atlas/package.py @@ -102,7 +102,7 @@ class Atlas(Package): # Workaround for macOS Clang: # http://math-atlas.sourceforge.net/atlas_install/node66.html - if spec.satisfies('@3.10.3: %clang platform=darwin'): + if spec.satisfies('@3.10.3: %apple-clang'): options.append('--force-clang=' + spack_cc) # Lapack resource to provide full lapack build. Note that diff --git a/var/spack/repos/builtin/packages/binutils/package.py b/var/spack/repos/builtin/packages/binutils/package.py index 791606f564..96fdcc067b 100644 --- a/var/spack/repos/builtin/packages/binutils/package.py +++ b/var/spack/repos/builtin/packages/binutils/package.py @@ -120,9 +120,10 @@ class Binutils(AutotoolsPackage, GNUMirrorPackage): def flag_handler(self, name, flags): # To ignore the errors of narrowing conversions for # the Fujitsu compiler - if name == 'cxxflags'\ - and (self.compiler.name == 'fj' or self.compiler.name == 'clang')\ - and self.version <= ver('2.31.1'): + if name == 'cxxflags' and ( + self.spec.satisfies('@:2.31.1') and + self.compiler.name in ('fj', 'clang', 'apple-clang') + ): flags.append('-Wno-narrowing') elif name == 'cflags': if self.spec.satisfies('@:2.34 %gcc@10:'): diff --git a/var/spack/repos/builtin/packages/boost/package.py b/var/spack/repos/builtin/packages/boost/package.py index 1e5bd00c2b..d0d8691c33 100644 --- a/var/spack/repos/builtin/packages/boost/package.py +++ b/var/spack/repos/builtin/packages/boost/package.py @@ -398,7 +398,9 @@ class Boost(Package): # and at least in clang 3.9 still fails to build # http://www.boost.org/build/doc/html/bbv2/reference/precompiled_headers.html # https://svn.boost.org/trac/boost/ticket/12496 - if spec.satisfies('%clang') or spec.satisfies('%fj'): + if (spec.satisfies('%apple-clang') or + spec.satisfies('%clang') or + spec.satisfies('%fj')): options.extend(['pch=off']) if '+clanglibcpp' in spec: cxxflags.append('-stdlib=libc++') diff --git a/var/spack/repos/builtin/packages/bucky/package.py b/var/spack/repos/builtin/packages/bucky/package.py index 859fabde34..41337e7e84 100644 --- a/var/spack/repos/builtin/packages/bucky/package.py +++ b/var/spack/repos/builtin/packages/bucky/package.py @@ -19,6 +19,7 @@ class Bucky(MakefilePackage): # Compilation requires gcc conflicts('%cce') + conflicts('%apple-clang') conflicts('%clang') conflicts('%intel') conflicts('%nag') diff --git a/var/spack/repos/builtin/packages/cbench/package.py b/var/spack/repos/builtin/packages/cbench/package.py index ceeec3b468..8a24a54d6e 100644 --- a/var/spack/repos/builtin/packages/cbench/package.py +++ b/var/spack/repos/builtin/packages/cbench/package.py @@ -26,6 +26,7 @@ class Cbench(MakefilePackage): # The following compilers are not supported by Cbench: conflicts('%cce') + conflicts('%apple-clang') conflicts('%clang') conflicts('%nag') conflicts('%xl') diff --git a/var/spack/repos/builtin/packages/cp2k/package.py b/var/spack/repos/builtin/packages/cp2k/package.py index 0a172d025f..1fba619ffc 100644 --- a/var/spack/repos/builtin/packages/cp2k/package.py +++ b/var/spack/repos/builtin/packages/cp2k/package.py @@ -141,6 +141,7 @@ class Cp2k(MakefilePackage, CudaPackage): depends_on('wannier90', when='@3.0+mpi', type='build') # CP2K needs compiler specific compilation flags, e.g. optflags + conflicts('%apple-clang') conflicts('%clang') conflicts('%nag') diff --git a/var/spack/repos/builtin/packages/dealii/package.py b/var/spack/repos/builtin/packages/dealii/package.py index 0f46c318f6..8d7bd2be81 100644 --- a/var/spack/repos/builtin/packages/dealii/package.py +++ b/var/spack/repos/builtin/packages/dealii/package.py @@ -301,7 +301,7 @@ class Dealii(CMakePackage, CudaPackage): cxx_flags_release.extend(['-O3']) elif spec.satisfies('%intel'): cxx_flags_release.extend(['-O3']) - elif spec.satisfies('%clang'): + elif spec.satisfies('%clang') or spec.satisfies('%apple-clang'): cxx_flags_release.extend(['-O3', '-ffp-contract=fast']) # Python bindings diff --git a/var/spack/repos/builtin/packages/elfutils/package.py b/var/spack/repos/builtin/packages/elfutils/package.py index 651caf3d76..cd6b961227 100644 --- a/var/spack/repos/builtin/packages/elfutils/package.py +++ b/var/spack/repos/builtin/packages/elfutils/package.py @@ -56,6 +56,7 @@ class Elfutils(AutotoolsPackage, SourcewarePackage): # in gcc, but not in clang. C code compiled with gcc is # binary-compatible with clang, so it should be possible to build # elfutils with gcc, and then link it to clang-built libraries. + conflicts('%apple-clang') conflicts('%clang') # Elfutils uses -Wall and we don't want to fail the build over a diff --git a/var/spack/repos/builtin/packages/f18/package.py b/var/spack/repos/builtin/packages/f18/package.py index 699cfde6c6..235210c142 100644 --- a/var/spack/repos/builtin/packages/f18/package.py +++ b/var/spack/repos/builtin/packages/f18/package.py @@ -30,6 +30,9 @@ class F18(CMakePackage): # Conflicts compiler_warning = 'F18 requires a compiler with support for C++17' + # See https://en.wikipedia.org/wiki/Xcode#Latest_versions for a + # conversion table from LLVM versions to Apple's Clang + conflicts('%apple-clang@:10.1', msg=compiler_warning) conflicts('%clang@:6', msg=compiler_warning) conflicts('%gcc@:7.1', msg=compiler_warning) conflicts('%intel', msg=compiler_warning) diff --git a/var/spack/repos/builtin/packages/fftw/package.py b/var/spack/repos/builtin/packages/fftw/package.py index 961c4cfc66..b644677fd1 100644 --- a/var/spack/repos/builtin/packages/fftw/package.py +++ b/var/spack/repos/builtin/packages/fftw/package.py @@ -57,6 +57,7 @@ class Fftw(AutotoolsPackage): msg='Long double precision is not supported in FFTW 2') conflicts('precision=quad', when='@2.1.5', msg='Quad precision is not supported in FFTW 2') + conflicts('+openmp', when='%apple-clang', msg="Apple's clang does not support OpenMP") provides('fftw-api@2', when='@2.1.5') provides('fftw-api@3', when='@3:') @@ -124,11 +125,6 @@ class Fftw(AutotoolsPackage): # Variants that affect every precision if '+openmp' in spec: - # Note: Apple's Clang does not support OpenMP. - if spec.satisfies('%clang'): - ver = str(self.compiler.version) - if ver.endswith('-apple'): - raise InstallError("Apple's clang does not support OpenMP") options.append('--enable-openmp') if spec.satisfies('@:2'): # TODO: libtool strips CFLAGS, so 2.x libxfftw_threads diff --git a/var/spack/repos/builtin/packages/fujitsu-mpi/package.py b/var/spack/repos/builtin/packages/fujitsu-mpi/package.py index c0a882ec4c..fcf4dc8e94 100644 --- a/var/spack/repos/builtin/packages/fujitsu-mpi/package.py +++ b/var/spack/repos/builtin/packages/fujitsu-mpi/package.py @@ -13,6 +13,7 @@ class FujitsuMpi(Package): conflicts('%arm') conflicts('%cce') + conflicts('%apple-clang') conflicts('%clang') conflicts('%gcc') conflicts('%intel') diff --git a/var/spack/repos/builtin/packages/gitconddb/package.py b/var/spack/repos/builtin/packages/gitconddb/package.py index 9400ea549c..e2808e91c0 100644 --- a/var/spack/repos/builtin/packages/gitconddb/package.py +++ b/var/spack/repos/builtin/packages/gitconddb/package.py @@ -40,4 +40,5 @@ class Gitconddb(CMakePackage): # Known conflicts on C++17 compatibility (aggressive for now) conflicts('%gcc@:7.9.999', msg="GitCondDB requires GCC 8 or newer for C++17 support") + conflicts('%apple-clang', when="@:0.1.99", msg="No Darwin support for clang in older versions") conflicts('%clang platform=darwin', when="@:0.1.99", msg="No Darwin support for clang in older versions") diff --git a/var/spack/repos/builtin/packages/graphviz/package.py b/var/spack/repos/builtin/packages/graphviz/package.py index 4f8e772f19..34b2d8dd2e 100644 --- a/var/spack/repos/builtin/packages/graphviz/package.py +++ b/var/spack/repos/builtin/packages/graphviz/package.py @@ -137,6 +137,13 @@ class Graphviz(AutotoolsPackage): filter_file(r'-lstdc\+\+', '-lc++', 'configure.ac', *(d + '/Makefile.am' for d in mkdirs)) + @when('%apple-clang') + def patch(self): + # When using Clang, replace GCC's libstdc++ with LLVM's libc++ + mkdirs = ['cmd/dot', 'cmd/edgepaint', 'cmd/mingle', 'plugin/gdiplus'] + filter_file(r'-lstdc\+\+', '-lc++', 'configure.ac', + *(d + '/Makefile.am' for d in mkdirs)) + def configure_args(self): spec = self.spec args = ['--disable-silent-rules'] diff --git a/var/spack/repos/builtin/packages/hpgmg/package.py b/var/spack/repos/builtin/packages/hpgmg/package.py index e701d1c212..f5567ba2c9 100644 --- a/var/spack/repos/builtin/packages/hpgmg/package.py +++ b/var/spack/repos/builtin/packages/hpgmg/package.py @@ -59,13 +59,11 @@ class Hpgmg(Package): args.append('--no-fv') else: # Apple's Clang doesn't support OpenMP - if not (self.spec.satisfies('%clang') and self.compiler.is_apple): + if not self.spec.satisfies('%apple-clang'): cflags.append(self.compiler.openmp_flag) if '+debug' in self.spec: cflags.append('-g') - elif any(map(self.spec.satisfies, ['%gcc', '%clang', '%intel'])): - cflags.append('-O3') else: cflags.append('-O3') diff --git a/var/spack/repos/builtin/packages/hydrogen/package.py b/var/spack/repos/builtin/packages/hydrogen/package.py index 449fe046dc..9d12235d72 100644 --- a/var/spack/repos/builtin/packages/hydrogen/package.py +++ b/var/spack/repos/builtin/packages/hydrogen/package.py @@ -131,8 +131,8 @@ class Hydrogen(CMakePackage): '-DHydrogen_ENABLE_HALF=%s' % ('+half' in spec), ] - # Add support for OS X to find OpenMP - if (self.spec.satisfies('%clang platform=darwin')): + # Add support for OS X to find OpenMP (LLVM installed via brew) + if self.spec.satisfies('%clang platform=darwin'): clang = self.compiler.cc clang_bin = os.path.dirname(clang) clang_root = os.path.dirname(clang_bin) diff --git a/var/spack/repos/builtin/packages/intel-tbb/package.py b/var/spack/repos/builtin/packages/intel-tbb/package.py index c470e8933b..4c652f6fce 100644 --- a/var/spack/repos/builtin/packages/intel-tbb/package.py +++ b/var/spack/repos/builtin/packages/intel-tbb/package.py @@ -69,6 +69,8 @@ class IntelTbb(Package): # # See https://github.com/intel/tbb/pull/147 for details. # + conflicts('%apple-clang', when='@:2019.6', + msg='2019.7 or later required for clang') conflicts('%clang', when='@:2019.6', msg='2019.7 or later required for clang') @@ -163,7 +165,7 @@ class IntelTbb(Package): # self.coerce_to_spack("build") - if spec.satisfies('%clang'): + if spec.satisfies('%clang') or spec.satisfies('%apple-clang'): tbb_compiler = "clang" elif spec.satisfies('%intel'): tbb_compiler = "icc" diff --git a/var/spack/repos/builtin/packages/kahip/package.py b/var/spack/repos/builtin/packages/kahip/package.py index 7d12d36bc2..e2ca1aeaa1 100644 --- a/var/spack/repos/builtin/packages/kahip/package.py +++ b/var/spack/repos/builtin/packages/kahip/package.py @@ -32,6 +32,7 @@ class Kahip(SConsPackage): depends_on('argtable') depends_on('mpi') # Note: upstream package only tested on openmpi + conflicts('%apple-clang') conflicts('%clang') def patch(self): diff --git a/var/spack/repos/builtin/packages/kentutils/package.py b/var/spack/repos/builtin/packages/kentutils/package.py index 379d3486c0..f0b4ee8322 100644 --- a/var/spack/repos/builtin/packages/kentutils/package.py +++ b/var/spack/repos/builtin/packages/kentutils/package.py @@ -22,6 +22,7 @@ class Kentutils(MakefilePackage): depends_on('mariadb') conflicts('%cce') + conflicts('%apple-clang') conflicts('%clang') conflicts('%intel') conflicts('%nag') diff --git a/var/spack/repos/builtin/packages/lbann/package.py b/var/spack/repos/builtin/packages/lbann/package.py index 04b044610f..bc0da109ec 100644 --- a/var/spack/repos/builtin/packages/lbann/package.py +++ b/var/spack/repos/builtin/packages/lbann/package.py @@ -164,16 +164,16 @@ class Lbann(CMakePackage): # protobuf is included by py-protobuf+cpp '-DProtobuf_DIR={0}'.format(spec['protobuf'].prefix)]) - if self.spec.satisfies('@:0.90') or self.spec.satisfies('@0.95:'): + if spec.satisfies('@:0.90') or spec.satisfies('@0.95:'): args.extend([ '-DHydrogen_DIR={0}/CMake/hydrogen'.format( spec['hydrogen'].prefix)]) - elif self.spec.satisfies('@0.94'): + elif spec.satisfies('@0.94'): args.extend([ '-DElemental_DIR={0}/CMake/elemental'.format( spec['elemental'].prefix)]) - if self.spec.satisfies('@0.94:0.98.2'): + if spec.satisfies('@0.94:0.98.2'): args.extend(['-DLBANN_WITH_NCCL:BOOL=%s' % ('+gpu +nccl' in spec)]) if '+vtune' in spec: @@ -188,8 +188,8 @@ class Lbann(CMakePackage): '-DConduit_DIR={0}'.format(spec['conduit'].prefix)]) # Add support for OpenMP - if (self.spec.satisfies('%clang')): - if (sys.platform == 'darwin'): + if spec.satisfies('%clang') or spec.satisfies('%apple-clang'): + if sys.platform == 'darwin': clang = self.compiler.cc clang_bin = os.path.dirname(clang) clang_root = os.path.dirname(clang_bin) @@ -210,7 +210,7 @@ class Lbann(CMakePackage): args.extend([ '-DcuDNN_DIR={0}'.format( spec['cudnn'].prefix)]) - if self.spec.satisfies('@0.94:0.98.2'): + if spec.satisfies('@0.94:0.98.2'): args.extend(['-DCUB_DIR={0}'.format( spec['cub'].prefix)]) if '+nccl' in spec: diff --git a/var/spack/repos/builtin/packages/libceed/package.py b/var/spack/repos/builtin/packages/libceed/package.py index 36d46dae0b..a7ae5b21f8 100644 --- a/var/spack/repos/builtin/packages/libceed/package.py +++ b/var/spack/repos/builtin/packages/libceed/package.py @@ -71,14 +71,14 @@ class Libceed(Package): opt = '-O3 -g -ffp-contract=fast' if compiler.version >= ver(4.9): opt += ' -fopenmp-simd' + elif compiler.name == 'apple-clang': + opt = '-O3 -g -march=native -ffp-contract=fast' + if compiler.version >= ver(10): + opt += ' -fopenmp-simd' elif compiler.name == 'clang': opt = '-O3 -g -march=native -ffp-contract=fast' - if compiler.version.string.endswith('-apple'): - if compiler.version >= ver(10): - opt += ' -fopenmp-simd' - else: # not apple clang - if compiler.version >= ver(6): - opt += ' -fopenmp-simd' + if compiler.version >= ver(6): + opt += ' -fopenmp-simd' elif compiler.name in ['xl', 'xl_r']: opt = '-O -g -qsimd=auto' else: diff --git a/var/spack/repos/builtin/packages/libcerf/package.py b/var/spack/repos/builtin/packages/libcerf/package.py index e37e7f6339..a5c00dabaf 100644 --- a/var/spack/repos/builtin/packages/libcerf/package.py +++ b/var/spack/repos/builtin/packages/libcerf/package.py @@ -23,7 +23,7 @@ class Libcerf(AutotoolsPackage, SourceforgePackage): options = [] # Clang reports unused functions as errors, see # http://clang.debian.net/status.php?version=3.8.1&key=UNUSED_FUNCTION - if spec.satisfies('%clang'): + if spec.satisfies('%clang') or spec.satisfies('%apple-clang'): options.append('CFLAGS=-Wno-unused-function') # fujitsu compiler has a error about unused functions too. if spec.satisfies('%fj'): diff --git a/var/spack/repos/builtin/packages/librsb/package.py b/var/spack/repos/builtin/packages/librsb/package.py index 90cc5b67a8..2a292b9479 100644 --- a/var/spack/repos/builtin/packages/librsb/package.py +++ b/var/spack/repos/builtin/packages/librsb/package.py @@ -17,6 +17,7 @@ class Librsb(AutotoolsPackage): version('1.2.0.8', '8bebd19a1866d80ade13eabfdd0f07ae7e8a485c0b975b5d15f531ac204d80cb') depends_on('zlib') + conflicts('%apple-clang') conflicts('%clang') def configure_args(self): diff --git a/var/spack/repos/builtin/packages/likwid/package.py b/var/spack/repos/builtin/packages/likwid/package.py index 8e89693ce1..a104b67003 100644 --- a/var/spack/repos/builtin/packages/likwid/package.py +++ b/var/spack/repos/builtin/packages/likwid/package.py @@ -60,9 +60,15 @@ class Likwid(Package): *files) def install(self, spec, prefix): - supported_compilers = {'clang': 'CLANG', 'gcc': 'GCC', 'intel': 'ICC'} + supported_compilers = { + 'apple-clang': 'CLANG', + 'clang': 'CLANG', + 'gcc': 'GCC', + 'intel': 'ICC' + } if spec.target.family == 'aarch64': - supported_compilers = {'gcc': 'GCCARMv8', 'clang': 'ARMCLANG'} + supported_compilers = { + 'gcc': 'GCCARMv8', 'clang': 'ARMCLANG', 'arm': 'ARMCLANG'} elif spec.target.family == 'ppc64' or spec.target.family == 'ppc64le': supported_compilers = {'gcc': 'GCCPOWER'} if self.compiler.name not in supported_compilers: diff --git a/var/spack/repos/builtin/packages/maverick/package.py b/var/spack/repos/builtin/packages/maverick/package.py index 6c560bb202..60909c551b 100644 --- a/var/spack/repos/builtin/packages/maverick/package.py +++ b/var/spack/repos/builtin/packages/maverick/package.py @@ -17,6 +17,7 @@ class Maverick(MakefilePackage): conflicts('%gcc@:6.0') conflicts('%cce') + conflicts('%apple-clang') conflicts('%clang') conflicts('%intel') conflicts('%nag') diff --git a/var/spack/repos/builtin/packages/mpich/package.py b/var/spack/repos/builtin/packages/mpich/package.py index c9c7886a08..d862f12522 100644 --- a/var/spack/repos/builtin/packages/mpich/package.py +++ b/var/spack/repos/builtin/packages/mpich/package.py @@ -79,6 +79,7 @@ spack package at this time.''', # see https://lists.mpich.org/pipermail/discuss/2016-May/004764.html # and https://lists.mpich.org/pipermail/discuss/2016-June/004768.html patch('mpich32_clang.patch', when='@3.2:3.2.0%clang') + patch('mpich32_clang.patch', when='@3.2:3.2.0%apple-clang') # Fix SLURM node list parsing # See https://github.com/pmodels/mpich/issues/3572 diff --git a/var/spack/repos/builtin/packages/mpilander/package.py b/var/spack/repos/builtin/packages/mpilander/package.py index 276f380a86..9b72915180 100644 --- a/var/spack/repos/builtin/packages/mpilander/package.py +++ b/var/spack/repos/builtin/packages/mpilander/package.py @@ -31,6 +31,7 @@ class Mpilander(CMakePackage): # compiler support conflicts('%gcc@:4.7') conflicts('%clang@:3.8') + conflicts('%apple-clang@:7.4') conflicts('%intel@:16') def cmake_args(self): diff --git a/var/spack/repos/builtin/packages/musl/package.py b/var/spack/repos/builtin/packages/musl/package.py index 7c68735c20..05ec4eb5ff 100644 --- a/var/spack/repos/builtin/packages/musl/package.py +++ b/var/spack/repos/builtin/packages/musl/package.py @@ -38,7 +38,7 @@ class Musl(Package): if self.compiler.name == 'gcc': config.filter("WRAPCC_GCC = .*'", "WRAPCC_GCC = {0}'". format(self.compiler.cc)) - elif self.compiler.name == 'clang': + elif self.compiler.name in ('clang', 'apple-clang'): config.filter("WRAPCC_CLANG = .*'", "WRAPCC_CLANG = {0}'". format(self.compiler.cc)) @@ -46,7 +46,7 @@ class Musl(Package): args = ['--prefix={0}'.format(self.prefix)] if self.compiler.name == 'gcc': args.append('--enable-wrapper=gcc') - elif self.compiler.name == 'clang': + elif self.compiler.name in ('clang', 'apple-clang'): args.append('--enable-wrapper=clang') else: args.append('--enable-wrapper=no') diff --git a/var/spack/repos/builtin/packages/octopus/package.py b/var/spack/repos/builtin/packages/octopus/package.py index 1073965e81..bed1c1a256 100644 --- a/var/spack/repos/builtin/packages/octopus/package.py +++ b/var/spack/repos/builtin/packages/octopus/package.py @@ -97,11 +97,13 @@ class Octopus(Package): # When preprocessor expands macros (i.e. CFLAGS) defined as quoted # strings the result may be > 132 chars and is terminated. # This will look to a compiler as an Unterminated character constant - # and produce Line truncated errors. To vercome this, add flags to + # and produce Line truncated errors. To overcome this, add flags to # let compiler know that the entire line is meaningful. # TODO: For the lack of better approach, assume that clang is mixed # with GNU fortran. - if spec.satisfies('%clang') or spec.satisfies('%gcc'): + if (spec.satisfies('%apple-clang') or + spec.satisfies('%clang') or + spec.satisfies('%gcc')): args.extend([ 'FCFLAGS=-O2 -ffree-line-length-none' ]) diff --git a/var/spack/repos/builtin/packages/onednn/package.py b/var/spack/repos/builtin/packages/onednn/package.py index b723fabd9c..82d22296f9 100644 --- a/var/spack/repos/builtin/packages/onednn/package.py +++ b/var/spack/repos/builtin/packages/onednn/package.py @@ -64,7 +64,7 @@ class Onednn(CMakePackage): # https://github.com/oneapi-src/oneDNN#requirements-for-building-from-source depends_on('cmake@2.8.11:', type='build') depends_on('tbb@2017:', when='cpu_runtime=tbb') - depends_on('llvm-openmp', when='%clang platform=darwin cpu_runtime=omp') + depends_on('llvm-openmp', when='%apple-clang cpu_runtime=omp') depends_on('opencl@1.2:', when='gpu_runtime=ocl') def cmake_args(self): @@ -81,7 +81,7 @@ class Onednn(CMakePackage): args.append('-DDNNL_BUILD_TESTS=OFF') # https://github.com/oneapi-src/oneDNN/issues/591 - if self.spec.satisfies('%clang platform=darwin cpu_runtime=omp'): + if self.spec.satisfies('%apple-clang cpu_runtime=omp'): args.extend([ '-DOpenMP_CXX_FLAGS={0}'.format(self.compiler.openmp_flag), '-DOpenMP_C_FLAGS={0}'.format(self.compiler.openmp_flag), diff --git a/var/spack/repos/builtin/packages/openblas/package.py b/var/spack/repos/builtin/packages/openblas/package.py index c1a0c1e01b..61a530b37f 100644 --- a/var/spack/repos/builtin/packages/openblas/package.py +++ b/var/spack/repos/builtin/packages/openblas/package.py @@ -95,7 +95,7 @@ class Openblas(MakefilePackage): patch('openblas-0.3.8-darwin.patch', when='@0.3.8 platform=darwin') # Fix ICE in LLVM 9.0.0 https://github.com/xianyi/OpenBLAS/pull/2329 # Patch as in https://github.com/xianyi/OpenBLAS/pull/2597 - patch('openblas_appleclang11.patch', when='@0.3.8:0.3.9 %clang@11.0.3-apple') + patch('openblas_appleclang11.patch', when='@0.3.8:0.3.9 %apple-clang@11.0.3') # Add conditions to f_check to determine the Fujitsu compiler patch('openblas_fujitsu.patch', when='%fj') @@ -105,6 +105,9 @@ class Openblas(MakefilePackage): conflicts('+consistent_fpcsr', when='threads=none', msg='FPCSR consistency only applies to multithreading') + conflicts('threads=openmp', when='%apple-clang', msg="Apple's clang does not support OpenMP") + conflicts('threads=openmp @:0.2.19', when='%clang', msg='OpenBLAS @:0.2.19 does not support OpenMP with clang!') + @property def parallel(self): # unclear whether setting `-j N` externally was supported before 0.3 @@ -120,18 +123,6 @@ class Openblas(MakefilePackage): 'OpenBLAS requires both C and Fortran compilers!' ) - # Add support for OpenMP - if (self.spec.satisfies('threads=openmp') and - self.spec.satisfies('%clang')): - if str(self.spec.compiler.version).endswith('-apple'): - raise InstallError("Apple's clang does not support OpenMP") - if '@:0.2.19' in self.spec: - # Openblas (as of 0.2.19) hardcoded that OpenMP cannot - # be used with any (!) compiler named clang, bummer. - raise InstallError( - 'OpenBLAS @:0.2.19 does not support OpenMP with clang!' - ) - @staticmethod def _read_targets(target_file): """Parse a list of available targets from the OpenBLAS/TargetList.txt diff --git a/var/spack/repos/builtin/packages/pdt/package.py b/var/spack/repos/builtin/packages/pdt/package.py index 35164db1c5..bf3f954982 100644 --- a/var/spack/repos/builtin/packages/pdt/package.py +++ b/var/spack/repos/builtin/packages/pdt/package.py @@ -33,7 +33,8 @@ class Pdt(AutotoolsPackage): variant('pic', default=False, description="Builds with pic") def patch(self): - if self.spec.satisfies('%clang'): + spec = self.spec + if spec.satisfies('%clang') or spec.satisfies('%apple-clang'): filter_file(r'PDT_GXX=g\+\+ ', r'PDT_GXX=clang++ ', 'ductape/Makefile') diff --git a/var/spack/repos/builtin/packages/petsc/package.py b/var/spack/repos/builtin/packages/petsc/package.py index f328171072..9da9740674 100644 --- a/var/spack/repos/builtin/packages/petsc/package.py +++ b/var/spack/repos/builtin/packages/petsc/package.py @@ -2,11 +2,7 @@ # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) - - import os -import sys -from spack import * class Petsc(Package): @@ -116,9 +112,7 @@ class Petsc(Package): # temporary workaround Clang 8.1.0 with XCode 8.3 on macOS, see # https://bitbucket.org/petsc/petsc/commits/4f290403fdd060d09d5cb07345cbfd52670e3cbc # the patch is an adaptation of the original commit to 3.7.5 - if sys.platform == "darwin": - patch('macos-clang-8.1.0.diff', - when='@3.7.5%clang@8.1.0:') + patch('macos-clang-8.1.0.diff', when='@3.7.5%apple-clang@8.1.0:') patch('pkg-config-3.7.6-3.8.4.diff', when='@3.7.6:3.8.4') patch('xcode_stub_out_of_sync.patch', when='@:3.10.4') diff --git a/var/spack/repos/builtin/packages/pixman/package.py b/var/spack/repos/builtin/packages/pixman/package.py index 1087dabbbf..a145edc638 100644 --- a/var/spack/repos/builtin/packages/pixman/package.py +++ b/var/spack/repos/builtin/packages/pixman/package.py @@ -29,7 +29,8 @@ class Pixman(AutotoolsPackage): # __builtin_shuffle was removed in clang 5.0. # From version 9.1 apple-clang is based on clang 5.0. # Patch is obtained from above link. - patch('clang.patch', when='@0.34%clang@9.1.0-apple:') + patch('clang.patch', when='@0.34%apple-clang@9.1.0:') + patch('clang.patch', when='@0.34%clang@5.0.0:') @run_before('build') def patch_config_h_for_intel(self): diff --git a/var/spack/repos/builtin/packages/plasma/package.py b/var/spack/repos/builtin/packages/plasma/package.py index bf4d8c68ee..efeb980bd8 100644 --- a/var/spack/repos/builtin/packages/plasma/package.py +++ b/var/spack/repos/builtin/packages/plasma/package.py @@ -58,6 +58,7 @@ class Plasma(CMakePackage): conflicts("%gcc@:5.99", when='@17.2:') conflicts("%cce") + conflicts('%apple-clang') conflicts("%clang") conflicts("%intel") conflicts("%nag") diff --git a/var/spack/repos/builtin/packages/precice/package.py b/var/spack/repos/builtin/packages/precice/package.py index 11250f60bd..45548275c8 100644 --- a/var/spack/repos/builtin/packages/precice/package.py +++ b/var/spack/repos/builtin/packages/precice/package.py @@ -60,6 +60,7 @@ class Precice(CMakePackage): # We require C++11 compiler support as well as # library support for time manipulators (N2071, N2072) conflicts('%gcc@:4') + conflicts('%apple-clang@:4') conflicts('%clang@:3.7') conflicts('%intel@:14') conflicts('%pgi@:14') diff --git a/var/spack/repos/builtin/packages/py-dgl/package.py b/var/spack/repos/builtin/packages/py-dgl/package.py index 544b527f69..9ef1bd9ed8 100644 --- a/var/spack/repos/builtin/packages/py-dgl/package.py +++ b/var/spack/repos/builtin/packages/py-dgl/package.py @@ -29,7 +29,7 @@ class PyDgl(CMakePackage): depends_on('cmake@3.5:', type='build') depends_on('cuda', when='+cuda') - depends_on('llvm-openmp', when='%clang platform=darwin +openmp') + depends_on('llvm-openmp', when='%apple-clang +openmp') # Python dependencies # See python/setup.py @@ -66,7 +66,7 @@ class PyDgl(CMakePackage): if '+openmp' in self.spec: args.append('-DUSE_OPENMP=ON') - if self.spec.satisfies('%clang platform=darwin'): + if self.spec.satisfies('%apple-clang'): args.extend([ '-DOpenMP_CXX_FLAGS=' + self.spec['llvm-openmp'].headers.include_flags, diff --git a/var/spack/repos/builtin/packages/py-exodus-bundler/package.py b/var/spack/repos/builtin/packages/py-exodus-bundler/package.py index c13f30eb46..eddb3da88f 100644 --- a/var/spack/repos/builtin/packages/py-exodus-bundler/package.py +++ b/var/spack/repos/builtin/packages/py-exodus-bundler/package.py @@ -15,6 +15,7 @@ class PyExodusBundler(PythonPackage): version('2.0.2', sha256='4e896a2034b94cf7b4fb33d86a68e29a7d3b08e57541e444db34dddc6ac1ef68') + depends_on('musl', type='run', when='%apple-clang') depends_on('musl', type='run', when='%clang') depends_on('musl', type='run', when='%gcc') depends_on('py-setuptools', type=('build', 'run')) diff --git a/var/spack/repos/builtin/packages/py-flye/package.py b/var/spack/repos/builtin/packages/py-flye/package.py index db3804e11d..090d36cdb9 100644 --- a/var/spack/repos/builtin/packages/py-flye/package.py +++ b/var/spack/repos/builtin/packages/py-flye/package.py @@ -26,7 +26,7 @@ class PyFlye(PythonPackage): msg = 'C++ compiler with C++11 support required' conflicts('%gcc@:4.7', msg=msg) conflicts('%clang@:3.2', msg=msg) - # Requires Apple Clang 5.0+ but no way to specify that right now + conflicts('apple-clang@:4.9', msg=msg) def setup_build_environment(self, env): if self.spec.target.family == 'aarch64': diff --git a/var/spack/repos/builtin/packages/py-scikit-learn/package.py b/var/spack/repos/builtin/packages/py-scikit-learn/package.py index 52c9beae43..d73d3f7576 100644 --- a/var/spack/repos/builtin/packages/py-scikit-learn/package.py +++ b/var/spack/repos/builtin/packages/py-scikit-learn/package.py @@ -69,9 +69,7 @@ class PyScikitLearn(PythonPackage): depends_on('py-pytest@3.3.0:', type='test') depends_on('py-pandas', type='test') depends_on('py-setuptools', type='build') - # Technically not correct, but currently no way to check if we - # are using Apple Clang or not. - depends_on('llvm-openmp', when='@0.21: %clang platform=darwin +openmp') + depends_on('llvm-openmp', when='@0.21: %apple-clang +openmp') # Release tarballs are already cythonized. If you wanted to build a release # version without OpenMP support, you would need to delete all .c files @@ -84,7 +82,7 @@ class PyScikitLearn(PythonPackage): if self.spec.satisfies('~openmp'): env.set('SKLEARN_NO_OPENMP', 'True') # https://scikit-learn.org/stable/developers/advanced_installation.html#mac-osx - elif self.spec.satisfies('@0.21: %clang platform=darwin +openmp'): + elif self.spec.satisfies('@0.21: %apple-clang +openmp'): env.append_flags( 'CPPFLAGS', self.compiler.openmp_flag) env.append_flags( diff --git a/var/spack/repos/builtin/packages/py-torch/package.py b/var/spack/repos/builtin/packages/py-torch/package.py index c240144f11..1ffeb81b23 100644 --- a/var/spack/repos/builtin/packages/py-torch/package.py +++ b/var/spack/repos/builtin/packages/py-torch/package.py @@ -155,7 +155,7 @@ class PyTorch(PythonPackage, CudaPackage): depends_on('nccl', when='+nccl') depends_on('gloo', when='+gloo') depends_on('opencv', when='+opencv') - depends_on('llvm-openmp', when='%clang platform=darwin +openmp') + depends_on('llvm-openmp', when='%apple-clang +openmp') depends_on('ffmpeg', when='+ffmpeg') depends_on('leveldb', when='+leveldb') depends_on('lmdb', when='+lmdb') diff --git a/var/spack/repos/builtin/packages/qmcpack/package.py b/var/spack/repos/builtin/packages/qmcpack/package.py index 5307b3d2d5..07724f63fe 100644 --- a/var/spack/repos/builtin/packages/qmcpack/package.py +++ b/var/spack/repos/builtin/packages/qmcpack/package.py @@ -102,6 +102,7 @@ class Qmcpack(CMakePackage, CudaPackage): conflicts('+afqmc', when='@:3.6.0', msg='AFQMC not recommended before v3.7') conflicts('+afqmc', when='~mpi', msg='AFQMC requires building with +mpi') conflicts('+afqmc', when='%gcc@:6.0', msg='AFQMC code requires gcc@6.1 or greater') + conflicts('+afqmc', when='%apple-clang@:9.2', msg='AFQMC code requires clang 4.1 or greater') conflicts('+afqmc', when='%clang@:4.0', msg='AFQMC code requires clang 4.1 or greater') conflicts('+afqmc', when='%intel@:18', msg='AFQMC code requires intel19 or greater') diff --git a/var/spack/repos/builtin/packages/qt/package.py b/var/spack/repos/builtin/packages/qt/package.py index ba28042fa3..7e016846ab 100644 --- a/var/spack/repos/builtin/packages/qt/package.py +++ b/var/spack/repos/builtin/packages/qt/package.py @@ -286,7 +286,7 @@ class Qt(Package): "qmake/qmake.pri", "src/tools/bootstrap/bootstrap.pro" ] - if '%clang' in self.spec: + if '%clang' in self.spec or '%apple-clang' in self.spec: files_to_filter += [ "mkspecs/unsupported/macx-clang-libc++/qmake.conf", "mkspecs/common/clang.conf" diff --git a/var/spack/repos/builtin/packages/raxml/package.py b/var/spack/repos/builtin/packages/raxml/package.py index 08d99e6b16..7eb477dfc6 100644 --- a/var/spack/repos/builtin/packages/raxml/package.py +++ b/var/spack/repos/builtin/packages/raxml/package.py @@ -25,6 +25,7 @@ class Raxml(Package): # Compiles with either GCC or ICC. conflicts('%cce') + conflicts('%apple-clang') conflicts('%clang') conflicts('%nag') conflicts('%pgi') diff --git a/var/spack/repos/builtin/packages/sgpp/package.py b/var/spack/repos/builtin/packages/sgpp/package.py index 7e5b907374..728638500f 100644 --- a/var/spack/repos/builtin/packages/sgpp/package.py +++ b/var/spack/repos/builtin/packages/sgpp/package.py @@ -97,6 +97,7 @@ class Sgpp(SConsPackage): # Compiler with C++11 support is required conflicts('%gcc@:4.8.4', msg='Compiler with c++11 support is required!') + conflicts('%apple-clang@:3.9', msg='Compiler with c++11 support is required!') conflicts('%clang@:3.2', msg='Compiler with c++11 support is required!') conflicts('%intel@:14', msg='Compiler with c++11 support is required!') # Solver python bindings are actually using the pde module at one point: diff --git a/var/spack/repos/builtin/packages/silo/package.py b/var/spack/repos/builtin/packages/silo/package.py index 9192937393..3d9ef4e16c 100644 --- a/var/spack/repos/builtin/packages/silo/package.py +++ b/var/spack/repos/builtin/packages/silo/package.py @@ -57,6 +57,13 @@ class Silo(AutotoolsPackage): @when('%clang@9:') def patch(self): + self.clang_9_patch() + + @when('%apple-clang@11.0.3:') + def patch(self): + self.clang_9_patch() + + def clang_9_patch(self): # Clang 9 and later include macro definitions in <math.h> that conflict # with typedefs DOMAIN and RANGE used in Silo plugins. # It looks like the upstream fpzip repo has been fixed, but that change diff --git a/var/spack/repos/builtin/packages/snap-berkeley/package.py b/var/spack/repos/builtin/packages/snap-berkeley/package.py index 90d970e277..de9928e0c3 100644 --- a/var/spack/repos/builtin/packages/snap-berkeley/package.py +++ b/var/spack/repos/builtin/packages/snap-berkeley/package.py @@ -22,6 +22,7 @@ class SnapBerkeley(MakefilePackage): conflicts('%gcc@6:') conflicts('%cce') + conflicts('%apple-clang') conflicts('%clang') conflicts('%intel') conflicts('%nag') diff --git a/var/spack/repos/builtin/packages/sqlitebrowser/package.py b/var/spack/repos/builtin/packages/sqlitebrowser/package.py index 6cd8eeb9b8..b92d65348e 100644 --- a/var/spack/repos/builtin/packages/sqlitebrowser/package.py +++ b/var/spack/repos/builtin/packages/sqlitebrowser/package.py @@ -18,6 +18,7 @@ class Sqlitebrowser(CMakePackage): msg = 'sqlitebrowser requires C++11 support' conflicts('%gcc@:4.8.0', msg=msg) + conflicts('%apple-clang@:3.9', msg=msg) conflicts('%clang@:3.2', msg=msg) conflicts('%intel@:12', msg=msg) conflicts('%xl@:13.0', msg=msg) diff --git a/var/spack/repos/builtin/packages/suite-sparse/package.py b/var/spack/repos/builtin/packages/suite-sparse/package.py index eef38fefae..703fbcf670 100644 --- a/var/spack/repos/builtin/packages/suite-sparse/package.py +++ b/var/spack/repos/builtin/packages/suite-sparse/package.py @@ -115,7 +115,7 @@ class SuiteSparse(Package): # CFLAGS, but not all compilers use the same flags for these # optimizations if any([x in spec - for x in ('%clang', '%gcc', '%intel')]): + for x in ('%apple-clang', '%clang', '%gcc', '%intel')]): make_args += ['CFLAGS+=-fno-common -fexceptions'] elif '%pgi' in spec: make_args += ['CFLAGS+=--exceptions'] diff --git a/var/spack/repos/builtin/packages/sundials/package.py b/var/spack/repos/builtin/packages/sundials/package.py index e374a4bbca..50832e6e5a 100644 --- a/var/spack/repos/builtin/packages/sundials/package.py +++ b/var/spack/repos/builtin/packages/sundials/package.py @@ -214,7 +214,7 @@ class Sundials(CMakePackage): return 'ON' if varstr in self.spec else 'OFF' fortran_flag = self.compiler.f77_pic_flag - if (spec.satisfies('%clang platform=darwin')) and ('+fcmix' in spec): + if (spec.satisfies('%apple-clang')) and ('+fcmix' in spec): f77 = Executable(self.compiler.f77) libgfortran = LibraryList(f77('--print-file-name', 'libgfortran.a', output=str)) diff --git a/var/spack/repos/builtin/packages/trilinos/package.py b/var/spack/repos/builtin/packages/trilinos/package.py index 16f916849c..7896d809f2 100644 --- a/var/spack/repos/builtin/packages/trilinos/package.py +++ b/var/spack/repos/builtin/packages/trilinos/package.py @@ -683,7 +683,9 @@ class Trilinos(CMakePackage): # Fortran lib (assumes clang is built with gfortran!) if '+fortran' in spec and ( - spec.satisfies('%gcc') or spec.satisfies('%clang')): + spec.satisfies('%gcc') or spec.satisfies('%clang') or + spec.satisfies('%apple-clang') + ): options.append(define('Trilinos_ENABLE_Fortran', True)) if '+mpi' in spec: libgfortran = os.path.dirname(os.popen( diff --git a/var/spack/repos/builtin/packages/unblur/package.py b/var/spack/repos/builtin/packages/unblur/package.py index 428f44c08e..7366ad836a 100644 --- a/var/spack/repos/builtin/packages/unblur/package.py +++ b/var/spack/repos/builtin/packages/unblur/package.py @@ -27,6 +27,7 @@ class Unblur(AutotoolsPackage): # Requires Intel Fortran compiler conflicts('%gcc') conflicts('%pgi') + conflicts('%apple-clang') conflicts('%clang') conflicts('%cce') conflicts('%xl') diff --git a/var/spack/repos/builtin/packages/valgrind/package.py b/var/spack/repos/builtin/packages/valgrind/package.py index 4555b0b886..20d8791f4e 100644 --- a/var/spack/repos/builtin/packages/valgrind/package.py +++ b/var/spack/repos/builtin/packages/valgrind/package.py @@ -40,7 +40,7 @@ class Valgrind(AutotoolsPackage, SourcewarePackage): variant('ubsan', default=sys.platform != 'darwin', description='Activates ubsan support for valgrind') - conflicts('+ubsan', when='platform=darwin %clang', + conflicts('+ubsan', when='%apple-clang', msg=""" Cannot build libubsan with clang on macOS. Otherwise with (Apple's) clang there is a linker error: diff --git a/var/spack/repos/builtin/packages/vtk/package.py b/var/spack/repos/builtin/packages/vtk/package.py index 0df4c4a5fc..2a334cb1fb 100644 --- a/var/spack/repos/builtin/packages/vtk/package.py +++ b/var/spack/repos/builtin/packages/vtk/package.py @@ -285,9 +285,7 @@ class Vtk(CMakePackage): # string. This fix was recommended on the VTK mailing list # in March 2014 (see # https://public.kitware.com/pipermail/vtkusers/2014-March/083368.html) - if (self.spec.satisfies('%clang') and - self.compiler.is_apple and - self.compiler.version >= Version('5.1.0')): + if self.spec.satisfies('%apple-clang@5.1.0:'): cmake_args.extend(['-DVTK_REQUIRED_OBJCXX_FLAGS=']) # A bug in tao pegtl causes build failures with intel compilers diff --git a/var/spack/repos/builtin/packages/warpx/package.py b/var/spack/repos/builtin/packages/warpx/package.py index dc19f916fe..c564528b40 100644 --- a/var/spack/repos/builtin/packages/warpx/package.py +++ b/var/spack/repos/builtin/packages/warpx/package.py @@ -68,7 +68,8 @@ class Warpx(MakefilePackage): def edit(self, spec, prefix): comp = 'gcc' - vendors = {'%gcc': 'gcc', '%intel': 'intel', '%clang': 'llvm'} + vendors = {'%gcc': 'gcc', '%intel': 'intel', + '%apple-clang': 'llvm', '%clang': 'llvm'} for key, value in vendors.items(): if self.spec.satisfies(key): comp = value diff --git a/var/spack/repos/builtin/packages/xios/package.py b/var/spack/repos/builtin/packages/xios/package.py index 54eca9fead..2b5c6f9dae 100644 --- a/var/spack/repos/builtin/packages/xios/package.py +++ b/var/spack/repos/builtin/packages/xios/package.py @@ -31,6 +31,7 @@ class Xios(Package): # Workaround bug #17782 in llvm, where reading a double # followed by a character is broken (e.g. duration '1d'): + patch('llvm_bug_17782.patch', when='@1.1: %apple-clang') patch('llvm_bug_17782.patch', when='@1.1: %clang') depends_on('netcdf-c+mpi') @@ -45,6 +46,13 @@ class Xios(Package): @when('%clang') def patch(self): + self.patch_llvm() + + @when('%apple-clang') + def patch(self): + self.patch_llvm() + + def patch_llvm(self): """Fix type references that are ambiguous for clang.""" for dirpath, dirnames, filenames in os.walk('src'): for filename in filenames: @@ -99,12 +107,13 @@ OASIS_LIB="" param['BOOST_LIB_DIR'] = spec['boost'].prefix.lib param['BLITZ_INC_DIR'] = spec['blitz'].prefix.include param['BLITZ_LIB_DIR'] = spec['blitz'].prefix.lib - if spec.satisfies('%clang platform=darwin'): + if spec.satisfies('%apple-clang'): param['LIBCXX'] = '-lc++' else: param['LIBCXX'] = '-lstdc++' - if any(map(spec.satisfies, ('%gcc', '%intel', '%clang'))): + if any(map(spec.satisfies, + ('%gcc', '%intel', '%apple-clang', '%clang'))): text = r""" %CCOMPILER {MPICXX} %FCOMPILER {MPIFC} diff --git a/var/spack/repos/builtin/packages/xsdktrilinos/package.py b/var/spack/repos/builtin/packages/xsdktrilinos/package.py index b679ee7277..effb4404b0 100644 --- a/var/spack/repos/builtin/packages/xsdktrilinos/package.py +++ b/var/spack/repos/builtin/packages/xsdktrilinos/package.py @@ -65,7 +65,9 @@ class Xsdktrilinos(CMakePackage): ]) # Fortran lib - if spec.satisfies('%gcc') or spec.satisfies('%clang'): + if (spec.satisfies('%gcc') or + spec.satisfies('%clang') or + spec.satisfies('%apple-clang')): libgfortran = os.path.dirname(os.popen( '%s --print-file-name libgfortran.a' % join_path(mpi_bin, 'mpif90')).read()) diff --git a/var/spack/repos/builtin/packages/yaml-cpp/package.py b/var/spack/repos/builtin/packages/yaml-cpp/package.py index 11f1f9fbef..a83471f23a 100644 --- a/var/spack/repos/builtin/packages/yaml-cpp/package.py +++ b/var/spack/repos/builtin/packages/yaml-cpp/package.py @@ -35,9 +35,7 @@ class YamlCpp(CMakePackage): conflicts('%gcc@:4.7', when='@0.6.0:', msg="versions 0.6.0: require c++11 support") conflicts('%clang@:3.3.0', when='@0.6.0:', msg="versions 0.6.0: require c++11 support") - # currently we can't check for apple-clang's version - # conflicts('%clang@:4.0.0-apple', when='@0.6.0:', - # msg="versions 0.6.0: require c++11 support") + conflicts('%apple-clang@:4.0.0', when='@0.6.0:', msg="versions 0.6.0: require c++11 support") conflicts('%intel@:11.1', when='@0.6.0:', msg="versions 0.6.0: require c++11 support") conflicts('%xl@:13.1', when='@0.6.0:', msg="versions 0.6.0: require c++11 support") conflicts('%xl_r@:13.1', when='@0.6.0:', msg="versions 0.6.0: require c++11 support") |