Skip to content

Commit

Permalink
Backport LLVM recipe improvements from spack/spack (#166)
Browse files Browse the repository at this point in the history
* llvm: add version 16.0.3 (spack#37472)

* llvm: Fix hwloc@1 and hwloc@:2.3 compatibility (spack#35387)

* llvm: optionally build compiler-rt, libcxx and libunwind as runtimes (spack#32476)

* llvm: replace +omp_as_runtime with omp=runtime

* llvm: fetch 'libomp-libflags-as-list.patch' from upstream repo

* llvm: replace 'llvm14-hwloc-ompd.patch' with the official fix from upstream repo

* llvm: fix-up for the black reformatting

* llvm: fetch 'constexpr_longdouble.patch' from upstream repo

* llvm: optionally build libcxx as a runtime

* llvm: fetch 'llvm5-sanitizer-ustat.patch' from upstream repo

* llvm: update 'sanitizer-ipc_perm_mode.patch'

* llvm: refactor compiler conflicts when libcxx=project

* llvm: fetch 'llvm_python_path.patch' from upstream repo

* llvm: update comments and condition for 'xray_buffer_queue-cstddef.patch'

* llvm: optionally build compiler-rt as a runtime

* llvm: fetch 'lldb_external_ncurses-10.patch' from upstream repo

* llvm: fetch 'llvm_py37.patch' from upstream repo

* llvm: rename variant 'internal_unwind' to 'libunwind'

* llvm: optionally build libunwind as a runtime

* llvm: extend the list of maintainers

* llvm: allow for explicit '~clang~flang~libomptarget~lldb~omp_debug~z3'

* llvm: fetch 'llvm5-lld-ELF-Symbols.patch' from FreeBSD port repo

* llvm: fetch most of 'missing-includes.patch' from upstream repo and reuse 'llvm-gcc11.patch'

* llvm: regroup patches for missing include directives and drop compiler constraints for them

* llvm: fetch 'llvm-gcc11.patch' from upstream repo

* llvm: fetch 'no_cyclades.patch' from upstream repo

* llvm: update comments and condition for 'no_cyclades9.patch'

* llvm: rename variant 'omp' to 'openmp'

* llvm: constrain and rename variant 'omp_tsan' to 'libomp_tsan'

* llvm: rename variant 'omp_debug' to 'libomptarget_debug'

* llvm: do not apply same patch twice

* llvm: constrain and document the '*-thread.patch' patches

* llvm: document the '~lld+libomptarget' conflict

* llvm: update comments for the 'D133513.diff' patch

* llvm: add new versions and set default for libomptarget according to os (spack#38092)

* llvm: add new versions and set default for libomptarget according to os

	modified:   var/spack/repos/builtin/packages/llvm/package.py

* Incorporate reviewer suggestions

Co-authored-by: Sergey Kosukhin <skosukhin@gmail.com>

---------

Co-authored-by: Sergey Kosukhin <skosukhin@gmail.com>

* Add 1606 (spack#38511)

* llvm: fix build against libstdc++ 13 (spack#38329)

llvm @13-15 is required for ispc, but fails to build with GCC 13.
14.0.6 and 15.0.7 built successfully with upstream patch, 13.0.1
still fails. Thus upstream patch is applied to 14 and 15 only.

* ispc: on ARM, build with ARM targets enabled, and updates (spack#38080)

* llvm: fix build with libcxx=none

* ispc: checksum 1.20.0

* ispc: ensure that it does not crash immediately

this would happen if linked to the wrong libc++

* ispc: fix build on macos

find ncurses instead of curses and link against tinfo in order to avoid
unresolved references to _del_curterm, _set_curterm, _setupterm, and
_tigetnum

* ispc: enable arm targets, if building on arm

* ispc: remove double cmake argument

I forgot to remove the constant -DARM_ENABLED=FALSE when adding
-DARM_ENABLED with a value depending on target architecture

* ispc: fix linux build

since 1.20, linux build uses TBB as default tasking system and thus
needs to depend on it

* ispc: try to fix link error on linux

link against both curses (as before) and tinfo (added because of macos)

* ispc: update for recent llvm changes

libcxx=none instead of ~libcxx

---------

Co-authored-by: Satish Balay <balay@mcs.anl.gov>
Co-authored-by: Jordan Galby <67924449+Jordan474@users.noreply.github.com>
Co-authored-by: Sergey Kosukhin <sergey.kosukhin@mpimet.mpg.de>
Co-authored-by: Sajid Ali <sajidsyed2021@u.northwestern.edu>
Co-authored-by: Sergey Kosukhin <skosukhin@gmail.com>
Co-authored-by: Paul R. C. Kent <kentpr@ornl.gov>
Co-authored-by: Martin Aumüller <aumuell@reserv.at>
  • Loading branch information
8 people authored Aug 23, 2023
1 parent 1181215 commit ea7aa5d
Show file tree
Hide file tree
Showing 20 changed files with 367 additions and 465 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ spack:
llvm:
require: "@14:"
# Minimize LLVM
variants: ~lldb~lld~internal_unwind~polly~compiler-rt~gold
variants: "~lldb~lld~polly~gold libunwind=none compiler-rt=none"
all:
require: target=x86_64_v3

Expand Down
19 changes: 18 additions & 1 deletion var/spack/repos/builtin/packages/ispc/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ class Ispc(CMakePackage):
executables = ["^ispc$"]

version("main", branch="main")
version("1.20.0", sha256="8bd30ded7f96859451ead1cecf6f58ac8e937288fe0e5b98c56f6eba4be370b4")
version("1.19.0", sha256="c1aeae4bdfb28004a6949394ea1b3daa3fdf12f646e17fcc0614861077dc8b6a")
version("1.18.1", sha256="fee76d42fc0129f81489b7c2b9143e22a44c281940693c1c13cf1e3dd2ab207f")
version("1.18.0", sha256="ecf1fc6ad5e39242e555b8e0ac539489939a9e475722eaa9da5caa4651cecf05")
Expand All @@ -41,14 +42,18 @@ class Ispc(CMakePackage):
depends_on("flex", type="build")
depends_on("ncurses", type="link")
depends_on("zlib", type="link")
depends_on("tbb", type="link", when="platform=linux @1.20:")
depends_on("llvm+clang")
depends_on("llvm libcxx=none", when="platform=darwin")
depends_on("llvm@13:15", when="@1.19:")
depends_on("llvm@11.0:14.0", when="@1.18")
depends_on("llvm@11:14", when="@1.17")
depends_on("llvm@:12", when="@:1.16")
depends_on("llvm@11:", when="@1.16")
depends_on("llvm@10:11", when="@1.15.0:1.15")
depends_on("llvm@10.0:10", when="@1.13:1.14")
depends_on("llvm targets=arm,aarch64", when="target=arm:")
depends_on("llvm targets=arm,aarch64", when="target=aarch64:")

patch(
"don-t-assume-that-ncurses-zlib-are-system-libraries.patch",
Expand All @@ -65,6 +70,7 @@ class Ispc(CMakePackage):
def setup_build_environment(self, env):
if self.spec.satisfies("@1.18.0:"):
env.append_flags("LDFLAGS", "-lcurses")
env.append_flags("LDFLAGS", "-ltinfo")
env.append_flags("LDFLAGS", "-lz")

def patch(self):
Expand All @@ -76,14 +82,25 @@ def patch(self):
filter_file("bit 32 64", "bit 64", "cmake/GenerateBuiltins.cmake")

def cmake_args(self):
spec = self.spec
args = []
args.append("-DARM_ENABLED=FALSE")
args.append("-DISPC_NO_DUMPS=ON") # otherwise, LLVM needs patching
args.append("-DCURSES_NEED_NCURSES=TRUE")
args.append("-DISPC_INCLUDE_EXAMPLES=OFF")
args.append("-DISPC_INCLUDE_TESTS=OFF")
args.append("-DISPC_INCLUDE_UTILS=OFF")
if spec.satisfies("target=x86_64:") or spec.satisfies("target=x86:"):
args.append("-DARM_ENABLED=OFF")
elif spec.satisfies("target=aarch64:"):
args.append("-DARM_ENABLED=ON")
return args

@run_after("install")
def check_install(self):
with working_dir(self.stage.source_path):
ispc = Executable(join_path(self.prefix, "bin", "ispc"))
ispc("--version")

@classmethod
def determine_version(cls, exe):
output = Executable(exe)("--version", output=str, error=str)
Expand Down
10 changes: 5 additions & 5 deletions var/spack/repos/builtin/packages/julia/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,15 +50,15 @@ class Julia(MakefilePackage):
# Note, we just use link_llvm_dylib so that we not only get a libLLVM,
# but also so that llvm-config --libfiles gives only the dylib. Without
# it it also gives static libraries, and breaks Julia's build.
depends_on("llvm targets=amdgpu,bpf,nvptx,webassembly version_suffix=jl +link_llvm_dylib")
depends_on(
"llvm"
" targets=amdgpu,bpf,nvptx,webassembly"
" version_suffix=jl +link_llvm_dylib libunwind=none"
)
depends_on("libuv", when="@:1.7")
depends_on("libuv-julia@1.42.0", when="@1.8.0:1.8.1")
depends_on("libuv-julia@1.44.2", when="@1.8.2:")

# Do not use internal unwind. We need to use a conflict, because
# `internal_unwind` is defined only when `+clang`.
conflicts("^llvm+internal_unwind")

with when("@1.9.0:1.9"):
# libssh2.so.1, libpcre2-8.so.0, mbedtls.so.14, mbedcrypto.so.7, mbedx509.so.1
# openlibm.so.4, libblastrampoline.so.5, libgit2.so.1.5, libnghttp2.so.14,
Expand Down
28 changes: 0 additions & 28 deletions var/spack/repos/builtin/packages/llvm/constexpr_longdouble.patch

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

9 changes: 0 additions & 9 deletions var/spack/repos/builtin/packages/llvm/llvm-gcc11.patch

This file was deleted.

13 changes: 0 additions & 13 deletions var/spack/repos/builtin/packages/llvm/llvm14-hwloc-ompd.patch

This file was deleted.

33 changes: 0 additions & 33 deletions var/spack/repos/builtin/packages/llvm/llvm5-lld-ELF-Symbols.patch

This file was deleted.

25 changes: 0 additions & 25 deletions var/spack/repos/builtin/packages/llvm/llvm5-sanitizer-ustat.patch

This file was deleted.

37 changes: 0 additions & 37 deletions var/spack/repos/builtin/packages/llvm/llvm_py37.patch

This file was deleted.

14 changes: 0 additions & 14 deletions var/spack/repos/builtin/packages/llvm/llvm_python_path.patch

This file was deleted.

23 changes: 0 additions & 23 deletions var/spack/repos/builtin/packages/llvm/missing-includes.patch

This file was deleted.

Loading

0 comments on commit ea7aa5d

Please sign in to comment.