Files
Library/docs/targets.md
T
faumaray b3c959b920 Windows: full module parity and runtime-qualified test suite
- Net/IO: Winsock sockets (UdpSocket, TlsClientStream, WebSocketClient),
  HttpServer port with a loopback wake socket replacing eventfd, and the
  select-based IO backend built on Windows (ws2_32).
- Net: implement StaticFileResolver::open_safe and OpenedStaticFile on
  Windows (reparse-point rejection plus canonical containment check on the
  opened handle) and widen native handles to intptr_t.
- Plugin: hot reload works on Windows by loading a fresh copy while the old
  DLL stays mapped; enable the reload, discovery and FSM service reload
  tests and retire the plugin file by rename instead of replacement.
- Update: activation pointer as a directory junction on Windows.
- Stacktrace: portable path comparison for wide native strings.
- Docs/targets: every module allowlisted on Windows; record the Wine run
  (2000 tests, 1977 passed, 23 skipped, 0 failed).
- CMake: add -Wa,-mbig-obj for GNU MinGW targets (COFF section limit).
- Async: fix the FuturePool stopped-after-close test to wait for the
  executor to release its admission slot instead of racing it.

Windows and Linux suites both pass: Windows 2000/1977/23 skips/0 failed,
Linux 2027/2023/4 skips/0 failed.
2026-12-06 14:56:26 +03:00

14 KiB

Target support

VoidLibrary is qualified per target profile: a platform, a compiler and standard library, the external dependencies that are expected to exist, and the set of modules that are expected to build there. The profile is detected from the toolchain at configure time, validated against the selected modules, and recorded in void-target-manifest.cmake (installed next to VoidConfig.cmake).

# Native Linux (default)
cmake -S . -B build -G Ninja -DVOID_ENABLE_TESTING=ON

# Force a profile for a qualification run (normally auto-detected)
cmake -S . -B build-wasm -G Ninja -DVOID_TARGET=wasm \
    -DVOID_ENABLED_MODULES="Core;Functional;Text;Data"

# Cross build (Windows client example)
cmake -S . -B build-mingw -G Ninja \
    -DCMAKE_TOOLCHAIN_FILE=cmake/toolchains/mingw-w64.cmake \
    -DVOID_ENABLED_MODULES="Core;Functional;Text;Data"

VOID_TARGET is auto by default. The recognized values are linux, linux-musl, windows and wasm; anything else fails at configure time with the list of known targets. cmake/Targets.cmake holds the allowlists and the validation rules.

Manifest

Every configure writes void-target-manifest.cmake:

Field Meaning
VOID_TARGET_MANIFEST_TARGET detected/forced profile (linux, linux-musl, windows, wasm)
VOID_TARGET_MANIFEST_TARGET_ORIGIN auto or the forced VOID_TARGET value
VOID_TARGET_MANIFEST_TRIPLE CMAKE_C_COMPILER -dumpmachine
VOID_TARGET_MANIFEST_SYSTEM_NAME / ..._SYSTEM_PROCESSOR CMake system identification
VOID_TARGET_MANIFEST_COMPILER_ID / ..._COMPILER_VERSION compiler tuple
VOID_TARGET_MANIFEST_CXX_STANDARD language standard
VOID_TARGET_MANIFEST_LINKAGE shared or static
VOID_TARGET_MANIFEST_REFLECTION C++26 reflection available (yes/no)
VOID_TARGET_MANIFEST_STD_EXPECTED <expected> available
VOID_TARGET_MANIFEST_SANITIZERS none, ASan, UBSan, TSan or a combination
VOID_TARGET_MANIFEST_TESTING VOID_ENABLE_TESTING
VOID_TARGET_MANIFEST_MODULES configured modules

Consumers can read it after find_package(Void):

include("${Void_DIR}/void-target-manifest.cmake")
message(STATUS "Void target: ${VOID_TARGET_MANIFEST_TARGET}")

Qualified tuples

Linux (qualified)

Item Value
Triple x86_64-unknown-linux-gnu (NixOS, glibc)
Compiler GCC 16.2.0 (dev cpp-gcc)
Standard library libstdc++ 16
CMake / generator CMake 4.5.0, Ninja 1.13.2
Language C++26, reflection yes (-freflection)
Dependencies Boost (headers/url/beast/asio), OpenSSL, SQLite3, Lua 5.4 (optional)
Modules all
Observed Testing;Core configure/build clean; ctest 3/3 (VoidTests, installed consumers, target qualification)

