Fix test failures on arm64
Description
This MR fixes #263 (closed) In order to fix the tests, this MR fixed a more general issue in the build system and cpp code. Detailed description can be seen in the commit message.
Notes for Reviewer
See commit message for a detailed description of the bugs and fixes.
Checklist
-
Documentation was updated