diff --git a/var/spack/repos/builtin/packages/mesa/package.py b/var/spack/repos/builtin/packages/mesa/package.py index cd1dc46b36..ba65b834ae 100644 --- a/var/spack/repos/builtin/packages/mesa/package.py +++ b/var/spack/repos/builtin/packages/mesa/package.py @@ -169,6 +169,16 @@ def meson_args(self): args.append(opt_enable(num_frontends > 1, 'shared-glapi')) if '+llvm' in spec: + # Fix builds on hosts where /usr/bin/llvm-config-* is found and provides an + # incompatible version. Ensure that the llvm-config of spec['llvm'] is used. + args.append('--native-file') + args.append('meson-native-config.ini') + mkdirp(self.build_directory) + with working_dir(self.build_directory): + with open('meson-native-config.ini', 'w') as native_config: + llvm_config = spec['llvm'].prefix.bin + '/llvm-config' + native_config.write('[binaries]\n') + native_config.write("llvm-config = '{0}'\n".format(llvm_config)) args.append('-Dllvm=enabled') args.append(opt_enable( '+link_dylib' in spec['llvm'], 'shared-llvm'))