The Linux profile is the reference target: every module is allowed and the per-module platform code selects the native implementation.

Linux / musl (configure/build/install/consume qualified)

Item Value
Triple x86_64-alpine-linux-musl (Alpine 3.23.8, musl 1.2.5-r24)
Compiler Alpine GCC 15.2.0 (Clang accepted by the allowlist)
Standard library libstdc++ with musl 1.2.5
CMake / generator CMake 4.1.3, Ninja 1.13.2
Dependencies boost-dev 1.84.0, openssl-dev 3.5.10, sqlite-dev 3.53.4, lua5.4-dev 5.4.8, linux-headers from apk
Language C++26, reflection no (GCC 15), <expected> yes
Modules Async Binary Containers Core Crypto Data Functional FunctionalCoreFormatting IO IPC LogState Math Memory Net ObservabilityHooks Resilience Sqlite System SystemAsync Text Time
Observed RelWithDebInfo with -DVOID_WARNINGS_AS_ERRORS=ON and -DVOID_ENABLE_TESTING=OFF: configure detected linux-musl, build passed, cmake --install to a prefix succeeded, and the isolated TargetProfile consumer configured, linked, and ran (VoidTargetProfileConsumer 1/1) recording target=linux-musl triple=x86_64-alpine-linux-musl compiler=GNU-15.2.0 linkage=shared reflection=no. Test suite with -DVOID_ENABLE_TESTING=ON: 1226 tests, 1221 passed, 5 skipped, 0 failed

The test suite is qualified too: with VOID_ENABLE_TESTING=ON (modules Async Binary Containers Core Crypto Data Functional FunctionalCoreFormatting IO IPC LogState Math Memory Net ObservabilityHooks Resilience Sqlite System SystemAsync Testing Text Time) the Alpine 3.23 container build ran 1226 tests: 1221 passed, 5 skipped, 0 failed. Reflection-only tests are skipped through // @requires-reflection. The run also exposed a test bug in Net/HttpDuplex.cpp (recv_until consumed body bytes past the header marker); the helper now reads byte-wise and the duplex tests pass on musl and glibc.

Detection uses CMAKE_C_COMPILER -dumpmachine (or CMAKE_C_LIBRARY_ARCHITECTURE/CMAKE_C_FLAGS) matching musl. The profile is recognized and configured like Linux; musl-specific behaviour (subprocess /proc, dl, locale) must still be verified before claiming full support.

Windows (compile/install/consume + Wine runtime qualified)

Item Value
Triple x86_64-w64-mingw32
Compiler MinGW-w64 GCC 16.2.0
Standard library libstdc++ + mingw-w64 CRT (mcfgthread threading in the Nix wrapper)
CMake / generator CMake 4.5.0, Ninja 1.13.2
Language C++26, reflection yes
Runtime Wine 11.0 (wine64), no native Windows runner available
Modules all modules under src/ (VOID_WINDOWS_MODULES in cmake/Targets.cmake)
Observed configure, compile, cmake --install, consume (TargetProfile.exe linked); each module's suite is verified under Wine before it is allowlisted. Full allowlisted set in one Debug shared binary (MinGW-w64 GCC 16.2.0) under Wine 11: 2000 tests, 1977 passed, 23 skipped, 0 failed

