crystal-lang / crystal

The Crystal Programming Language
https://crystal-lang.org
Apache License 2.0
19.26k stars 1.61k forks source link

LLVM CI: build LLVM from source #14573

Open HertzDevil opened 2 months ago

HertzDevil commented 2 months ago

The official Apt repositories only serve the 3 most recent major versions, while the volunteer-built packages are incomplete and of inconsistent quality, so the best solution is to build LLVM ourselves.

This also reduces the total size for the 6 LLVM caches from 8 GB to around 2.4 GB. That's more than half the limit for a GitHub repository.

lld is needed for #13193; technically speaking, we could build it straight from the very repository we're cloning here, but we aren't really testing any version-specific lld behavior, so this patch grabs it from Apt.

oprypin commented 2 months ago

This also reduces the total size for the 6 LLVM caches

Hmm actually it looks like there wasn't even any reason to have those caches before because it just moves the download+extract step from one place on GitHub to another. Now of course they'll be necessary. Looks good

straight-shoota commented 2 months ago

I was actually about to look into using nix more for our builds.

We already have an environment with configurable LLVM versions in shell.nix. The dependencies are defined and cached in nixpkgs. And nixpkgs_unstable currently has package definitions for LLVM 8 through LLVM 18. So we don't need to build anything ourselves

ysbaddaden commented 2 months ago

The official Apt repositories only serve the 3 most recent major versions

You mean the official Debian or Ubuntu APT repositories?

Because the official LLVM APT repositories have all the releases we want. For example LLVM 13 to 18 for Ubuntu 22.04 + nightlies of LLVM 19 (see https://apt.llvm.org/jammy/pool/main/l/), and it will continue to receive the new releases for years to come. For Ubuntu 20.04 they have all releases since LLVM 9 (see https://apt.llvm.org/focal/pool/main/l/).