llvm: provide fix for python dependencies (#20356)
Previously compiler-rt didn't correctly passthrough cmake variables for python when building the various santizers. This patch passes these variables through. This patch may also correctly apply to any version of LLVM to any version of LLVM that uses the newer monorepo style organization, and any older llvm newer than 7.0.0 as long as the paths were set appropriately. However, this was not done so because it was not tested with older LLVM releases. Fixes #19908 See also: https://bugs.llvm.org/show_bug.cgi?id=48180
This commit is contained in:
parent
dd06c86559
commit
860825ee14
14
var/spack/repos/builtin/packages/llvm/llvm_python_path.patch
Normal file
14
var/spack/repos/builtin/packages/llvm/llvm_python_path.patch
Normal file
@ -0,0 +1,14 @@
|
||||
diff --git a/compiler-rt/cmake/Modules/AddCompilerRT.cmake b/compiler-rt/cmake/Modules/AddCompilerRT.cmake
|
||||
index dab55707338..6f4c6791141 100644
|
||||
--- a/compiler-rt/cmake/Modules/AddCompilerRT.cmake
|
||||
+++ b/compiler-rt/cmake/Modules/AddCompilerRT.cmake
|
||||
@@ -612,6 +612,9 @@ macro(add_custom_libcxx name prefix)
|
||||
CMAKE_OBJDUMP
|
||||
CMAKE_STRIP
|
||||
CMAKE_SYSROOT
|
||||
+ PYTHON_EXECUTABLE
|
||||
+ Python3_EXECUTABLE
|
||||
+ Python2_EXECUTABLE
|
||||
CMAKE_SYSTEM_NAME)
|
||||
foreach(variable ${PASSTHROUGH_VARIABLES})
|
||||
get_property(is_value_set CACHE ${variable} PROPERTY VALUE SET)
|
@ -225,6 +225,10 @@ class Llvm(CMakePackage, CudaPackage):
|
||||
# merged in llvm-11.0.0_rc2
|
||||
patch("lldb_external_ncurses-10.patch", when="@10.0.0:10.99+lldb")
|
||||
|
||||
# https://github.com/spack/spack/issues/19908
|
||||
# merged in llvm main prior to 12.0.0
|
||||
patch("llvm_python_path.patch", when="@11.0.0")
|
||||
|
||||
# The functions and attributes below implement external package
|
||||
# detection for LLVM. See:
|
||||
#
|
||||
@ -365,16 +369,24 @@ def setup_run_environment(self, env):
|
||||
|
||||
def cmake_args(self):
|
||||
spec = self.spec
|
||||
python = spec['python']
|
||||
cmake_args = [
|
||||
"-DLLVM_REQUIRES_RTTI:BOOL=ON",
|
||||
"-DLLVM_ENABLE_RTTI:BOOL=ON",
|
||||
"-DLLVM_ENABLE_EH:BOOL=ON",
|
||||
"-DCLANG_DEFAULT_OPENMP_RUNTIME:STRING=libomp",
|
||||
"-DPYTHON_EXECUTABLE:PATH={0}".format(spec["python"].command.path),
|
||||
"-DPYTHON_EXECUTABLE:PATH={0}".format(python.command.path),
|
||||
"-DLIBOMP_USE_HWLOC:BOOL=ON",
|
||||
"-DLIBOMP_HWLOC_INSTALL_DIR={0}".format(spec["hwloc"].prefix),
|
||||
]
|
||||
|
||||
if python.version >= Version("3.0.0"):
|
||||
cmake_args.append("-DPython3_EXECUTABLE={0}".format(
|
||||
python.command.path))
|
||||
else:
|
||||
cmake_args.append("-DPython2_EXECUTABLE={0}".format(
|
||||
python.command.path))
|
||||
|
||||
projects = []
|
||||
|
||||
if "+cuda" in spec:
|
||||
|
Loading…
Reference in New Issue
Block a user