Skip to content

Compilation error when building parse_v2.cpp #172

Closed

Description

@sarahec

While building for nixpkgs, we're encountering:

In file included from /nix/var/nix/builds/nix-build-python3.13-docling-parse-4.5.0.drv-0/b/source/app/parse_v2.cpp:3:
In file included from /nix/var/nix/builds/nix-build-python3.13-docling-parse-4.5.0.drv-0/b/source/src/v2.h:28:
In file included from /nix/store/5ibw2ya5h690yv3qs378x97q3ri7zjgg-nlohmann_json-3.12.0/include/nlohmann/json.hpp:40:
In file included from /nix/store/5ibw2ya5h690yv3qs378x97q3ri7zjgg-nlohmann_json-3.12.0/include/nlohmann/detail/input/binary_reader.hpp:29:
/nix/store/5ibw2ya5h690yv3qs378x97q3ri7zjgg-nlohmann_json-3.12.0/include/nlohmann/detail/input/json_sax.hpp:832:22: error: no matching conversion for functional-style cast from 'bool' to 'nlohmann::basic_json<>'
  832 |         auto value = BasicJsonType(std::forward<Value>(v));
      |                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

on Darwin:

-- cxx-compiler: /nix/store/l58v977vq4qy58m1bw60bzrpkywizz2b-clang-wrapper-21.1.1/bin/clang++
-- cxx-flags   :  -Wall -Wno-sign-compare -O3 -DROOT_PATH='"/nix/var/nix/builds/nix-build-python3.13-docling-parse-4.5.0.drv-0/b/source"'
-- cxx-standard: 20

on Linux:

-- cxx-compiler: /nix/store/dmypp1h4ldn0vfk3fi6yfyf5yxp9yz0k-gcc-wrapper-14.3.0/bin/g++
-- cxx-flags   :  -Wall -Wno-sign-compare -O3 -DROOT_PATH='"/build/source"'
-- cxx-standard: 20

nlohmann_json builds fine by itself and in many other packages, so we're not sure if this is triggered by something in v2.cpp beforehand.

Apologies for the limited information. Several of us have tried to resolve this and we're all stuck.

Activity

  1. sarahec commented on Oct 11, 2025

    @sarahec
    Author
  2. sarahec commented on Oct 11, 2025

    @sarahec
    Author

    Update: nlohmann_json 3.12.0 added many new conversions. From the release notes:

    Enhanced conversion macros: The conversion macros for arbitrary types now include several upgrades:
    All macros are templated, supporting json, ordered_json, and any other basic_json specialization. nlohmann/json#4597 nlohmann/json#2528 nlohmann/json#4377 nlohmann/json#2532 nlohmann/json#2843 nlohmann/json#3810 nlohmann/json#4608
    Derived classes can now be seamlessly converted to/from JSON using the new NLOHMANN_DEFINE_DERIVED_TYPE_* macros. nlohmann/json#4033 nlohmann/json#2199 nlohmann/json#4562

    And your code depends on these conversions. But it turns out they're not always being included (see JSON_ImplicitConversions

    I think our compiler setup on nixpkgs created the perfect storm to trigger teh nlohmann_json bug. It's not your issue and I'll close this now (for good).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions