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>
This commit is contained in:

committed by
GitHub

parent
a31c115d79
commit
14599f09be
@@ -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')
|
||||
|
@@ -47,8 +47,8 @@ def cmake_args(self):
|
||||
'-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)
|
||||
|
@@ -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
|
||||
|
@@ -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):
|
||||
|
@@ -29,11 +29,13 @@ def install(self, spec, prefix):
|
||||
# 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'
|
||||
])
|
||||
|
@@ -102,7 +102,7 @@ def install(self, spec, prefix):
|
||||
|
||||
# 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
|
||||
|
@@ -120,9 +120,10 @@ def install_headers(self):
|
||||
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:'):
|
||||
|
@@ -398,7 +398,9 @@ def determine_b2_options(self, spec, options):
|
||||
# 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++')
|
||||
|
@@ -19,6 +19,7 @@ class Bucky(MakefilePackage):
|
||||
|
||||
# Compilation requires gcc
|
||||
conflicts('%cce')
|
||||
conflicts('%apple-clang')
|
||||
conflicts('%clang')
|
||||
conflicts('%intel')
|
||||
conflicts('%nag')
|
||||
|
@@ -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')
|
||||
|
@@ -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')
|
||||
|
||||
|
@@ -301,7 +301,7 @@ def cmake_args(self):
|
||||
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
|
||||
|
@@ -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
|
||||
|
@@ -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)
|
||||
|
@@ -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 @@ def configure(self, spec, prefix):
|
||||
|
||||
# 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
|
||||
|
@@ -13,6 +13,7 @@ class FujitsuMpi(Package):
|
||||
|
||||
conflicts('%arm')
|
||||
conflicts('%cce')
|
||||
conflicts('%apple-clang')
|
||||
conflicts('%clang')
|
||||
conflicts('%gcc')
|
||||
conflicts('%intel')
|
||||
|
@@ -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")
|
||||
|
@@ -137,6 +137,13 @@ def patch(self):
|
||||
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']
|
||||
|
@@ -59,13 +59,11 @@ def configure_args(self):
|
||||
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')
|
||||
|
||||
|
@@ -131,8 +131,8 @@ def cmake_args(self):
|
||||
'-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)
|
||||
|
@@ -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 @@ def install(self, spec, prefix):
|
||||
#
|
||||
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"
|
||||
|
@@ -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):
|
||||
|
@@ -22,6 +22,7 @@ class Kentutils(MakefilePackage):
|
||||
depends_on('mariadb')
|
||||
|
||||
conflicts('%cce')
|
||||
conflicts('%apple-clang')
|
||||
conflicts('%clang')
|
||||
conflicts('%intel')
|
||||
conflicts('%nag')
|
||||
|
@@ -164,16 +164,16 @@ def cmake_args(self):
|
||||
# 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 @@ def cmake_args(self):
|
||||
'-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 @@ def cmake_args(self):
|
||||
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:
|
||||
|
@@ -71,14 +71,14 @@ def common_make_opts(self):
|
||||
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:
|
||||
|
@@ -23,7 +23,7 @@ def configure_args(self):
|
||||
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'):
|
||||
|
@@ -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):
|
||||
|
@@ -60,9 +60,15 @@ def filter_sbang(self):
|
||||
*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:
|
||||
|
@@ -17,6 +17,7 @@ class Maverick(MakefilePackage):
|
||||
|
||||
conflicts('%gcc@:6.0')
|
||||
conflicts('%cce')
|
||||
conflicts('%apple-clang')
|
||||
conflicts('%clang')
|
||||
conflicts('%intel')
|
||||
conflicts('%nag')
|
||||
|
@@ -79,6 +79,7 @@ class Mpich(AutotoolsPackage):
|
||||
# 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
|
||||
|
@@ -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):
|
||||
|
@@ -38,7 +38,7 @@ def patch(self):
|
||||
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 @@ def configure_args(self):
|
||||
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')
|
||||
|
@@ -97,11 +97,13 @@ def install(self, spec, prefix):
|
||||
# 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'
|
||||
])
|
||||
|
@@ -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 @@ def cmake_args(self):
|
||||
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),
|
||||
|
@@ -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 @@ def check_compilers(self):
|
||||
'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
|
||||
|
@@ -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')
|
||||
|
||||
|
@@ -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')
|
||||
|
@@ -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):
|
||||
|
@@ -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")
|
||||
|
@@ -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')
|
||||
|
@@ -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 @@ def cmake_args(self):
|
||||
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,
|
||||
|
@@ -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'))
|
||||
|
@@ -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':
|
||||
|
@@ -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 @@ def setup_build_environment(self, env):
|
||||
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(
|
||||
|
@@ -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')
|
||||
|
@@ -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')
|
||||
|
||||
|
@@ -286,7 +286,7 @@ def repl(match):
|
||||
"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"
|
||||
|
@@ -25,6 +25,7 @@ class Raxml(Package):
|
||||
|
||||
# Compiles with either GCC or ICC.
|
||||
conflicts('%cce')
|
||||
conflicts('%apple-clang')
|
||||
conflicts('%clang')
|
||||
conflicts('%nag')
|
||||
conflicts('%pgi')
|
||||
|
@@ -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:
|
||||
|
@@ -57,6 +57,13 @@ def flag_handler(self, name, flags):
|
||||
|
||||
@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
|
||||
|
@@ -22,6 +22,7 @@ class SnapBerkeley(MakefilePackage):
|
||||
|
||||
conflicts('%gcc@6:')
|
||||
conflicts('%cce')
|
||||
conflicts('%apple-clang')
|
||||
conflicts('%clang')
|
||||
conflicts('%intel')
|
||||
conflicts('%nag')
|
||||
|
@@ -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)
|
||||
|
@@ -115,7 +115,7 @@ def install(self, spec, prefix):
|
||||
# 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']
|
||||
|
@@ -214,7 +214,7 @@ def on_off(varstr):
|
||||
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))
|
||||
|
@@ -683,7 +683,9 @@ def define_tpl_enable(cmake_var, spec_var=None):
|
||||
|
||||
# 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(
|
||||
|
@@ -27,6 +27,7 @@ class Unblur(AutotoolsPackage):
|
||||
# Requires Intel Fortran compiler
|
||||
conflicts('%gcc')
|
||||
conflicts('%pgi')
|
||||
conflicts('%apple-clang')
|
||||
conflicts('%clang')
|
||||
conflicts('%cce')
|
||||
conflicts('%xl')
|
||||
|
@@ -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:
|
||||
|
@@ -285,9 +285,7 @@ def cmake_args(self):
|
||||
# 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
|
||||
|
@@ -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
|
||||
|
@@ -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 @@ def xios_fcm(self):
|
||||
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}
|
||||
|
@@ -65,7 +65,9 @@ def cmake_args(self):
|
||||
])
|
||||
|
||||
# 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())
|
||||
|
@@ -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")
|
||||
|
Reference in New Issue
Block a user