From 0fab5cadb3d28fc8485089badf4c227898739611 Mon Sep 17 00:00:00 2001 From: Tobias Ribizel Date: Wed, 25 Sep 2024 19:13:57 +0200 Subject: llvm: Add conflict related to Python `distutils` removal (#46528) Python 3.12 removed the `distutils` module, which is being required by the build process of LLVM <= 14: Conflict with it for +python. Fix build to not pick host tools like an incompatible Python from host Co-authored-by: Bernhard Kaindl --- var/spack/repos/builtin/packages/llvm/package.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'var') diff --git a/var/spack/repos/builtin/packages/llvm/package.py b/var/spack/repos/builtin/packages/llvm/package.py index b10006052d..deed68dfa9 100644 --- a/var/spack/repos/builtin/packages/llvm/package.py +++ b/var/spack/repos/builtin/packages/llvm/package.py @@ -277,6 +277,8 @@ class Llvm(CMakePackage, CudaPackage, LlvmDetection, CompilerPackage): conflicts("+z3", when="~clang") conflicts("+lua", when="@:10") conflicts("+lua", when="~lldb") + # Python distutils were removed with 3.12 and are required to build LLVM <= 14 + conflicts("^python@3.12:", when="@:14") variant( "zstd", @@ -880,6 +882,8 @@ class Llvm(CMakePackage, CudaPackage, LlvmDetection, CompilerPackage): # finding libhsa and enabling the AMDGPU plugin. Since we don't support this yet, # disable explicitly. See commit a05a0c3c2f8eefc80d84b7a87a23a4452d4a3087. cmake_args.append(define("LIBOMPTARGET_BUILD_AMDGPU_PLUGIN", False)) + if "python" in spec: # lit's Python needs to be set with this variable + cmake_args.append(define("python_executable", spec["python"].command.path)) if "+lldb" in spec: projects.append("lldb") @@ -961,6 +965,14 @@ class Llvm(CMakePackage, CudaPackage, LlvmDetection, CompilerPackage): # CMAKE_INSTALL_RPATH to it, which fails. Statically link libc++abi.a # into libc++.so, linking with -lc++ or -stdlib=libc++ is enough. define("LIBCXX_ENABLE_STATIC_ABI_LIBRARY", True), + # Make sure that CMake does not pick host-installed tools for the build + # Until #45535 is merged, prevent CMake from delivering incompatible + # system tools like python3.12 to older LLVM versions like LLVM-14: + define("CMAKE_FIND_PACKAGE_PREFER_CONFIG", True), + define("CMAKE_FIND_USE_PACKAGE_ROOT_PATH", False), + define("CMAKE_FIND_USE_SYSTEM_PACKAGE_REGISTRY", False), + define("CMAKE_FIND_USE_PACKAGE_REGISTRY", False), + define("CMAKE_FIND_USE_SYSTEM_PATH", False), ] ) -- cgit v1.2.3-70-g09d2