@@ -63,8 +63,9 @@ programs using Rust. It includes:
6363
6464` LLVM ` is required in your build system to compile BPF bytecode using RedBPF.
6565
66- - ** LLVM 13**
67- It is needed to compile BPF bytecode.
66+ - ** LLVM 14 or 13**
67+ It is needed to compile BPF bytecode. If you're using Rust 1.60 or later, LLVM 14 is required.
68+ If you need to use LLVM 13, use the feature ` llvm13-0 ` .
6869
6970- One of the followings:
7071 1 . The Linux kernel headers
@@ -74,7 +75,7 @@ programs using Rust. It includes:
7475
7576### On Ubuntu 20.04 LTS
7677
77- Install LLVM 13 and the Linux kernel headers
78+ Install LLVM 14 and the Linux kernel headers
7879``` console
7980# apt-get update \
8081 && apt-get -y install \
@@ -85,12 +86,15 @@ Install LLVM 13 and the Linux kernel headers
8586 libelf-dev \
8687 linux-headers-generic \
8788 pkg-config \
88- && wget https://apt.llvm.org/llvm.sh && chmod +x llvm.sh && ./llvm.sh 13 && rm -f ./llvm.sh
89- # llvm-config-13 --version | grep 13
89+ && wget https://apt.llvm.org/llvm.sh && chmod +x llvm.sh && ./llvm.sh 14 && rm -f ./llvm.sh
90+ # llvm-config-14 --version | grep 14
9091```
9192
9293### On Fedora 35
9394
95+ Currently, only LLVM 13 is available in the official Fedora repositories.
96+ Consider building LLVM from source until Fedora 36 is released.
97+
9498Install LLVM 13 and the Linux kernel headers
9599``` console
96100# dnf install -y \
@@ -126,25 +130,28 @@ Install LLVM 13 and the Linux kernel headers
126130# llvm-config --version | grep -q ' ^13'
127131```
128132
133+ At the time of writing, LLVM 14 is not available in the official package repository.
134+ If you need to use Rust 1.60 or later, please build LLVM from source.
135+
129136### Building LLVM from source
130137
131138If your Linux distro does not support the latest LLVM as pre-built packages
132139yet, you may build LLVM from the LLVM source code.
133140
134141``` console
135- $ tar -xaf llvm-13 .0.0.src.tar.xz
136- $ mkdir -p llvm-13 .0.0.src/build
137- $ cd llvm-13 .0.0.src/build
138- $ cmake .. -DCMAKE_INSTALL_PREFIX=$HOME /llvm-13 -release -DCMAKE_BUILD_TYPE=Release -DLLVM_BUILD_LLVM_DYLIB=1
142+ $ tar -xaf llvm-14 .0.0.src.tar.xz
143+ $ mkdir -p llvm-14 .0.0.src/build
144+ $ cd llvm-14 .0.0.src/build
145+ $ cmake .. -DCMAKE_INSTALL_PREFIX=$HOME /llvm-14 -release -DCMAKE_BUILD_TYPE=Release -DLLVM_BUILD_LLVM_DYLIB=1
139146$ cmake --build . --target install
140147```
141148
142149Then you can use your LLVM by specifying the custom installation path when
143150installing ` cargo-bpf ` or building RedBPF like this:
144151
145152``` console
146- $ LLVM_SYS_130_PREFIX =$HOME /llvm-13 -release/ cargo install cargo-bpf
147- $ LLVM_SYS_130_PREFIX =$HOME /llvm-13 -release/ cargo build
153+ $ LLVM_SYS_140_PREFIX =$HOME /llvm-14 -release/ cargo install cargo-bpf
154+ $ LLVM_SYS_140_PREFIX =$HOME /llvm-14 -release/ cargo build
148155```
149156
150157Make sure correct ` -DCMAKE_BUILD_TYPE ` is specified. Typically ` Debug ` type is
@@ -235,7 +242,8 @@ There are two LLVM versions involved in compiling BPF programs:
235242
236243| Rust version | LLVM version of the rustc | Valid LLVM version of system |
237244| :-------------| :-------------------------:| :-----------------------------|
238- | 1.56 ~ | LLVM 13 | LLVM 13 and newer |
245+ | 1.56 ~ 1.60 | LLVM 13 | LLVM 13 and newer |
246+ | 1.60 ~ | LLVM 14 | LLVM 14 and newer |
239247
240248## Docker images for RedBPF build test
241249
0 commit comments