Notes from the runtime run:

  • IO builds EpollDriver.cpp on every platform: it contains the Linux epoll backend and the Windows select-based backend. Windows also uses positional-file workers over the CRT; a native IOCP backend is still a separate task.
  • Configuration, Crypto, System and Archive are allowlisted and cross-compile; System links winmm for the Win32 audio backend. Archive's staging implementation keeps its POSIX logic and runs on Windows through a compatibility layer (StagedArchive.cpp): directory descriptors are synthetic path handles, file IO uses the CRT, and publication uses MoveFileExW without replace. The isolated archive worker has no rlimits there, and runtime verification under Wine is still pending.
  • Tests that only exercise POSIX APIs carry // @requires-posix and are skipped on Windows; the POSIX process helper is not built there.
  • DirectoryWatcher has a Windows backend based on ReadDirectoryChangesW (recursive handle, events delivered by a watcher thread); IO's native backend is still Linux-only (IOCP is a separate task).
  • Sqlite builds from the vendored amalgamation (third_party/sqlite) on every target, so it has no system dependency on any platform.
  • IPC uses a loopback TCP endpoint on Windows (the IO streams there are socket based) with the owning PID taken from the system TCP table and the user identity from the process token; the endpoint file is restricted to the current user. adopt_pipe_pair is not implemented on Windows yet, and the AF_UNIX/fork-based test and the session close-during-cancel test are skipped.
  • Update uses the Windows CRT for the staging download file (binary mode, _commit instead of fsync); its OpenSSL-signed feed fixtures are gated by // @requires-openssl, and the compressed-package fixture skips when the Archive backend has no LibArchive.
  • Net is fully allowlisted on Windows: UdpSocket, TlsClientStream and WebSocketClient use Winsock/WSAPoll, and HttpServer is ported to Winsock with a loopback wake socket replacing eventfd. The RPC family (RPC, DiscoveryRpc, MessagingRpc) and ShortUrlRemote therefore link on Windows too.
  • Stacktrace builds with Boost.Stacktrace's windbg backend on Windows, Security/SecurityAsync/ShortUrlStorage link the cross-built libsodium, and ShortUrlRemote links the Windows Net client/server.
  • Plugin hot-reload and discovery tests run on Windows: a new generation is loaded from a fresh copy while the old DLL stays mapped, and the plugin file is retired by rename instead of in-place replacement. The C ABI plugin fixtures remain POSIX-only, and the reload-under-load stress test is still gated.
  • Observability links after replacing the namespace-scope inline thread_local hook stack with a function-local thread_local accessor (MinGW emitted duplicate TLS init functions).
  • Test code is portable: POSIX-only descriptor assertions are guarded, the Log hardening test closes its ifstream before removing the file, and the subprocess-isolation test skips when current_executable_path() is not implemented (Windows has no subprocess isolation yet).
  • MinGW test builds use -Wa,-mbig-obj (added automatically for GNU targets): the Fsm hardening test TU exceeds the COFF section limit with the default object format.
  • Runtime observations come from Wine, not a native Windows runner; a Windows CI runner should confirm them.

The Nix MinGW wrapper needs the mcfgthread include/library paths explicitly:

MINGW=/nix/store/...-x86_64-w64-mingw32-gcc-wrapper-16.2.0/bin
MCFG=/nix/store/...-mcfgthread-x86_64-w64-mingw32-2.5.1/lib
MCFGINC=/nix/store/...-mcfgthread-x86_64-w64-mingw32-2.5.1-dev/include
cmake -S . -B build-mingw -G Ninja \
    -DCMAKE_SYSTEM_NAME=Windows \
    -DCMAKE_C_COMPILER="$MINGW/x86_64-w64-mingw32-gcc" \
    -DCMAKE_CXX_COMPILER="$MINGW/x86_64-w64-mingw32-g++" \
    -DCMAKE_C_FLAGS="-I$MCFGINC" -DCMAKE_CXX_FLAGS="-I$MCFGINC" \
    -DCMAKE_EXE_LINKER_FLAGS="-L$MCFG" \
    -DCMAKE_SHARED_LINKER_FLAGS="-L$MCFG"

A regular MinGW-w64 installation with winpthreads does not need those extra flags.

Browser / Wasm subset (qualified)

Item Value
Triple wasm32-unknown-emscripten
Compiler Emscripten 6.0.9 (Clang 22.1.8)
Standard library libc++ + Emscripten libc
CMake / generator CMake 4.5 via emcmake, Ninja, Node 24.22.3 as the test emulator
Language C++26 without reflection (VOID_HAS_CXX26_REFLECTION=no)
Modules Algorithms Binary Containers Core Data Functional LogState Math Memory Testing TestingMock Text Time Unicode
Observed library: configure, compile, install, consume and run under Node; tests: 901 tests, 895 passed, 6 skipped, 0 failed under Node

The allowlist is fail-closed: native networking (Net, RPC), processes and filesystem (System, SystemAsync), IPC, SQLite, plugins and anything that needs threads or reflection stay out. Do not add a module until it has been configured and compiled with emcmake.

Verified commands:

