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>
This commit is contained in:
Tobias Ribizel 2024-09-25 19:13:57 +02:00 committed by GitHub
parent ade2513dcb
commit 0fab5cadb3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -277,6 +277,8 @@ class Llvm(CMakePackage, CudaPackage, LlvmDetection, CompilerPackage):
conflicts("+z3", when="~clang") conflicts("+z3", when="~clang")
conflicts("+lua", when="@:10") conflicts("+lua", when="@:10")
conflicts("+lua", when="~lldb") 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( variant(
"zstd", "zstd",
@ -880,6 +882,8 @@ def cmake_args(self):
# finding libhsa and enabling the AMDGPU plugin. Since we don't support this yet, # finding libhsa and enabling the AMDGPU plugin. Since we don't support this yet,
# disable explicitly. See commit a05a0c3c2f8eefc80d84b7a87a23a4452d4a3087. # disable explicitly. See commit a05a0c3c2f8eefc80d84b7a87a23a4452d4a3087.
cmake_args.append(define("LIBOMPTARGET_BUILD_AMDGPU_PLUGIN", False)) 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: if "+lldb" in spec:
projects.append("lldb") projects.append("lldb")
@ -961,6 +965,14 @@ def cmake_args(self):
# CMAKE_INSTALL_RPATH to it, which fails. Statically link libc++abi.a # CMAKE_INSTALL_RPATH to it, which fails. Statically link libc++abi.a
# into libc++.so, linking with -lc++ or -stdlib=libc++ is enough. # into libc++.so, linking with -lc++ or -stdlib=libc++ is enough.
define("LIBCXX_ENABLE_STATIC_ABI_LIBRARY", True), 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),
] ]
) )