Giter VIP home page Giter VIP logo

Comments (5)

SylvainCorlay avatar SylvainCorlay commented on July 23, 2024

In modern cmake, target_link_libraries is also used for header-only libraries. If it cannot find it, it will assume that you are trying to link with a runtime called nlohmann_json whichbis whatbis happening here.

nlohmann_json and other dependencies should be installed with cmake in the same prefix (-D CMAKE_INSTALL_PREFIX).

Is this how you installed nlohmann_json?

from xeus.

sdwfrost avatar sdwfrost commented on July 23, 2024

I install nlohmann_json as follows, without specifying a prefix, as I did with the other dependencies:

git clone https://github.com/nlohmann/json && \
    cd json && \
    cmake . && \
    make && \
    make install

This installs into /usr/local:

-- Installing: /usr/local/include/nlohmann
-- Installing: /usr/local/include/nlohmann/json.hpp
-- Installing: /usr/local/lib/cmake/nlohmann_json/nlohmann_jsonConfig.cmake
-- Installing: /usr/local/lib/cmake/nlohmann_json/nlohmann_jsonConfigVersion.cmake
-- Installing: /usr/local/lib/cmake/nlohmann_json/nlohmann_jsonTargets.cmake

from xeus.

SylvainCorlay avatar SylvainCorlay commented on July 23, 2024

Ok, then /usr/local is your prefix!
(This should work with master, but we generally recommend to not use the tip of master for any software, but at least the latest released tag).

When building xeus, could you do

cmake -D CMAKE_INSTALL_PREFIX=/usr/local and report the outcome?

from xeus.

sdwfrost avatar sdwfrost commented on July 23, 2024

I get the same:

/usr/bin/x86_64-linux-gnu-ld: cannot find -lnlohmann_json
collect2: error: ld returned 1 exit status
CMakeFiles/xeus.dir/build.make:435: recipe for target 'libxeus.so.1.0.1' failed
make[2]: *** [libxeus.so.1.0.1] Error 1
make[1]: *** [CMakeFiles/xeus.dir/all] Error 2
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/xeus.dir/all' failed
Makefile:129: recipe for target 'all' failed

You can see the full list within a Dockerfile I'm working on:

https://github.com/sdwfrost/polyglot-playground/blob/master/Dockerfile

from xeus.

SylvainCorlay avatar SylvainCorlay commented on July 23, 2024

@sdwfrost I figured it out. The latest release of nlohmann_json made a backward incompatible change by adding a namespace to its cmake target names.

Cf. issue nlohmann/json#1243 and commit nlohmann/json@33a2154.

I am updating xeus to use the latest nlohmann_json and these target names.

from xeus.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.