From e922be4ef4af2053b27fa755407aeae7d85c2b9c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Attila=20Ol=C3=A1h?= Date: Fri, 3 Apr 2026 22:24:04 +0200 Subject: [PATCH] fix: include order when building with -DCXXOPTS_USE_UNICODE MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This change fixes a bizarre build failure that happens when trying to build docling-parse with system cxxopts that define `CXXOPTS_USE_UNICODE`. The error causes implicit conversion from boolean types to fail, causing errors like this: ``` In file included from /build/docling_parse-5.7.0/src/parse.h:44, from /build/docling_parse-5.7.0/app/parse_fonts.cpp:17: /build/docling_parse-5.7.0/src/parse/config.h: In member function ‘nlohmann::json_abi_v3_12_0::json pdflib::decode_config::to_json() const’: /build/docling_parse-5.7.0/src/parse/config.h:60:58: error: no matching function for call to ‘nlohmann::json_abi_v3_12_0::basic_json<>::basic_json(const bool&)’ 60 | j["do_sanitization"] = nlohmann::json(do_sanitization); | ^ ``` Signed-off-by: Attila Oláh --- src/parse.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/parse.h b/src/parse.h index 3dfec2c7..5fd8e249 100644 --- a/src/parse.h +++ b/src/parse.h @@ -22,6 +22,9 @@ #endif // specific libraries +// NOTE: json.hpp must be included *before* cxxopts.hpp. +// See https://github.com/docling-project/docling-parse/pull/248 for details. +#include #include #define LOGURU_WITH_STREAMS 1 @@ -29,7 +32,6 @@ //#include #include -#include #define POINTERHOLDER_TRANSITION 0 // eliminate warnings from QPDF #include