# Library subset
emcmake cmake -S . -B build-wasm -G Ninja -DCMAKE_BUILD_TYPE=Debug \
    -DCMAKE_CXX_SCAN_FOR_MODULES=OFF \
    -DVOID_ENABLE_TESTING=OFF \
    -DVOID_ENABLED_MODULES="Algorithms;Binary;Containers;Core;Data;Functional;LogState;Math;Memory;Testing;TestingMock;Text;Time;Unicode"
cmake --build build-wasm
cmake --install build-wasm --prefix "$PWD/build-wasm-install"

# Consumer (the install lives outside the Emscripten sysroot)
emcmake cmake -S tests/package/TargetProfile -B build-wasm-consumer -G Ninja \
    -DCMAKE_PREFIX_PATH="$PWD/build-wasm-install" \
    -DCMAKE_FIND_ROOT_PATH_MODE_PACKAGE=BOTH \
    -DCMAKE_CXX_SCAN_FOR_MODULES=OFF \
    -DVOID_EXPECTED_TARGET=wasm
cmake --build build-wasm-consumer
node build-wasm-consumer/void_target_profile_consumer.js

CMAKE_CXX_SCAN_FOR_MODULES=OFF avoids CMake's C++20 module dependency scanner calling Emscripten's emscan-deps, which is not shipped by every Emscripten package. CMAKE_FIND_ROOT_PATH_MODE_PACKAGE=BOTH is needed because the Emscripten toolchain restricts package lookup to its sysroot.

The test suite is qualified with pthreads, exception handling and a larger stack:

emcmake cmake -S . -B build-wasm-tests -G Ninja -DCMAKE_BUILD_TYPE=Debug \
    -DCMAKE_CXX_SCAN_FOR_MODULES=OFF \
    -DBUILD_SHARED_LIBS=OFF \
    -DCMAKE_CXX_FLAGS="-fexceptions -pthread" \
    -DCMAKE_EXE_LINKER_FLAGS="-fexceptions -pthread -sSTACK_SIZE=16777216 \
        -sINITIAL_MEMORY=134217728 -sALLOW_MEMORY_GROWTH=1 -sMAXIMUM_MEMORY=1073741824" \
    -DVOID_ENABLE_TESTING=ON \
    -DVOID_ENABLED_MODULES="Algorithms;Binary;Containers;Core;Data;Functional;LogState;Math;Memory;Testing;TestingMock;Text;Time;Unicode"
cmake --build build-wasm-tests
node build-wasm-tests/tests/VoidTests.js --no-color

Static linking (BUILD_SHARED_LIBS=OFF) is required for exception handling across the test binary; -fexceptions enables catching, -pthread enables the threading tests, and the stack/memory flags accommodate the deepest recursive tests.

Portable fallbacks added for libc++ without the C++23/26 pieces: Core/Publication uses a mutex-protected shared_ptr when __cpp_lib_atomic_shared_ptr is absent, and TestingMock uses an internal move-only function wrapper when __cpp_lib_move_only_function is absent.

Reflection-dependent test files are gated with // @requires-reflection (Core/Meta, Core/FlagsReflect, Data/CsvReflect, Data/Reflect*, Functional/ResultReflectionFormat, Testing/ContainerFixture, TestingMock/Reflect, Configuration/Fsm annotation tests) and are skipped when VOID_HAS_CXX26_REFLECTION is false, so a non-reflecting compiler no longer fails on scanner-generated registrations for functions hidden by #ifdef.

Runtime observations use Node; a browser runner should confirm them.

Sanitizers

Sanitizer builds are native-only qualification configurations, not target profiles: VOID_ENABLE_ASAN, VOID_ENABLE_UBSAN and VOID_ENABLE_TSAN instrument the host build and are recorded in the manifest. Production packages are built with sanitizers off. ASan+TSan is rejected; TSan is rejected on wasm.

Qualification test

tests/package/TargetQualification.cmake (ctest VoidTargetQualification) installs the build tree and:

  1. Consumes the install through tests/package/TargetProfile, asserting the manifest target/triple/compiler/linkage/reflection fields and running one Core behaviour.
  2. Rejects an unknown VOID_TARGET.
  3. Rejects a native module (IPC) and native networking (Net) on the wasm profile.
  4. Rejects a missing external dependency (Sqlite without SQLite3).
  5. Configures the pure wasm subset and asserts the manifest records wasm.