diff options
author | Tobias Ribizel <mail@ribizel.de> | 2024-09-25 19:13:57 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-09-25 19:13:57 +0200 |
commit | 0fab5cadb3d28fc8485089badf4c227898739611 (patch) | |
tree | 3fa4e7f86cba8d7300a867af4989f4c48a39d8a5 | |
parent | ade2513dcbba1710cc108c6f8673609d00aa00d6 (diff) | |
download | spack-0fab5cadb3d28fc8485089badf4c227898739611.tar.gz spack-0fab5cadb3d28fc8485089badf4c227898739611.tar.bz2 spack-0fab5cadb3d28fc8485089badf4c227898739611.tar.xz spack-0fab5cadb3d28fc8485089badf4c227898739611.zip |
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 <bernhardkaindl7@gmail.com>
-rw-r--r-- | var/spack/repos/builtin/packages/llvm/package.py | 12 |
1 files changed, 12 insertions, 0 deletions
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), ] ) |