diff options
author | Pat McCormick <651611+pmccormick@users.noreply.github.com> | 2023-08-30 22:22:33 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-08-30 23:22:33 -0500 |
commit | c1756257c241334719f0f08a80c6e88eaac180e6 (patch) | |
tree | 2ddb6cb8b0489a3aabb560bb582e7cfc1b621f26 | |
parent | 1ee7c735ec98c3a810d0280a33bb05ca6bc79987 (diff) | |
download | spack-c1756257c241334719f0f08a80c6e88eaac180e6.tar.gz spack-c1756257c241334719f0f08a80c6e88eaac180e6.tar.bz2 spack-c1756257c241334719f0f08a80c6e88eaac180e6.tar.xz spack-c1756257c241334719f0f08a80c6e88eaac180e6.zip |
llvm: fix for Flang variant due to exception handling (#36171)
* The flang project does not support exceptions enabled in the core llvm
library (and developer guidelines explicitly state they should not be
used). For this reason, when the flang variant is selected,
LLVM_ENABLE_EH needs to be disabled. In the current main branch of
llvm (and thus future releases), enabling flang and setting
LLVM_ENABLE_EH will cause the overall build to fail.
* Update var/spack/repos/builtin/packages/llvm/package.py
Co-authored-by: Harmen Stoppels <harmenstoppels@gmail.com>
* fix syntax
---------
Co-authored-by: Harmen Stoppels <harmenstoppels@gmail.com>
Co-authored-by: Satish Balay <balay@mcs.anl.gov>
-rw-r--r-- | var/spack/repos/builtin/packages/llvm/package.py | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/var/spack/repos/builtin/packages/llvm/package.py b/var/spack/repos/builtin/packages/llvm/package.py index 16ab6177f7..a4a89f17bc 100644 --- a/var/spack/repos/builtin/packages/llvm/package.py +++ b/var/spack/repos/builtin/packages/llvm/package.py @@ -756,7 +756,6 @@ class Llvm(CMakePackage, CudaPackage): cmake_args = [ define("LLVM_REQUIRES_RTTI", True), define("LLVM_ENABLE_RTTI", True), - define("LLVM_ENABLE_EH", True), define("LLVM_ENABLE_LIBXML2", False), define("CLANG_DEFAULT_OPENMP_RUNTIME", "libomp"), define("PYTHON_EXECUTABLE", python.command.path), @@ -765,6 +764,16 @@ class Llvm(CMakePackage, CudaPackage): from_variant("LLVM_ENABLE_ZSTD", "zstd"), ] + # Flang does not support exceptions from core llvm. + # LLVM_ENABLE_EH=True when building flang will soon + # fail (with changes at the llvm-project level). + # Only enable exceptions in LLVM if we are *not* + # building flang. FYI: LLVM <= 16.x will build flang + # successfully but the executable will suffer from + # link errors looking for C++ EH support. + if "+flang" not in spec: + cmake_args.append(define("LLVM_ENABLE_EH", True)) + version_suffix = spec.variants["version_suffix"].value if version_suffix != "none": cmake_args.append(define("LLVM_VERSION_SUFFIX", version_suffix)) |