sim590 / dpaste

A simple pastebin for light values (max 64KB) using OpenDHT distributed hash table (with support for encryption).
GNU General Public License v3.0
15 stars 4 forks source link

Can't find json.hpp #11

Closed yurivict closed 5 years ago

yurivict commented 5 years ago
/usr/ports/misc/dpaste/work/dpaste-0.3.3/src/main.cpp:40:10: fatal error: 'json.hpp' file not found
#include <json.hpp>
         ^~~~~~~~~~
1 error generated.

nlohmann-json has cmake files, they should be used to detect its header location.

FreeBSD 11.2 amd64

sim590 commented 5 years ago

I'm trying to resolve this at the moment and I found that the best solution among those proposed by upstream is to use the external configuration files. However, when I'm trying that on Debian, it complains about the following:

Could not find a package configuration file provided by "nlohmann_json"
with any of the following names:

    nlohmann_jsonConfig.cmake
    nlohmann_json-config.cmake

Even though, I call cmake -DCMAKE_MODULE_PATH=/usr/lib/cmake (which is where the files are installed according to my system), CMake still fails to configure. Therefore, I think there's a problem with the Debian package I have currently installed. You could try to build successfully using fixes from both #15 and #14 by visiting the nlohmann_json-test branch as mentioned in #15.

I will confirm my hypothesis by manually installing the lib and comment on the result.

sim590 commented 5 years ago

OK, so after playing a bit with this today, I have found that:

  1. Debian was not installing CMake configuration files in the right directory. I managed to override this by appending -DCMAKE_PREFIX_PATH=/usr/lib/cmake/ to cmake call. In december, I was using the wrong option, therefore I wasn't getting a consistent result. I have since then reported the bug in the Debian BTS.
  2. Since I'm developing this on Debian (which uses nlohmann_json 2.1.1) and that the CMake usage for nlohmann_json seems to have changed since, then I'm using the 2.1.1 way for now. Therefore, I cannot guarantee that this works with 3.2.0. Please, tell me if you manage to build with the version you're using if it is higher than 2.1.1. I will confirm therefore be able to confirm the highest version number I can support.

I have a fix in 7f648fc. It is now merged into master from #15 together with #14. Feel free to test this again and reopen the issue if it doesn't work with version 2.1.1.