Attempting to use the JSON_DIAGNOSTICS flag with the json-schema-validator library causes link errors and makes the library un-usable.
The remedy is to use a json-schema-validator built with the JSON_DIAGNOSTICS flag enabled.
(Pull request to be raised shortly.)
This issue is not particular to the environment shown below. I have reproduced it in other environments as well.
I have attached a small example project to demonstrate the problem. The example project is the json-schema-validator/examples/json-schema-validate.cpp file out of the json-schema-validator repository at https://github.com/pboettch/json-schema-validator .
The JSON_DIAGNOSTICS flag affects the nlohmann_json library, which is in turn required and used by the nlohmann_json_schema_validator library. The JSON_DIAGNOSTICS flag is documented at https://json.nlohmann.me/api/macros/json_diagnostics/. In particular, note that it changes the size of the JSON structure, making it incompatible with any library built without the JSON_DIAGNOSTICS flag (such as nlohmann_json_schema_validator library).
Package and Environment Details
Package Name/Version: json-schema-validator/2.2.0
Operating System+version: Linux Ubuntu 22.04 (OS Independent)
This is the sample project that demonstrates the problem with the json-schema-validator library and the JSON_DIAGNOSTICS flag.
test-json-schema-diagnostics.tgz
Description
Attempting to use the JSON_DIAGNOSTICS flag with the json-schema-validator library causes link errors and makes the library un-usable.
The remedy is to use a json-schema-validator built with the JSON_DIAGNOSTICS flag enabled. (Pull request to be raised shortly.)
This issue is not particular to the environment shown below. I have reproduced it in other environments as well.
I have attached a small example project to demonstrate the problem. The example project is the json-schema-validator/examples/json-schema-validate.cpp file out of the json-schema-validator repository at https://github.com/pboettch/json-schema-validator .
The JSON_DIAGNOSTICS flag affects the nlohmann_json library, which is in turn required and used by the nlohmann_json_schema_validator library. The JSON_DIAGNOSTICS flag is documented at https://json.nlohmann.me/api/macros/json_diagnostics/. In particular, note that it changes the size of the JSON structure, making it incompatible with any library built without the JSON_DIAGNOSTICS flag (such as nlohmann_json_schema_validator library).
Package and Environment Details
Conan profile
[settings] arch=x86_64 build_type=Release compiler=gcc compiler.cppstd=gnu17 compiler.libcxx=libstdc++11 compiler.version=11 os=Linux
Steps to reproduce
conan install . --output-folder=build --build=missing cd build cmake .. -DCMAKE_TOOLCHAIN_FILE=conan_toolchain.cmake -DCMAKE_BUILD_TYPE=Release cmake --build .
Logs
Click to expand log
``` ben@red-bearded-flying-dragon:~/conan/testing/test-json-schema-diagnostics$ conan install . --output-folder=build --build=missing ======== Input profiles ======== Profile host: [settings] arch=x86_64 build_type=Release compiler=gcc compiler.cppstd=gnu17 compiler.libcxx=libstdc++11 compiler.version=11 os=Linux Profile build: [settings] arch=x86_64 build_type=Release compiler=gcc compiler.cppstd=gnu17 compiler.libcxx=libstdc++11 compiler.version=11 os=Linux ======== Computing dependency graph ======== json-schema-validator/2.2.0: Not found in local cache, looking in remotes... json-schema-validator/2.2.0: Checking remote: conancenter json-schema-validator/2.2.0: Downloaded recipe revision 19237e39bc303ab6f870c6c24f638ee7 nlohmann_json/3.11.2: Not found in local cache, looking in remotes... nlohmann_json/3.11.2: Checking remote: conancenter nlohmann_json/3.11.2: Downloaded recipe revision a35423bb6e1eb8f931423557e282c7ed Graph root conanfile.py: /home/ben/conan/testing/test-json-schema-diagnostics/conanfile.py Requirements json-schema-validator/2.2.0#19237e39bc303ab6f870c6c24f638ee7 - Downloaded (conancenter) nlohmann_json/3.11.2#a35423bb6e1eb8f931423557e282c7ed - Downloaded (conancenter) ======== Computing necessary packages ======== Requirements json-schema-validator/2.2.0#19237e39bc303ab6f870c6c24f638ee7:2965ddb9dee73c1edaf28905271712353828b54d#c7a1be4fa53ce03f6009b9f32ec45ec9 - Download (conancenter) nlohmann_json/3.11.2#a35423bb6e1eb8f931423557e282c7ed:da39a3ee5e6b4b0d3255bfef95601890afd80709#2d1a5b1f5d673e1dab536bed20ce000b - Download (conancenter) ======== Installing packages ======== -------- Downloading 2 packages -------- nlohmann_json/3.11.2: Retrieving package da39a3ee5e6b4b0d3255bfef95601890afd80709 from remote 'conancenter' nlohmann_json/3.11.2: Package installed da39a3ee5e6b4b0d3255bfef95601890afd80709 nlohmann_json/3.11.2: Downloaded package revision 2d1a5b1f5d673e1dab536bed20ce000b json-schema-validator/2.2.0: Retrieving package 2965ddb9dee73c1edaf28905271712353828b54d from remote 'conancenter' json-schema-validator/2.2.0: Package installed 2965ddb9dee73c1edaf28905271712353828b54d json-schema-validator/2.2.0: Downloaded package revision c7a1be4fa53ce03f6009b9f32ec45ec9 WARN: deprecated: Usage of deprecated Conan 1.X features that will be removed in Conan 2.X: WARN: deprecated: 'cpp_info.names' used in: json-schema-validator/2.2.0 WARN: deprecated: 'cpp_info.build_modules' used in: json-schema-validator/2.2.0 ======== Finalizing install (deploy, generators) ======== conanfile.py: Writing generators to /home/ben/conan/testing/test-json-schema-diagnostics/build conanfile.py: Generator 'CMakeToolchain' calling 'generate()' conanfile.py: CMakeToolchain generated: conan_toolchain.cmake conanfile.py: Preset 'conan-release' added to CMakePresets.json. Invoke it manually using 'cmake --preset conan-release' if using CMake>=3.23 conanfile.py: If your CMake version is not compatible with CMakePresets (<3.23) call cmake like: 'cmake