diff --git a/lib/spack/spack/build_environment.py b/lib/spack/spack/build_environment.py index 5e99d4552b3ee89e729548107e50d2c56b972090..619877275dddd2d018c0429da9c0419ac16b81be 100644 --- a/lib/spack/spack/build_environment.py +++ b/lib/spack/spack/build_environment.py @@ -224,7 +224,7 @@ def set_compiler_environment_variables(pkg, env): for mod in compiler.modules: load_module(mod) - compiler.setup_custom_environment(env) + compiler.setup_custom_environment(pkg, env) return env diff --git a/lib/spack/spack/compiler.py b/lib/spack/spack/compiler.py index 0d9727c69e620de07de58048eb271fd4e670b081..92fa1ac4dbccde713dfe39a13515e454c88aaeae 100644 --- a/lib/spack/spack/compiler.py +++ b/lib/spack/spack/compiler.py @@ -286,7 +286,7 @@ def _find_full_path(self, path): """ return path - def setup_custom_environment(self, env): + def setup_custom_environment(self, pkg, env): """Set any environment variables necessary to use the compiler.""" pass diff --git a/lib/spack/spack/compilers/clang.py b/lib/spack/spack/compilers/clang.py index b2095defe5945effe5a036d3f1e71016622bf04e..14dc9d6476456eeb63528550243f955189fc8dfd 100644 --- a/lib/spack/spack/compilers/clang.py +++ b/lib/spack/spack/compilers/clang.py @@ -148,7 +148,7 @@ def fc_version(cls, fc): def f77_version(cls, f77): return cls.fc_version(f77) - def setup_custom_environment(self, env): + def setup_custom_environment(self, pkg, env): """Set the DEVELOPER_DIR environment for the Xcode toolchain. On macOS, not all buildsystems support querying CC and CXX for the @@ -160,9 +160,13 @@ def setup_custom_environment(self, env): the 'DEVELOPER_DIR' environment variables to cause the xcrun and related tools to use this Xcode.app. """ - super(Clang, self).setup_custom_environment(env) + super(Clang, self).setup_custom_environment(pkg, env) - if not self.is_apple: + if not self.is_apple or not pkg.use_xcode: + # if we do it for all packages, we get into big troubles with MPI: + # filter_compilers(self) will use mockup XCode compilers on macOS + # with Clang. Those point to Spack's compiler wrappers and + # consequently render MPI non-functional outside of Spack. return xcode_select = Executable('xcode-select') diff --git a/lib/spack/spack/package.py b/lib/spack/spack/package.py index 9c946844c6e7409b47d5bb9c12122cdb6f6bfad4..31d08be45687a5814adb6de6158bcc604e7b3d3e 100644 --- a/lib/spack/spack/package.py +++ b/lib/spack/spack/package.py @@ -487,6 +487,10 @@ class SomePackage(Package): """By default do not run tests within package's install()""" run_tests = False + # FIXME: this is a bad object-oriented design, should be moved to Clang. + """By default do not setup mockup XCode on macOS with Clang""" + use_xcode = False + """Most packages are NOT extendable. Set to True if you want extensions.""" extendable = False diff --git a/var/spack/repos/builtin/packages/qt/package.py b/var/spack/repos/builtin/packages/qt/package.py index 1db651c02b6ad40c4a0f0a84e4f7bdd3616b3df1..6e6d4b95f61b828128faee053b9aa6ec1443f1b6 100644 --- a/var/spack/repos/builtin/packages/qt/package.py +++ b/var/spack/repos/builtin/packages/qt/package.py @@ -92,6 +92,8 @@ class Qt(Package): # depends_on("flac", when='+multimedia') # depends_on("ogg", when='+multimedia') + use_xcode = True + def url_for_version(self, version): # URL keeps getting more complicated with every release url = self.list_url