Skip to content

Add portable Windows, macOS, and Android backend support - #899

Open
amachado-pie wants to merge 12 commits into
canonical:mainfrom
amachado-pie:cross-portable
Open

Add portable Windows, macOS, and Android backend support#899
amachado-pie wants to merge 12 commits into
canonical:mainfrom
amachado-pie:cross-portable

Conversation

@amachado-pie

@amachado-pie amachado-pie commented Jul 1, 2026

Copy link
Copy Markdown

This PR refactors dqlite's Linux-specific paths into selectable portable backends so the project can build and validate on Windows, macOS, and Android while retaining optimized Linux backend options.

Summary

  • Add Autotools switches for VFS shared-memory and Raft I/O backend selection:
    • --with-vfs-shm=auto|linux-remap|portable
    • --with-raft-io=auto|portable|linux-kaio
  • Split the Raft writer into:
    • a default portable LibUV backend using uv_fs_write/uv_fs_close
    • an optional Linux-only KAIO backend
  • Add a portable heap-backed SQLite VFS shared-memory provider while keeping the Linux remap provider as the optimized Linux path.
  • Replace server synchronization and lifecycle primitives with LibUV equivalents.
  • Add Windows portability wrappers for sockets, address parsing, filesystem operations, locking, and test addresses.
  • Add Android portability fixes, including aligned Raft allocation without relying on aligned_alloc().
  • Add macOS/Darwin portability fixes for Apple SQLite hooks, TCP reset behavior, resolver interposition limits, filesystem helper APIs, and BSD qsort_r.
  • Gate or adapt platform-specific tests for Linux, Windows, macOS, and Android assumptions.
  • Add documentation for:
    • cross-platform porting and validation
    • Windows MinGW/Wine builds
    • Android NDK cross-builds
    • native macOS/Homebrew builds

Validation performed

  • Native Linux make check: 7/7 test programs passing.
  • Linux optional KAIO backend make check: 7/7 test programs passing.
  • Windows/MinGW build under Wine:
    • integration-test.exe non-stress: 127/127 passing, 1 skipped.
    • integration-test.exe stress/read_write: 45/45 passing, 3 skipped.
    • unit-test.exe: 75/75 passing, 3 skipped.
    • raft-core-unit-test.exe: 135/135 passing.
    • raft-core-integration-test.exe: 191/191 passing, 3 skipped.
    • raft-uv-unit-test.exe: 20/20 passing, 61 skipped.
    • raft-uv-integration-test.exe: 213/213 passing, 25 skipped.
    • raft-core-fuzzy-test.exe: 57/57 passing.
  • Native macOS make check: 7/7 test programs passing.
    • integration-test: 170/170 passing, 4 skipped.
    • raft-uv-unit-test: 24/24 passing, 57 skipped.
    • raft-uv-integration-test: 220/220 passing, 22 skipped.
    • raft-core-fuzzy-test: 57/57 passing.
  • Android NDK cross-build with NDK 27.2.12479018, API 24:
    • arm64-v8a: libdqlite.la builds successfully.
    • armeabi-v7a: libdqlite.la builds successfully.
  • git diff --check passes.

Benchmark notes

The portable stress/read_write benchmark was recorded for Linux portable, Windows/Wine portable, and native macOS portable builds using seed 0x5eed1234, one warmup iteration, and 10 measured iterations.

Scenario Linux portable wall Windows/Wine portable wall Windows delta macOS portable wall macOS delta
writers=0 readers=16 databases=1 6.71949480s 25.02570840s +272.43% 8.73973800s +30.07%
writers=1 readers=4 databases=1 8.03535353s 8.93448470s +11.19% 2.56766500s -68.05%
writers=4 readers=0 databases=1 28.66580590s 9.71652050s -66.10% 8.39178000s -70.73%

These numbers are intended as cross-platform validation data, not direct hardware or native Windows performance rankings.

Known follow-up

  • Add CI jobs for Linux portable/KAIO, Windows/Wine, macOS, and Android cross-build checks.
  • Add Android emulator/device smoke tests for storage, VFS, and TCP loopback.
  • Add native Windows runner coverage if suitable CI capacity is available.
  • Continue optimizing the portable heap-backed VFS provider for concurrent read workloads.

@amachado-pie amachado-pie changed the title Add portable Windows and Android backend support Add portable Windows, macOS, and Android backend support Jul 1, 2026
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