summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKensuke WATANABE <95006284+wkensuke@users.noreply.github.com>2024-04-09 08:56:30 +0900
committerGitHub <noreply@github.com>2024-04-08 19:56:30 -0400
commit3f2fa256fc818934fbbcb22e61a297de9da3ba1f (patch)
tree1f97cb1c7cb7827eb6d3bd6d9fe3072e3ce84aeb
parentd5c886494200896f21cfcddee8453a56802fcf68 (diff)
downloadspack-3f2fa256fc818934fbbcb22e61a297de9da3ba1f.tar.gz
spack-3f2fa256fc818934fbbcb22e61a297de9da3ba1f.tar.bz2
spack-3f2fa256fc818934fbbcb22e61a297de9da3ba1f.tar.xz
spack-3f2fa256fc818934fbbcb22e61a297de9da3ba1f.zip
LLVM: avoid Fujitsu compiler build fail in llvm17-18 (#43387)
* Avoid Fujitsu compiler Clang Mode options when building LLVM * LLVM: avoid Fujitsu compiler build fail in llvm17-18 * address review comments
-rw-r--r--var/spack/repos/builtin/packages/llvm/llvm17-18-thread.patch22
-rw-r--r--var/spack/repos/builtin/packages/llvm/llvm17-fujitsu.patch28
-rw-r--r--var/spack/repos/builtin/packages/llvm/package.py4
3 files changed, 54 insertions, 0 deletions
diff --git a/var/spack/repos/builtin/packages/llvm/llvm17-18-thread.patch b/var/spack/repos/builtin/packages/llvm/llvm17-18-thread.patch
new file mode 100644
index 0000000000..7e337433ff
--- /dev/null
+++ b/var/spack/repos/builtin/packages/llvm/llvm17-18-thread.patch
@@ -0,0 +1,22 @@
+diff --git a/openmp/libomptarget/cmake/Modules/LibomptargetGetDependencies.cmake b/openmp/libomptarget/cmake/Modules/LibomptargetGetDependencies.cmake
+index 1f2a50667c4f..d3ff232f6bd3 100644
+--- a/openmp/libomptarget/cmake/Modules/LibomptargetGetDependencies.cmake
++++ b/openmp/libomptarget/cmake/Modules/LibomptargetGetDependencies.cmake
+@@ -280,4 +280,5 @@ if (NOT LIBOMPTARGET_CUDA_TOOLKIT_ROOT_DIR_PRESET AND
+ endif()
+ endif()
+
+-set(OPENMP_PTHREAD_LIB ${LLVM_PTHREAD_LIB})
++find_package(Threads REQUIRED)
++set(OPENMP_PTHREAD_LIB Threads::Threads)
+diff --git a/openmp/libomptarget/src/CMakeLists.txt b/openmp/libomptarget/src/CMakeLists.txt
+index 071ec61889a2..b782c3b07e6f 100644
+--- a/openmp/libomptarget/src/CMakeLists.txt.orig 2024-03-26 14:30:52.000000000 +0900
++++ b/openmp/libomptarget/src/CMakeLists.txt 2024-03-26 14:34:02.000000000 +0900
+@@ -41,5 +41,6 @@
+
+ if (LIBOMP_HAVE_VERSION_SCRIPT_FLAG)
+ target_link_libraries(omptarget PRIVATE
++ ${OPENMP_PTHREAD_LIB}
+ "-Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/exports")
+ endif()
diff --git a/var/spack/repos/builtin/packages/llvm/llvm17-fujitsu.patch b/var/spack/repos/builtin/packages/llvm/llvm17-fujitsu.patch
new file mode 100644
index 0000000000..f960830c13
--- /dev/null
+++ b/var/spack/repos/builtin/packages/llvm/llvm17-fujitsu.patch
@@ -0,0 +1,28 @@
+diff --git a/lldb/include/lldb/Utility/LLDBAssert.h_org b/lldb/include/lldb/Utility/LLDBAssert.h
+index aeef3e5..2f14ff3 100644
+--- a/lldb/include/lldb/Utility/LLDBAssert.h_org
++++ b/lldb/include/lldb/Utility/LLDBAssert.h
+@@ -14,7 +14,7 @@
+ #ifndef NDEBUG
+ #define lldbassert(x) assert(x)
+ #else
+-#if defined(__clang__)
++#if defined(__clang__) && !defined(__CLANG_FUJITSU)
+ // __FILE_NAME__ is a Clang-specific extension that functions similar to
+ // __FILE__ but only renders the last path component (the filename) instead of
+ // an invocation dependent full path to that file.
+
+diff --git runtimes/CMakeLists.txt_org runtimes/CMakeLists.txt
+--- a/runtimes/CMakeLists.txt_org
++++ b/runtimes/CMakeLists.txt
+@@ -6,2 +6,2 @@
+ include(${LLVM_COMMON_CMAKE_UTILS}/Modules/CMakePolicy.cmake
+ NO_POLICY_SCOPE)
+
++string(REPLACE "-Nclang" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
++string(REPLACE "-Nnofjprof" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
++string(REPLACE "-Nfjprof" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
++
+ project(Runtimes C CXX ASM)
+
+ list(INSERT CMAKE_MODULE_PATH 0
diff --git a/var/spack/repos/builtin/packages/llvm/package.py b/var/spack/repos/builtin/packages/llvm/package.py
index bd81ecec44..427801c406 100644
--- a/var/spack/repos/builtin/packages/llvm/package.py
+++ b/var/spack/repos/builtin/packages/llvm/package.py
@@ -539,6 +539,10 @@ class Llvm(CMakePackage, CudaPackage):
# avoid build failed with Fujitsu compiler
patch("llvm13-fujitsu.patch", when="@13 %fj")
+ # avoid build failed with Fujitsu compiler since llvm17
+ patch("llvm17-fujitsu.patch", when="@17: %fj")
+ patch("llvm17-18-thread.patch", when="@17:18 %fj")
+
# patch for missing hwloc.h include for libompd
# see https://reviews.llvm.org/D123888
patch(