Compiling Easyrpg Tools on Debian 10 amd64 fails because of an nlohmann_json

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:


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
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.

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

  • Trivial integration. Our whole code consists of a single header file 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?

1 Like

Debian again with there ancient packages :confused: 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.

1 Like

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
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. (3.1 KB)

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?

I just checked this. The following packages look correct:

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

1 Like