These are the easiest package-manager based options for a working LLVM/Clang toolchain.
brew update
brew install llvm
echo 'export PATH="/opt/homebrew/opt/llvm/bin:$PATH"' >> ~/.zshrc # Apple Silicon
# echo 'export PATH="/usr/local/opt/llvm/bin:$PATH"' >> ~/.zshrc # Intel Macs
source ~/.zshrc
llvm-config --versionSee the script at llvm-version.sh. It helps me to switch between different LLVM versions installed via Homebrew. You can use it as a template to create your own version manager for LLVM.
sudo apt update
sudo apt install -y llvm clang lld
llvm-config --versionWhen using the ULL iaas environment, you have a Ubuntu image:
usuario@ubuntu:~/pl/llvm$ sudo apt update
sudo apt install -y llvm clang lld
[sudo] password for usuario:
Des:1 https://cli.github.com/packages stable InRelease [3.917 B]
...
You can use the scripts/llvm-health-check.sh to check that LLVM is working:
usuario@ubuntu:~/pl/hello-llvm$ scripts/llvm-health-check.sh
[check] Platform: Linux
[check] Workspace: /home/usuario/pl/hello-llvm
[check] clang: Ubuntu clang version 18.1.3 (1ubuntu1)
[check] llvm-config: 18.1.3
[check] Detected Linux (Codespaces environment)
[check] Compiling factorial example...
[check] Running tmp/f...
sudo dnf install -y llvm clang lld
llvm-config --versionsudo pacman -S llvm clang lld
llvm-config --versionOption 1 (easiest): winget
winget install LLVM.LLVM
clang --versionOption 2: choco
choco install llvm -y
clang --versionIf clang is not recognized after installation, reopen the terminal or add LLVM's bin folder to PATH.
This repo devcontainer is configured for the LLVM Learning Tutorial for the Procesadores de Lenguajes course. It uses the script setup.sh to install LLVM and related tools in a GitHub Codespaces environment. Use it as a template for your own LLVM projects.
See section /docs/installing/github-codespaces.md
If you want to run LLVM-based tests in a GitHub Actions workflow, you can use the following configuration as a starting point. This example installs LLVM and runs tests on a Linux environment.
See also https://github.com/ULL-ESIT-PL/dragon2js/blob/LLVM-simple/.github/workflows/llvm-simple-tests.yml (private repo, but you can see the file content in the link above)
File .github/workflows/llvm-simple-tests.yml:
name: LLVM Simple Tests
on:
push:
branches:
- LLVM-simple
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Install LLVM
run: |
sudo apt-get update
sudo apt-get install -y llvm llvm-runtime
- name: Check LLVM tools
run: |
which lli
lli --version
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 25
cache: npm
- name: Install dependencies
run: npm ci
- name: Run main test suite
run: npm testSee also the LLVM section Getting Started with the LLVM System¶