Skip to content

Comments

macOS: portability + RPC in-proc fallback#55

Open
SoumojitDalui wants to merge 5 commits intomakodb:mako-devfrom
SoumojitDalui:mako-dev
Open

macOS: portability + RPC in-proc fallback#55
SoumojitDalui wants to merge 5 commits intomakodb:mako-devfrom
SoumojitDalui:mako-dev

Conversation

@SoumojitDalui
Copy link

TL;DR

This PR adds macOS support (including Apple Silicon) while preserving Linux behavior. It vendors yaml-cpp, gates Linux-only features behind build flags, and adds an in-process RPC fallback so the existing CI/tests run reliably on macOS.

Details

CMake / Dependencies

  • Make libdpdk optional so macOS can configure without it.
  • Add Homebrew include/lib discovery (/opt/homebrew and /usr/local).
  • Vendor yaml-cpp from dependencies/yaml-cpp and link yaml-cpp::yaml-cpp into txlog, executables, and tests.
  • Add ENABLE_ERPC / ENABLE_RPC toggles; default ENABLE_ERPC=OFF on macOS; compile/link eRPC only when enabled.
  • Avoid linking Linux-only libs on macOS (-lnuma, -lrt, and -lboost_system).

NUMA (Linux kept, macOS stubbed)

  • Add src/compat/numa.h and use it on macOS so code including <numa.h> compiles without libnuma.

macOS / Apple Silicon portability

  • Guard Linux-only headers (<sys/sysinfo.h>).
  • Replace fdatasync() with fsync() on macOS.
  • Handle missing MADV_HUGEPAGE.
  • Use malloc/malloc.h on macOS where malloc.h is unavailable.
  • Replace memalign() with posix_memalign() on macOS.
  • Guard x86-only headers/instructions and add ARM-friendly fallbacks for “pause/yield” and cycle counters (mach_absolute_time() / cntvct_el0).

RPC: in-process fallback for macOS restrictions

  • Add src/rrr/rpc/inproc_transport.* and integrate it into client/server.
  • If bind() fails with EPERM, server registers an in-process endpoint and clients connect via socketpair() (no TCP bind/listen).
  • Set SO_NOSIGPIPE on macOS sockets to prevent SIGPIPE termination.
  • Skip TCP keepalive configuration for in-process connections.

Reactor fixes

  • Reduce kqueue wait timeout.
  • Fix coroutine cleanup edge case and a timeout boundary condition.
  • Make Fiber::sleep(0) return immediately.

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.

1 participant