From 860825ee14ab54c8b5ec1a1da0950387a6debd2a Mon Sep 17 00:00:00 2001 From: Robert Underwood Date: Sat, 26 Dec 2020 10:47:37 -0500 Subject: 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 --- .../repos/builtin/packages/llvm/llvm_python_path.patch | 14 ++++++++++++++ var/spack/repos/builtin/packages/llvm/package.py | 14 +++++++++++++- 2 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 var/spack/repos/builtin/packages/llvm/llvm_python_path.patch diff --git a/var/spack/repos/builtin/packages/llvm/llvm_python_path.patch b/var/spack/repos/builtin/packages/llvm/llvm_python_path.patch new file mode 100644 index 0000000000..9f821cc365 --- /dev/null +++ b/var/spack/repos/builtin/packages/llvm/llvm_python_path.patch @@ -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) diff --git a/var/spack/repos/builtin/packages/llvm/package.py b/var/spack/repos/builtin/packages/llvm/package.py index 6469f28c03..2f7b62707e 100644 --- a/var/spack/repos/builtin/packages/llvm/package.py +++ b/var/spack/repos/builtin/packages/llvm/package.py @@ -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 @@ class Llvm(CMakePackage, CudaPackage): 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: -- cgit v1.2.3-60-g2f50