drogon icon indicating copy to clipboard operation
drogon copied to clipboard

cmake jsoncpp linking error

Open lotricekCZ opened this issue 4 months ago • 2 comments

Hi, I have a feeling that jsoncpp library is incorrectly called in a CMakeLists.txt, resulting in a linking errors, the issue being that due to case sensitivity in pkg-config, it is incapable of finding Jsoncpp and linking Jsoncpp_lib.

To Reproduce Steps to reproduce the behavior:

  1. Clone the repository
  2. mkdir build && cd build && cmake .. && make
  3. See error

Expected behavior Code/drogon library links successfully against jsoncpp library

Environments tested

  1. jsoncpp and jsoncpp-devel installed via dnf
  2. jsoncpp compiled from source (checked out to 1.9.6) https://github.com/open-source-parsers/jsoncpp

OS version: Fedora 39, 6.5.6-300.fc39.x86_64 gcc (GCC) 13.3.1 20240913 (Red Hat 13.3.1-3) cmake version 3.30.5 pkg-config --version 1.9.5

Additional context For me, the fix was rewriting the CMakeLists.txt lines 190 and 191 using lowercase (to jsoncpp and jsoncpp_lib respectively). In case of meeting the same issue, modifying the cmakelists should do the trick, but feel free to ping me.

lotricekCZ avatar Aug 03 '25 12:08 lotricekCZ

Installed jsoncpp and jsoncpp-devel Build jsoncpp from source, did make install Edited CMakeLists.txt in drogon root using lowercase from jsoncpp and lib Still seeing bunch of undef refs to Json::

cdeving avatar Oct 07 '25 15:10 cdeving

@cdeving They are a result of the fact, that Json Cpp builds against C++11, but the header auto-configures a feature that enables itself when C++17 (or newer) is used.

In my opinion, just revert commit https://github.com/open-source-parsers/jsoncpp/commit/60ccc1f5deb671e95d2a6cc761f6d03f3c8ade07 from jsoncpp. Or go into the installed header and remove the define for string view.

Or voice your concern here: https://github.com/open-source-parsers/jsoncpp/issues/1595

Fighter19 avatar Nov 25 '25 11:11 Fighter19