CMake broken on Apple M1 due to incorrect cache size detection

Issue #447 duplicate
Adam Lugowski created an issue

Building blaze on an Apple M1 chip results in these errors:

CMake Error at cmake-build-release/_deps/blaze-src/CMakeLists.txt:144 (math):
math cannot parse the expression: "/1024": syntax error, unexpected
exp_DIVIDE (1).

CMake Error at cmake-build-release/_deps/blaze-src/CMakeLists.txt:154 (math):
math cannot parse the expression: "*1024": syntax error, unexpected
exp_TIMES (1).

These errors appear to be because the cache size detection returns an empty string. The three routines used (and outputs on my M1 Pro (14” Macbook Pro):

  • sysctl -n hw.l3cachesize

    • empty string
  • sysctl -n hw.l2cachesize

  • sysctl -n hw.l1icachesize

    • 131072

The RESULT_VARIABLE flag is zero for all three, so the fallbacks aren’t invoked. If I change the test on line 130 to:

if (flag OR "${tmp}" STREQUAL "")

then the errors disappear.

Indeed the M1 chip does not have an L3 cache. AFAIK the L2 cache size reported here is per performance core (not total).

Unfortunately there does not appear to be a method to disable this auto detection as the flag for it is set to ON right before it is tested.

Marking priority as “blocker” because blaze cannot be built at all on M1 machines with this error in place.

Comments (3)

  1. Klaus Iglberger

    Hi Adam!

    Thanks a lot for taking the time to report this potential defect. The problem you describe has been fixed in July 2021 with commit 89e947. Please try update your Blaze installation. If the problem persists, please let us know. Thanks again,

    Best regards,

    Klaus!

  2. Log in to comment