summaryrefslogtreecommitdiff
path: root/var
diff options
context:
space:
mode:
authorHarmen Stoppels <harmenstoppels@gmail.com>2023-08-23 13:33:23 +0200
committerGitHub <noreply@github.com>2023-08-23 07:33:23 -0400
commit00a3ebd0bb8f819c544a066cf1547c3b1e524e0a (patch)
treeafcb98f594a26765e540f9078485aa040a51e8ef /var
parentffc9060e11a7240a3a0a00c3262c0c74c06eaee7 (diff)
downloadspack-00a3ebd0bb8f819c544a066cf1547c3b1e524e0a.tar.gz
spack-00a3ebd0bb8f819c544a066cf1547c3b1e524e0a.tar.bz2
spack-00a3ebd0bb8f819c544a066cf1547c3b1e524e0a.tar.xz
spack-00a3ebd0bb8f819c544a066cf1547c3b1e524e0a.zip
llvm: fix `elf` dep conditions and cmake bug (#39566)
Diffstat (limited to 'var')
-rw-r--r--var/spack/repos/builtin/packages/llvm/add-include-for-libelf-llvm-12-14.patch26
-rw-r--r--var/spack/repos/builtin/packages/llvm/add-include-for-libelf-llvm-15.patch26
-rw-r--r--var/spack/repos/builtin/packages/llvm/package.py18
3 files changed, 60 insertions, 10 deletions
diff --git a/var/spack/repos/builtin/packages/llvm/add-include-for-libelf-llvm-12-14.patch b/var/spack/repos/builtin/packages/llvm/add-include-for-libelf-llvm-12-14.patch
new file mode 100644
index 0000000000..f585d08d01
--- /dev/null
+++ b/var/spack/repos/builtin/packages/llvm/add-include-for-libelf-llvm-12-14.patch
@@ -0,0 +1,26 @@
+From e5f0939fde75f769c53c6c99c9ed6886e7d58c43 Mon Sep 17 00:00:00 2001
+From: Harmen Stoppels <me@harmenstoppels.nl>
+Date: Wed, 23 Aug 2023 11:35:23 +0200
+Subject: [PATCH] Add corresponding -I for libelf.h
+
+Funnily enough, it's added to `include_directories` in multiple places,
+except where it's necessary.
+---
+ openmp/libomptarget/plugins/amdgpu/CMakeLists.txt | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/openmp/libomptarget/plugins/amdgpu/CMakeLists.txt b/openmp/libomptarget/plugins/amdgpu/CMakeLists.txt
+index 92523c23f68b..52e1923f97b7 100644
+--- a/openmp/libomptarget/plugins/amdgpu/CMakeLists.txt
++++ b/openmp/libomptarget/plugins/amdgpu/CMakeLists.txt
+@@ -51,6 +51,7 @@ endif()
+ include_directories(
+ ${CMAKE_CURRENT_SOURCE_DIR}/impl
+ ${LIBOMPTARGET_LLVM_INCLUDE_DIRS}
++ ${LIBOMPTARGET_DEP_LIBELF_INCLUDE_DIR}
+ )
+
+ set(LIBOMPTARGET_DLOPEN_LIBHSA OFF)
+--
+2.39.2
+
diff --git a/var/spack/repos/builtin/packages/llvm/add-include-for-libelf-llvm-15.patch b/var/spack/repos/builtin/packages/llvm/add-include-for-libelf-llvm-15.patch
new file mode 100644
index 0000000000..7a7d57d108
--- /dev/null
+++ b/var/spack/repos/builtin/packages/llvm/add-include-for-libelf-llvm-15.patch
@@ -0,0 +1,26 @@
+From 5e149c3ec8118ad8f3d20a30ce5d3fbac4072515 Mon Sep 17 00:00:00 2001
+From: Harmen Stoppels <me@harmenstoppels.nl>
+Date: Wed, 23 Aug 2023 11:35:23 +0200
+Subject: [PATCH] Add corresponding -I for libelf.h
+
+Funnily enough, it's added to `include_directories` in multiple places,
+except where it's necessary.
+---
+ openmp/libomptarget/plugins/amdgpu/CMakeLists.txt | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/openmp/libomptarget/plugins/amdgpu/CMakeLists.txt b/openmp/libomptarget/plugins/amdgpu/CMakeLists.txt
+index 66bf680d15c7..6be12ab6d7f8 100644
+--- a/openmp/libomptarget/plugins/amdgpu/CMakeLists.txt
++++ b/openmp/libomptarget/plugins/amdgpu/CMakeLists.txt
+@@ -99,6 +99,7 @@ target_include_directories(
+ PRIVATE
+ ${LIBOMPTARGET_INCLUDE_DIR}
+ ${CMAKE_CURRENT_SOURCE_DIR}/impl
++ ${LIBOMPTARGET_DEP_LIBELF_INCLUDE_DIR}
+ )
+
+
+--
+2.39.2
+
diff --git a/var/spack/repos/builtin/packages/llvm/package.py b/var/spack/repos/builtin/packages/llvm/package.py
index 37c3bbca0e..63826fc6c9 100644
--- a/var/spack/repos/builtin/packages/llvm/package.py
+++ b/var/spack/repos/builtin/packages/llvm/package.py
@@ -277,8 +277,10 @@ class Llvm(CMakePackage, CudaPackage):
depends_on("perl-data-dumper", type=("build"))
depends_on("hwloc")
depends_on("hwloc@2.0.1:", when="@13")
- depends_on("elf", when="+cuda") # libomptarget
- depends_on("libffi", when="+libomptarget") # libomptarget
+ with when("@:15"):
+ depends_on("elf", when="+cuda")
+ depends_on("elf", when="+libomptarget")
+ depends_on("libffi", when="+libomptarget")
# llvm-config --system-libs libraries.
depends_on("zlib-api")
@@ -540,6 +542,9 @@ class Llvm(CMakePackage, CudaPackage):
when="@13:14 compiler-rt=runtime",
)
+ patch("add-include-for-libelf-llvm-12-14.patch", when="@12:14")
+ patch("add-include-for-libelf-llvm-15.patch", when="@15")
+
# The functions and attributes below implement external package
# detection for LLVM. See:
#
@@ -777,13 +782,7 @@ class Llvm(CMakePackage, CudaPackage):
]
)
if "openmp=runtime" in spec:
- cmake_args.extend(
- [
- define("LIBOMPTARGET_NVPTX_ENABLE_BCLIB", True),
- # work around bad libelf detection in libomptarget
- define("LIBOMPTARGET_DEP_LIBELF_INCLUDE_DIR", spec["elf"].prefix.include),
- ]
- )
+ cmake_args.append(define("LIBOMPTARGET_NVPTX_ENABLE_BCLIB", True))
else:
# still build libomptarget but disable cuda
cmake_args.extend(
@@ -924,7 +923,6 @@ class Llvm(CMakePackage, CudaPackage):
cmake_args.extend(
[
define("LIBOMPTARGET_NVPTX_ENABLE_BCLIB", True),
- define("LIBOMPTARGET_DEP_LIBELF_INCLUDE_DIR", spec["elf"].prefix.include),
self.stage.source_path + "/openmp",
]
)