fix: make delivery_module cross-compile for Windows - #85
Draft
dlipicar wants to merge 1 commit into
Draft
Conversation
Two portability defects, both found by cross-building the module for x86_64-w64-mingw32 and both invisible on Linux/macOS. nix.packages.runtime declared `postgresql` -- the server -- which has no mingw build in nixpkgs, so evaluation hard-failed on meta.platforms before anything compiled. The module never links or loads the server; it dlopens libpq. Declaring `libpq` is narrower and more correct on every platform, and drops the server from the closure entirely. currentTimestampNs() used clock_gettime(CLOCK_REALTIME), of which mingw declares neither the function nor the constant. std::chrono::system_clock is the portable spelling of the same wall-clock reading and needs no platform branch; the translation unit is already built at -std=c++20. Verified on real Windows (10.0.26200, x86_64): the plugin loads into the logoscore daemon and `call delivery_module version` returns a result. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
dlipicar
marked this pull request as draft
August 14, 2026 12:30
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Two portability defects that stop
delivery_modulecross-compiling forx86_64-w64-mingw32. Both are invisible on Linux/macOS, and neither isWindows-specific in nature — one is arguably a correctness improvement on
every platform.
1.
nix.packages.runtimedeclaredpostgresql, notlibpqpostgresqlis the server, which has no mingw build in nixpkgs, so aWindows evaluation hard-failed on
meta.platformsbefore anything compiled:The module never links or loads the server — it
dlopens libpq, which iswhat
postInstallalready goes looking for viapkg-config --variable=libdir libpq. Declaringlibpqdirectly is narrower and more correct everywhere, anddrops the entire server from the closure.
2.
currentTimestampNs()used POSIXclock_gettimemingw declares neither
clock_gettimenorCLOCK_REALTIME:std::chrono::system_clockis the portable spelling of the same wall-clockreading, needs no platform branch, and the translation unit is already built at
-std=c++20. I swept the rest ofsrc/for other POSIX-isms (gettimeofday,<unistd.h>,<sys/*>,/tmp,$HOME) — clean.Verification
Cross-built for
x86_64-w64-mingw32and run on real Windows (10.0.26200,x86_64).
delivery_module_plugin.dllis a PE32+ DLL exportingqt_plugin_instance/qt_plugin_query_metadata_v2, loads into thelogoscoredaemon, and dispatches:Daemon log confirms the module's own C++ ran:
Linux and macOS are unaffected: the
libpqswap resolves to the samepkg-configlookup the module already performed, andstd::chronocompilesidentically.
Dependencies
Getting here also needed fixes outside this repo, which are not required for
this PR to be correct but are required to reproduce the Windows build:
logos-delivery— Windows cross support, plus an import library so consumerscan link the DLL rather than silently falling back to the static archive
(
liblogosdelivery.a), and FFI C bindings are never generated: genBindings() writes nothing without --experimental:vmopsDanger logos-messaging/logos-delivery#4121 (genBindings()emits nothing without
--experimental:vmopsDanger).logos-module-builder/logos-plugin-qt— stage an external library'sruntime DLL from
<drv>/bin, and implement the previously-inertincludemetadata field so
dlopened runtime deps such aslibpq.dllland beside theplugin (nothing else can find them: the Windows DLL walk is import-table
driven).
🤖 Generated with Claude Code