Skip to content

Instantly share code, notes, and snippets.

@abel0b
Last active April 15, 2025 15:13
Show Gist options
  • Save abel0b/b1881e41b9e1c4b16d84e5e083c38a13 to your computer and use it in GitHub Desktop.
Save abel0b/b1881e41b9e1c4b16d84e5e083c38a13 to your computer and use it in GitHub Desktop.
Install perf on WSL 2
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
@abdennour
Copy link

what about WSL1 ?

@zxcqirara
Copy link

Why do you even use it?

@vaqxai
Copy link

vaqxai commented Aug 14, 2024

What about this one?

In file included from /home/vaqxai/perf-install/perf-6.9.0/tools/perf/util/evsel.c:43:
/home/vaqxai/perf-install/perf-6.9.0/tools/perf/util/trace-event.h:152:62: error: operator '&&' has no right operand
  152 | #if defined(LIBTRACEEVENT_VERSION) &&  LIBTRACEEVENT_VERSION >= MAKE_LIBTRACEEVENT_VERSION(1, 5, 0)
      |                                                              ^~
error: command '/usr/bin/gcc' failed with exit code 1

@NyxWh1sper
Copy link

What about this one?

In file included from /home/vaqxai/perf-install/perf-6.9.0/tools/perf/util/evsel.c:43:
/home/vaqxai/perf-install/perf-6.9.0/tools/perf/util/trace-event.h:152:62: error: operator '&&' has no right operand
  152 | #if defined(LIBTRACEEVENT_VERSION) &&  LIBTRACEEVENT_VERSION >= MAKE_LIBTRACEEVENT_VERSION(1, 5, 0)
      |                                                              ^~
error: command '/usr/bin/gcc' failed with exit code 1

I delete ./util/debug.c:31 and it works for me.

@crucinal1
Copy link

What about this one?

In file included from /home/vaqxai/perf-install/perf-6.9.0/tools/perf/util/evsel.c:43:
/home/vaqxai/perf-install/perf-6.9.0/tools/perf/util/trace-event.h:152:62: error: operator '&&' has no right operand
  152 | #if defined(LIBTRACEEVENT_VERSION) &&  LIBTRACEEVENT_VERSION >= MAKE_LIBTRACEEVENT_VERSION(1, 5, 0)
      |                                                              ^~
error: command '/usr/bin/gcc' failed with exit code 1

I delete ./util/debug.c:31 and it works for me.

didn't work for me

@Gabrielcarvfer
Copy link

Also missing libpfm4-dev libtraceevent-dev pkg-config

@abdeldiaz
Copy link

abdeldiaz commented Oct 23, 2024

With sudo apt install libpfm4-dev libtraceevent-dev pkg-config the compilation error issue get solved.

@OmarZohir
Copy link

With sudo apt install libpfm4-dev libtraceevent-dev pkg-config the compilation error issue get solved.

Had the same issue as crucinal1, and that solution worked.

@Dino1844
Copy link

With sudo apt install libpfm4-dev libtraceevent-dev pkg-config the compilation error issue get solved.

Thanks, that works.

@ChrisJefferson
Copy link

For people seeing errors, try make -j8 WERROR=0, as the kernel automatically turns warning into errors. This stops that behaviour.

@ghj1222
Copy link

ghj1222 commented Mar 2, 2025

What about this one?

In file included from /home/vaqxai/perf-install/perf-6.9.0/tools/perf/util/evsel.c:43:
/home/vaqxai/perf-install/perf-6.9.0/tools/perf/util/trace-event.h:152:62: error: operator '&&' has no right operand
  152 | #if defined(LIBTRACEEVENT_VERSION) &&  LIBTRACEEVENT_VERSION >= MAKE_LIBTRACEEVENT_VERSION(1, 5, 0)
      |                                                              ^~
error: command '/usr/bin/gcc' failed with exit code 1

apt install pkg-config and it works for me

@ryanrhu
Copy link

ryanrhu commented Mar 4, 2025

What about this one?

In file included from /home/vaqxai/perf-install/perf-6.9.0/tools/perf/util/evsel.c:43:
/home/vaqxai/perf-install/perf-6.9.0/tools/perf/util/trace-event.h:152:62: error: operator '&&' has no right operand
  152 | #if defined(LIBTRACEEVENT_VERSION) &&  LIBTRACEEVENT_VERSION >= MAKE_LIBTRACEEVENT_VERSION(1, 5, 0)
      |                                                              ^~
error: command '/usr/bin/gcc' failed with exit code 1

apt install pkg-config and it works for me

finally it work, thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment