Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

conflict with installed nlohman/json #14634

Closed
1 task
KrisThielemans opened this issue Feb 8, 2024 · 5 comments
Closed
1 task

conflict with installed nlohman/json #14634

KrisThielemans opened this issue Feb 8, 2024 · 5 comments
Assignees
Labels

Comments

@KrisThielemans
Copy link

Check duplicate issues.

  • Checked for duplicates

Description

I have a compilation error in the case with an existing version of the nlohmann library

/home/runner/install/include/nlohmann/json.hpp:3435:8: error: redefinition of default argument for ‘class T’
 3435 | struct adl_serializer;
      |        ^~~~~~~~~~~~~~
In file included from /home/runner/work/SIRF-SuperBuild/SIRF-SuperBuild/build/sources/ROOT/graf3d/eve7/inc/ROOT/REveShape.hxx:15,
                 from /home/runner/work/SIRF-SuperBuild/SIRF-SuperBuild/build/sources/ROOT/graf3d/eve7/inc/ROOT/REveBox.hxx:15,
                 from /home/runner/work/SIRF-SuperBuild/SIRF-SuperBuild/build/sources/ROOT/graf3d/eve7/src/REveBox.cxx:12:
/home/runner/work/SIRF-SuperBuild/SIRF-SuperBuild/build/sources/ROOT/graf3d/eve7/inc/ROOT/REveElement.hxx:39:10: note: original definition appeared here
   39 | template<typename T = void, typename SFINAE = void>
      |          ^~~~~~~~
In file included from /home/runner/work/SIRF-SuperBuild/SIRF-SuperBuild/build/sources/ROOT/graf3d/eve7/src/REveBox.cxx:18:
/home/runner/install/include/nlohmann/json.hpp:3448:7: error: redefinition of default argument for ‘template<class U, class V, class ... Args> class ObjectType’
 3448 | class basic_json;

I believe this is cause by the fact that the installed version is v3.10.4 (which doesn't have json_fwd.h). Relevant bits of code:

I believe the latter is causing the problem: somehow the existing (old) json.h has been read, and then creates a conflict with this definition.

I think this work-around needs to be removed. Possibly the easiest is to just require a more recent version.

Reproducer

install old version and try to build ROOT

ROOT version

I tried with v6-28-12 and 3-13.-3 with gcc-11.

Installation method

compile from source

Operating system

Ubuntu 22.04

Additional context

There is no problem with v6-26-10

@bellenot
Copy link
Member

bellenot commented Feb 8, 2024

@linev might be interested, he fixed a couple of issue with nlohman/json in the past

@linev
Copy link
Member

linev commented Feb 9, 2024

Just to understand - is ROOT compiled with external or builtin nlohmann/json.hpp?

Strange that v3.10.4 makes problem.
ROOT builtin version is 3.10.5 and definitions in REveElement.hxx should be compatible with it.

@KrisThielemans
Copy link
Author

Just to understand - is ROOT compiled with external or builtin nlohmann/json.hpp?

I used default options, so builtin_nlohmannjson=OFF

Strange that v3.10.4 makes problem. ROOT builtin version is 3.10.5 and definitions in REveElement.hxx should be compatible with it.

yes, that's strange. I haven't checked the diff between 3.10.5 and 3.10.4.

@linev
Copy link
Member

linev commented Feb 9, 2024

And seems to be, starting from llvm13 and root 6.30 use of the json_fwd.h is no longer necessary.
Before interpreter always had problems to correctly parse nlohmann/json.hpp

I will do several more checks and probably just remove it's usage from master and 6.30 branches.

@linev
Copy link
Member

linev commented Feb 13, 2024

I remove usage of nlohmann/json_fwd.hpp in 6.30 branch.
Fix will be release with 6.30.06 version

@linev linev closed this as completed Feb 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants