180 lines
7.9 KiB
Markdown
180 lines
7.9 KiB
Markdown
# 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`).
|
|
|
|
```bash
|
|
# 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)`:
|
|
|
|
```cmake
|
|
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 (unqualified)
|
|
|
|
| Item | Value |
|
|
|------|-------|
|
|
| Triple | `x86_64-alpine-linux-musl` |
|
|
| Compiler | Alpine GCC 14.2+ or Clang 19+ |
|
|
| Standard library | libstdc++ (or libc++) with musl 1.2.5 |
|
|
| CMake / generator | CMake 4.0+, Ninja |
|
|
| Dependencies | `boost-dev`, `openssl-dev`, `sqlite-dev`, `lua5.4-dev` from apk |
|
|
| Modules | all (no allowlist) |
|
|
| Status | **not qualified**: no musl toolchain in the qualification environment |
|
|
|
|
Detection uses `CMAKE_C_COMPILER -dumpmachine` (or
|
|
`CMAKE_C_LIBRARY_ARCHITECTURE`/`CMAKE_C_FLAGS`) matching `musl`. The profile is
|
|
recognized and configured like Linux, but no Alpine build has been observed,
|
|
so musl-specific behaviour (subprocess `/proc`, `dl`, locale) must not be
|
|
assumed. Record the exact tuple before claiming support.
|
|
|
|
### Windows client (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 | `Algorithms Async Binary Containers Core Data Discovery Fsm Functional Log LogState Math Memory Messaging Observability ObservabilityHooks Scheduler Service Testing TestingMock Text Time Unicode` |
|
|
| Observed | configure, compile, `cmake --install`, consume (`TargetProfile.exe` linked); `VoidTests.exe` under Wine: **1364 tests, 1360 passed, 4 skipped, 0 failed** |
|
|
|
|
Notes from the runtime run:
|
|
|
|
- `IO` is **not** in the Windows allowlist. It builds, but its native backend
|
|
is Linux-only (`EpollBackend`); on Windows `Driver::create` returns
|
|
`IoErrorCode::unsupported` unless the mock backend is selected. A Windows
|
|
IO backend (IOCP) is a separate task.
|
|
- `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 need `-Wa,-mbig-obj`: 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:
|
|
|
|
```bash
|
|
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 (unqualified)
|
|
|
|
| Item | Value |
|
|
|------|-------|
|
|
| Triple | `wasm32-unknown-emscripten` |
|
|
| Compiler | Emscripten Clang (4.x) |
|
|
| Standard library | libc++ + Emscripten libc |
|
|
| CMake / generator | CMake 4.0+ via `emcmake`, Ninja |
|
|
| 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` |
|
|
| Status | **not qualified**: no Emscripten toolchain in the qualification environment |
|
|
|
|
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. ThreadSanitizer is rejected for
|
|
`wasm`. Do not add a module until it has been configured and compiled with
|
|
`emcmake`.
|
|
|
|
## 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`.
|