Closed
Description
Expected behavior
Either configure to disable bench-bitcoin, or the build to succeed.
Actual behavior
Build fails with:
In file included from bench/nanobench.cpp:6:
./bench/nanobench.h: In member function ‘bool ankerl::nanobench::detail::LinuxPerformanceCounters::monitor(uint32_t, uint64_t, ankerl::nanobench::detail::LinuxPerformanceCounters::Target)’:
./bench/nanobench.h:2492:25: error: ‘PERF_EVENT_IOC_ID’ was not declared in this scope; did you mean ‘PERF_EVENT_IOC_PERIOD’?
2492 | if (-1 == ioctl(fd, PERF_EVENT_IOC_ID, &id)) {
| ^~~~~~~~~~~~~~~~~
| PERF_EVENT_IOC_PERIOD
./bench/nanobench.h: In constructor ‘ankerl::nanobench::detail::PerformanceCounters::PerformanceCounters()’:
./bench/nanobench.h:2515:35: error: ‘PERF_COUNT_HW_REF_CPU_CYCLES’ was not declared in this scope; did you mean ‘PERF_COUNT_HW_CPU_CYCLES’?
2515 | mHas.cpuCycles = mPc->monitor(PERF_COUNT_HW_REF_CPU_CYCLES, LinuxPerformanceCounters::Target(&mVal.cpuCycles, true, false));
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
| PERF_COUNT_HW_CPU_CYCLES
To reproduce
Install old linux-headers without PERF_EVENT_IOC_ID
System information
This error discovered building on an otherwise-up-to-date system with linux-headers 2.6.32.
Activity
fanquake commentedon Mar 30, 2021
@martinus do you have any input here? Is supporting older Linux headers something you'd even want to, or can do in https://github.com/martinus/nanobench?
martinus commentedon Mar 30, 2021
Hi, I can fix this in the next nanobench release, I'll add a check for the required events, and if they are not there I'll disable the feature.
Currently I have a define
ANKERL_NANOBENCH_DISABLE_PERF_COUNTERS
, and if it is true the whole perf counter stuff is disabled. So if this is somehow defined for the build it should already compile.martinus commentedon Sep 21, 2021
I think that bug had been fixed in #22082 and can be closed.