# Compiling Easyrpg Tools on Debian 10 amd64 fails because of an nlohmann\_json

**URL:** <https://community.easyrpg.org/t/compiling-easyrpg-tools-on-debian-10-amd64-fails-because-of-an-nlohmann-json/899>\
**Category:** Uncategorized\
**Created:** [December 19, 2020, 2:54am UTC](https://community.easyrpg.org/t/compiling-easyrpg-tools-on-debian-10-amd64-fails-because-of-an-nlohmann-json/899 "2020-12-19T02:54:05Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![bicyclesonthemoon](https://community.easyrpg.org/letter_avatar_proxy/v4/letter/b/278dde/32.png) [@bicyclesonthemoon](https://community.easyrpg.org/u/bicyclesonthemoon)\
**Post date:** [December 19, 2020, 2:54am UTC](https://community.easyrpg.org/t/compiling-easyrpg-tools-on-debian-10-amd64-fails-because-of-an-nlohmann-json/899/1 "2020-12-19T02:54:06Z")

</div>

Hello,  
I tried to compile the easyrpg tools. I need them to be able to obtain/convert game files.

I have successfully (but after some problem which I don’t remember any more) compiled multiple years ago on Debian 7 on old computer.

Today I want to do the same on new computer with Debian 10, amd64, lxde.

I successfully compiled the liblcf first. Using the ‘cmake’. I had to first install things like cmake, expat, etc. from package manager.  
Next, the tools themselves.  
This doesn’t work.

> ‘cmake’ method gives:  
> CMake Error at gencache/CMakeLists.txt:9 (find\_package):  
> By not providing “Findnlohmann\_json.cmake” in CMAKE\_MODULE\_PATH this  
> project has asked CMake to find a package configuration file provided by  
> “nlohmann\_json”, but CMake did not find one.
> 
> Could not find a package configuration file provided by “nlohmann\_json”  
> with any of the following names:
> 
> nlohmann\_jsonConfig.cmake  
> nlohmann\_json-config.cmake
> 
> Add the installation prefix of “nlohmann\_json” to CMAKE\_PREFIX\_PATH or set  
> “nlohmann\_json\_DIR” to a directory containing one of the above files. If  
> “nlohmann\_json” provides a separate development package or SDK, be sure it  
> has been installed.

autoreconf -i  
./configure  
is also problematic and gives:

> configure: error: Package requirements (nlohmann\_json) were not met:
> 
> No package ‘nlohmann\_json’ found
> 
> Consider adjusting the PKG\_CONFIG\_PATH environment variable if you  
> installed software in a non-standard prefix.
> 
> Alternatively, you may set the environment variables NLOHMANNJSON\_CFLAGS  
> and NLOHMANNJSON\_LIBS to avoid the need to call pkg-config.  
> See the pkg-config man page for more details.  
> configure: error: ./configure failed for gencache

So, apparently i need a nlohmann\_json.  
It was not described anywhere.  
I installed package nlohmann-json-dev  
This did not help.  
I could also choose nlohmann-json3-dev  
(I can have only 1 of them because conflict)  
This did not help either.

So I have the required thing now but I can’t compile anyway.

How do I make it possible?  
What should I do so that this apparently missing nlohmann\_json will be detected and the compilation will be successfull?

Thanks in advance.

---

<div class="post-metadata">

**Author:** ![bicyclesonthemoon](https://community.easyrpg.org/letter_avatar_proxy/v4/letter/b/278dde/32.png) [@bicyclesonthemoon](https://community.easyrpg.org/u/bicyclesonthemoon)\
**Post date:** [December 19, 2020, 9:27am UTC](https://community.easyrpg.org/t/compiling-easyrpg-tools-on-debian-10-amd64-fails-because-of-an-nlohmann-json/899/2 "2020-12-19T09:27:30Z")

</div>

I have now successfully compiled it but it was not a nice solution.  
I tried to find in internet how to deal with such case and I didn’t find anything that I could understand.  
But I checked what this nlohmann\_json thing even is and I found this text in readme.md:

> - **Trivial integration**. Our whole code consists of a single header file [`json.hpp`](https://github.com/nlohmann/json/blob/develop/src/json.hpp). That’s it. No library, no subproject, no dependencies, no complex build system. The class is written in vanilla C++11. All in all, everything should require no adjustment of your compiler flags or project settings.

A bit ironic, considering my situation.  
But I checked:  
the single file is in /usr/include/nlohmann/json.hpp  
The only use is in gencache/src/main.cpp:  
#include \<nlohmann/json.hpp\>

So I already have the one file in the place where it is expected by the one thing that needs it.  
Only the autoconfiguration stuf can’t deal with it for some reason.  
So instead of wasting any more time I simply removed any reference to nlohmann\_json from gencache/CmakeLists.txt (line 9 and 18).  
After this, the compilation was successfull.

The only question remains:  
How to do it the ‘correct’ and ‘intended’ way?

---

<div class="post-metadata">

**Author:** ![Ghabry](https://community.easyrpg.org/user_avatar/community.easyrpg.org/ghabry/32/121_2.png) [@Ghabry](https://community.easyrpg.org/u/Ghabry)\
**Post date:** [December 23, 2020, 11:01am UTC](https://community.easyrpg.org/t/compiling-easyrpg-tools-on-debian-10-amd64-fails-because-of-an-nlohmann-json/899/3 "2020-12-23T11:01:22Z")

</div>

Debian again with there ancient packages 😕 iirc nlohmann\_json received pkgconfig support quite late so your only option is CMake here.

You must use the nlohmann-json3 package with CMake. This should work. The other package is 2.x which is even older.

Can you check if you have a `/usr/lib/cmake/nlohmann_json` folder?

There should be a `nlohmann_jsonConfig.cmake` in it. Do you see the target `nlohmann_json::nlohmann_json` in there? If yes I have no idea tbh why it isn’t finding the package. Try deleting the `CmakeCache.txt` and the `CMakeFiles` before trying again.

---

<div class="post-metadata">

**Author:** ![bicyclesonthemoon](https://community.easyrpg.org/letter_avatar_proxy/v4/letter/b/278dde/32.png) [@bicyclesonthemoon](https://community.easyrpg.org/u/bicyclesonthemoon)\
**Post date:** [January 1, 2021, 5:30pm UTC](https://community.easyrpg.org/t/compiling-easyrpg-tools-on-debian-10-amd64-fails-because-of-an-nlohmann-json/899/4 "2021-01-01T17:30:35Z")

</div>

With `nlohmann-json3-dev`:  
`/usr/lib/cmake/` does not exist.  
Instead, there is `/usr/lib/x86_64-linux-gnu/cmake/` and `/usr/local/lib/cmake/`.  
None of them contains a `nlohmann_json/`.  
` cmake . -DCMAKE_BUILD_TYPE=Release` fails on line 9 of `gencache/CMakeLists.txt`.

With `nlohmann-json-dev`:  
`/usr/lib/cmake/` exists this time.  
`/usr/lib/cmake/nlohmann_json/` doesn’t.  
But there is  
`/usr/lib/cmake/nlohmann_jsonConfig.cmake`  
`/usr/lib/cmake/nlohmann_jsonConfigVersion.cmake`  
`/usr/lib/cmake/nlohmann_jsonTargets.cmake`  
I’m unable to answer if the target is defined there because I don’t have any experience with cmake files and don’t know how to read them. (I include the files at end of this post)  
` cmake . -DCMAKE_BUILD_TYPE=Release` fails on line 9 of `gencache/CMakeLists.txt` too.  
As I said before, I can compile if I remove nlohmann\_json from lines 9 and 18 of `gencache/CMakeLists.txt`.  
[cmak.zip](https://community.easyrpg.org/uploads/short-url/vGloiinPI2EGo8TKnSmpu9c3VXa.zip) (3.1 KB)

---

<div class="post-metadata">

**Author:** ![Ghabry](https://community.easyrpg.org/user_avatar/community.easyrpg.org/ghabry/32/121_2.png) [@Ghabry](https://community.easyrpg.org/u/Ghabry)\
**Post date:** [February 12, 2021, 11:52am UTC](https://community.easyrpg.org/t/compiling-easyrpg-tools-on-debian-10-amd64-fails-because-of-an-nlohmann-json/899/5 "2021-02-12T11:52:53Z")

</div>

Imo this is a packaging error on the debian side. The subfolder (nlohmann\_json) in lib/cmake must be there. Can you file this on the debian bugtracker?

---

<div class="post-metadata">

**Author:** ![Ghabry](https://community.easyrpg.org/user_avatar/community.easyrpg.org/ghabry/32/121_2.png) [@Ghabry](https://community.easyrpg.org/u/Ghabry)\
**Post date:** [March 15, 2021, 12:23pm UTC](https://community.easyrpg.org/t/compiling-easyrpg-tools-on-debian-10-amd64-fails-because-of-an-nlohmann-json/899/6 "2021-03-15T12:23:13Z")

</div>

I just checked this. The following packages look correct:

- [buster (stable)](https://packages.debian.org/buster/nlohmann-json3-dev) (libdevel): JSON for Modern C++  
3.5.0-0.1: all
- [buster-backports](https://packages.debian.org/buster-backports/nlohmann-json3-dev) (libdevel): JSON for Modern C++  
3.7.0-2~bpo10+1: all
- [bullseye (testing)](https://packages.debian.org/bullseye/nlohmann-json3-dev) (libdevel): JSON for Modern C++  
3.9.1-1: all
- [sid (unstable)](https://packages.debian.org/sid/nlohmann-json3-dev) (libdevel): JSON for Modern C++  
3.9.1-1: all

All other packages are broken. So nothing to fix here.
