./bench/nanobench.h:2492:25: error: ‘PERF_EVENT_IOC_ID’ was not declared in this scope #21549

issue luke-jr openend this issue on March 29, 2021
  1. luke-jr commented at 10:21 pm on March 29, 2021: member

    Expected behavior

    Either configure to disable bench-bitcoin, or the build to succeed.

    Actual behavior

    Build fails with:

     0In file included from bench/nanobench.cpp:6:
     1./bench/nanobench.h: In member function bool ankerl::nanobench::detail::LinuxPerformanceCounters::monitor(uint32_t, uint64_t, ankerl::nanobench::detail::LinuxPerformanceCounters::Target):
     2./bench/nanobench.h:2492:25: error: PERF_EVENT_IOC_ID was not declared in this scope; did you mean PERF_EVENT_IOC_PERIOD’?
     3 2492 |     if (-1 == ioctl(fd, PERF_EVENT_IOC_ID, &id)) {
     4      |                         ^~~~~~~~~~~~~~~~~
     5      |                         PERF_EVENT_IOC_PERIOD
     6./bench/nanobench.h: In constructor ankerl::nanobench::detail::PerformanceCounters::PerformanceCounters():
     7./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’?
     8 2515 |     mHas.cpuCycles = mPc->monitor(PERF_COUNT_HW_REF_CPU_CYCLES, LinuxPerformanceCounters::Target(&mVal.cpuCycles, true, false));
     9      |                                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
    10      |                                   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.

  2. luke-jr added the label Bug on Mar 29, 2021
  3. fanquake commented at 11:23 am on March 30, 2021: member
    @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?
  4. martinus commented at 12:39 pm on March 30, 2021: contributor

    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.

  5. martinus commented at 7:05 am on September 21, 2021: contributor
    I think that bug had been fixed in #22082 and can be closed.
  6. fanquake closed this on Sep 21, 2021

  7. DrahtBot locked this on Oct 30, 2022

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2024-12-22 00:12 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me