Skip to content
This repository has been archived by the owner on Jan 3, 2024. It is now read-only.

cmake: workaround _num_cores being 0 under qemu emulation #256

Merged

Conversation

tserong
Copy link
Member

@tserong tserong commented Nov 23, 2023

If you're doing something weird like trying to cross compile bits of ceph using qemu emulation, cmake can think there are zero CPU cores. This is because cmake counts "processor" lines in /proc/cpuinfo, which don't exist when running under qemu-aarch64:

  # cat /proc/cpuinfo
  Processor       : ARMv7 Processor rev 5 (v7l)
  BogoMIPS        : 799.53
  Features        : swp half thumb fastmult vfp edsp thumbee neon vfpv3
  CPU implementer : 0x41
  CPU architecture: 7
  CPU variant     : 0x2
  CPU part        : 0xc08
  CPU revision    : 5

  Hardware        : Genesi Efika MX (Smarttop)
  Revision        : 51030
  Serial          : 0000000000000000

This in turn causes heavy_compile_job_pool to not be set, which later makes the build fail, as that pool is referenced in src/tools/ceph-dencoder/CMakeLists.txt. We can work around the problem by setting _num_cores to 1 in this case.

Contribution Guidelines

Checklist

  • Tracker (select at least one)
    • References tracker ticket
    • Very recent bug; references commit where it was introduced
    • New feature (ticket optional)
    • Doc update (no ticket needed)
    • Code cleanup (no ticket needed)
  • Documentation (select at least one)
    • Updates relevant documentation
    • No doc update is appropriate
  • Tests (select at least one)

If you're doing something weird like trying to cross compile bits
of ceph using qemu emulation, cmake can think there are zero CPU
cores.  This is because cmake counts "processor" lines in
/proc/cpuinfo, which don't exist when running under qemu-aarch64:

  # cat /proc/cpuinfo
  Processor       : ARMv7 Processor rev 5 (v7l)
  BogoMIPS        : 799.53
  Features        : swp half thumb fastmult vfp edsp thumbee neon vfpv3
  CPU implementer : 0x41
  CPU architecture: 7
  CPU variant     : 0x2
  CPU part        : 0xc08
  CPU revision    : 5

  Hardware        : Genesi Efika MX (Smarttop)
  Revision        : 51030
  Serial          : 0000000000000000

This in turn causes heavy_compile_job_pool to not be set, which
later makes the build fail, as that pool is referenced in
src/tools/ceph-dencoder/CMakeLists.txt.  We can work around the
problem by setting _num_cores to 1 in this case.

Signed-off-by: Tim Serong <[email protected]>
Copy link
Member

@jecluis jecluis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks reasonable to me - I suspect we'll see machines gradually with a higher positive number of cores as we go on, so this should hold for a while.

@tserong tserong merged commit e5de266 into aquarist-labs:s3gw Nov 23, 2023
8 checks passed
@tserong tserong deleted the wip-workaround-qemu-zero-cpu-cores branch November 24, 2023 10:17
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants