Re: [PATCH v2] perf build: Fix compiler errors with old capstone

From: Namhyung Kim

Date: Mon Jul 20 2026 - 00:44:29 EST


On Mon, 06 Jul 2026 16:48:35 -0700, Namhyung Kim wrote:
> It seems RISCV was added in capstone version 5 (released Jul 2023).
> Unfortunately they are enum constants so cannot check with #ifdef but
> anyway we can define the symbols. Let's do it using the version
> number to avoid build errors. It'll fail at runtime though.
>
> util/capstone.c: In function 'e_machine_to_capstone':
> util/capstone.c:186:25: error: 'CS_ARCH_RISCV' undeclared (first use in this function);
> did you mean 'CS_ARCH_SYSZ'?
> 186 | *arch = CS_ARCH_RISCV;
> | ^~~~~~~~~~~~~
> | CS_ARCH_SYSZ
> util/capstone.c:186:25: note: each undeclared identifier is reported only once for each function it appears in
>
> [...]
Applied to perf-tools-next, thanks!

Best regards,
Namhyung