From eeb5cd327063cd59480bbf20a71e7314686904f6 Mon Sep 17 00:00:00 2001 From: Dario Gabriel Lipicar Date: Fri, 21 Aug 2026 15:51:14 -0300 Subject: [PATCH] fix(nix): propagate nlohmann_json, and stop pointing at a deleted file Two small follow-ups to the shared-runtime migration. PROPAGATE nlohmann_json. This repo re-exports the Qt host runtime headers, and two of them -- logos_provider_object.h and logos_qt_arg_decode.h -- include . Anything compiling against these includes therefore needs nlohmann on its include path whether or not it has ever heard of nlohmann. Consumers going through find_package(logos-qt-host) already get it: that package find_dependency's logos-protocol, which PUBLIC-links nlohmann_json. Consumers taking the include directory directly do not, and they exist. Set in TWO places, which is not redundant: symlinkJoin builds a NEW derivation and does not carry the propagation of the paths it joins. Consumers take the join, not the headers output, so setting it only on the latter reaches nobody -- measured, a consumer still failed until the join carried it too. WHAT THIS DOES NOT FIX, measured rather than assumed: a consumer that takes liblogos as a bare attribute and interpolates ''${logosLiblogos}/include has no dependency edge for propagation to travel along, so it still needs nlohmann in its own buildInputs. logos-module-viewer is that shape. DANGLING POINTER. The comment in src/CMakeLists.txt sent readers to logos-basecamp/cmake/LogosSharedFromDll.cmake, deleted in logos-basecamp#348 and logos-logoscore-cli#98. Now says where it went and why. nix build .#default PASS. Co-Authored-By: Claude Opus 5 --- flake.nix | 16 ++++++++++++++++ nix/include.nix | 18 ++++++++++++++++++ src/CMakeLists.txt | 4 +++- 3 files changed, 37 insertions(+), 1 deletion(-) diff --git a/flake.nix b/flake.nix index bef2b06..b2eac0b 100644 --- a/flake.nix +++ b/flake.nix @@ -192,15 +192,31 @@ includePortable = import ./nix/include.nix { inherit pkgs src logosSdk; inherit logosProtocolPkg logosQtSdk logosQtHost; common = commonPortable; }; # Combined package (dev) + # + # propagatedBuildInputs is set HERE as well as on the headers output, + # and that is not redundant: symlinkJoin builds a NEW derivation and + # does not carry the propagation of the paths it joins. Consumers take + # this join, not the headers output, so setting it only there reaches + # nobody -- measured, logos-module-viewer still failed with + # fatal error: nlohmann/json.hpp: No such file or directory + # until it was set on the join too. + # + # nlohmann is needed because this output re-exports the Qt host runtime + # headers, two of which (logos_provider_object.h, logos_qt_arg_decode.h) + # include . Consumers going through + # find_package(logos-qt-host) get it transitively; consumers taking the + # include directory directly do not. liblogos = pkgs.symlinkJoin { name = "logos-liblogos"; paths = [ bin lib include ]; + propagatedBuildInputs = [ pkgs.nlohmann_json ]; }; # Combined package (portable) liblogosPortable = pkgs.symlinkJoin { name = "logos-liblogos-portable"; paths = [ binPortable libPortable includePortable ]; + propagatedBuildInputs = [ pkgs.nlohmann_json ]; }; in { diff --git a/nix/include.nix b/nix/include.nix index c69f6b7..5db1b4c 100644 --- a/nix/include.nix +++ b/nix/include.nix @@ -8,6 +8,24 @@ pkgs.stdenv.mkDerivation { inherit src; inherit (common) meta; + + # This output RE-EXPORTS the Qt host runtime headers, and two of them -- + # logos_provider_object.h and logos_qt_arg_decode.h -- include + # . So anything compiling against these includes needs + # nlohmann on its include path, whether or not it has ever heard of nlohmann. + # + # Consumers that go through find_package(logos-qt-host) already get it: that + # package find_dependency's logos-protocol, which PUBLIC-links nlohmann_json. + # Consumers that take the include directory DIRECTLY -- logos-module-viewer + # uses find_library + raw -I, and it is not alone in that -- bypass CMake's + # propagation entirely and fail with + # + # fatal error: nlohmann/json.hpp: No such file or directory + # + # in a repo that never mentions nlohmann. Propagating it here fixes both + # shapes at the source rather than adding a dependency to each consumer that + # trips over it, which is a list that only grows. + propagatedBuildInputs = [ pkgs.nlohmann_json ]; # No build phase needed, just install headers dontBuild = true; diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index c8ac6d4..7ed8d8d 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -239,7 +239,9 @@ target_compile_definitions(logos_core PRIVATE LOGOS_CORE_LIBRARY) # WHAT DID NOT CHANGE is the invariant. The runtime must still exist exactly # once per process; it is now enforced by there being one shared library per # type rather than by one image absorbing everything. Consumers still empty -# their static archives (logos-basecamp/cmake/LogosSharedFromDll.cmake) so ld +# their static archives (that was logos-basecamp/cmake/LogosSharedFromDll.cmake, +# deleted in logos-basecamp#348 and logos-logoscore-cli#98 once they linked the +# shared libraries directly and had no second static copy left to suppress) so ld # cannot pull an archive member that would redefine an imported symbol, and # logos-basecamp/nix/symbol-gate.nix still asserts the result. #