Skip to content

fix: macOS ARM64 + Xcode 26+ Hunter package compatibility - #18

Open
pgarciagon wants to merge 5 commits into
koinos:masterfrom
pgarciagon:fix/macos-arm64
Open

pgarciagon wants to merge 5 commits into
koinos:masterfrom
pgarciagon:fix/macos-arm64

Conversation

@pgarciagon

Copy link
Copy Markdown

Problem

Building koinos-chain natively on Apple Silicon (arm64) with Xcode 16+ fails in
four different Hunter-managed packages due to macOS/ARM64-specific issues:

  1. fizzy — bytes.hpp uses std::basic_string<uint8_t> which instantiates
    char_traits<unsigned char>, deprecated in libc++ 16+ and a hard error in
    Xcode 26 beta.
  2. ZLIB — zutil.h defines fdopen(fd,mode) NULL whenever TARGET_OS_MAC
    is set. On macOS TARGET_OS_MAC is always true, silently replacing legitimate
    fdopen() calls with NULL.
  3. rocksdb — With PORTABLE=ON and a CMake toolchain file, rocksdb's CRC
    auto-detection does not fire for ARM; the crc32c falls back to software and
    the build may fail with strict compiler flags.
  4. libsecp256k1-vrf — FindGMP.cmake searches /usr/local only; on Apple
    Silicon Homebrew installs GMP under /opt/homebrew, causing configure to fail.

Fix

The fizzy and ZLIB entries reference temporary forks while the upstream PRs are
reviewed; they should be reverted to canonical URLs once those PRs are merged.

Testing

Full koinos-chain build on macOS 15, Apple M3, arm64, Xcode 16.3 / Xcode 26 beta.

pgargo and others added 3 commits March 28, 2026 22:35
Four Hunter package fixes to allow koinos-cmake consumers to build
natively on Apple Silicon (arm64) with Xcode 16+/libc++ 26+:

- fizzy: use pgarciagon/fizzy fix/macos-libcxx26-char-traits; wraps
  bytes.hpp in clang diagnostic pragma to suppress char_traits<uint8_t>
  deprecation (hard error on Xcode 26 beta)
- ZLIB: use pgarciagon/zlib fix/macos-fdopen-conflict; guards fdopen()
  NULL macro in zutil.h with !defined(__APPLE__) to avoid conflict with
  macOS stdio.h declaration
- rocksdb: append -march=armv8-a+crc+crypto to CXX/C flags; PORTABLE=ON
  does not auto-detect ARM CRC when a toolchain file is active
- libsecp256k1-vrf: pass GMP_LIBRARY/GMP_INCLUDE_DIR pointing at
  Homebrew /opt/homebrew (Apple Silicon prefix); FindGMP.cmake only
  searches /usr/local by default
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…e _GNU_SOURCE

Replaces the local-only file:// darwin-patched tarball with a committable
GitHub fork pin (pgarciagon/koinos-exception-cpp) that declares
BOOST_STACKTRACE_GNU_SOURCE_NOT_REQUIRED before the Boost includes in
exception.hpp. This is one of the two macOS ARM64 gaps not yet covered by
this branch's committable config (the other is abseil, still under
investigation). Same fork-pin pattern as the fizzy and ZLIB entries; revert
to the canonical URL once the upstream koinos-exception-cpp PR merges.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
pgargo and others added 2 commits July 9, 2026 19:33
…corruption)

fizzy defaults to C++17 while koinos consumers build at C++20
(KoinosCompilerOptions). Verified from the built flags: fizzy compiled
-std=c++17, koinos-chain -std=c++20. That standard mismatch gives fizzy's
public types (Module and its nested std containers) a different ABI/layout
across the fizzy/consumer translation-unit boundary, corrupting memory at
runtime — observed as EXC_BAD_ACCESS (SIGBUS) in fizzy::Module::~Module
during module_cache teardown, and as the read_contract_tests baseline crash.

Pin CMAKE_CXX_STANDARD=20 for fizzy, matching abseil's existing entry and the
consumer standard. This is the real macOS ARM64 VM crash cause (NOT abseil
SSE, which this branch's earlier notes wrongly suspected — the pinned abseil
is arm64-safe, and the fault is EXC_BAD_ACCESS not EXC_BAD_INSTRUCTION).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@pgarciagon

Copy link
Copy Markdown
Author

Status update from native macOS ARM64 build work — two additional package fixes and one remaining runtime blocker beyond this PR's original four:

Added (committable, verified):

Cleared (not a problem):

  • abseil — the pinned 20230802.1 is already ARM64-safe (AbseilConfigureCopts.cmake uses -Xarch_ per-arch dispatch). No change needed. (An earlier suspicion that abseil x86 SSE copts caused a runtime crash was wrong — the fault is EXC_BAD_ACCESS, not EXC_BAD_INSTRUCTION.)

Remaining runtime blocker (macOS 26 SDK / libc++ 26):

Net: this PR + koinos_exception covers everything needed to build koinos-chain natively on macOS ARM64. Running the VM on the macOS 26 SDK additionally needs the fizzy type replacement.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants