Last active
December 8, 2025 05:29
-
Star
(106)
You must be signed in to star a gist -
Fork
(5)
You must be signed in to fork a gist
-
-
Save abel0b/b1881e41b9e1c4b16d84e5e083c38a13 to your computer and use it in GitHub Desktop.
Install perf on WSL 2
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| apt install flex bison | |
| git clone https://github.com/microsoft/WSL2-Linux-Kernel --depth 1 | |
| cd WSL2-Linux-Kernel/tools/perf | |
| make -j8 | |
| sudo cp perf /usr/local/bin |
Note then when I tried this I got an error message about warnings that were treated as errors so it wouldn't build. To work around the issue I did the following to build make -j$(nproc) WERROR=0
Also note that I had to install a lot more packages that what is listed above. The following is the full list of what I installed
sudo apt install -y build-essential flex bison pkg-config libssl-dev libelf-dev libdw-dev libunwind-dev libaudit-dev libbabeltrace-ctf-dev libtraceevent-dev libnuma-dev libpfm4-dev libslang2-dev systemtap-sdt-dev libdebuginfod-dev python3 python3-dev libpython3-dev libperl-dev openjdk-17-jdk
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I'm getting
Unfortunately.....
For anyone else who gets this, looking at the page for libtraceevent suggests that the issue is probably because I am still on Ubuntu 2020.04 LTS (Focal). The oldest they have is for 2022 Jammy. How quickly time has flown...
The latest LTS release is 2024.04 LTS (Noble). I'll post back here if upgrading doesn't fix this issue.
Edit: Installing 2024.04 LTS fixed the issue.
perf record,perf reportwork beautifully