Search code examples
c++boostclingxeus-cling

How do I use boost with the xeus-cling jupyter kernel?


I'm running Pop!_OS (ubuntu derivative) and apt installed boost (libboost-all-dev) from the default repositories. I know it has installed properly since I can compile and run the simple boost odeint example with GCC.

However when I tried to run the same example inside a jupyter notebook using the zeus-cling kernel I got an error while including the odeint header. I can recreate the error while executing this code:

#pragma cling add_include_path("/usr/include")
#include <boost/numeric/odeint.hpp>

The error message I get is:

In file included from input_line_8:1:
In file included from /usr/include/boost/numeric/odeint.hpp:22:
In file included from /usr/include/boost/numeric/odeint/config.hpp:44:
In file included from /usr/include/boost/config.hpp:48:
In file included from /usr/include/boost/config/stdlib/libstdcpp3.hpp:78:
/usr/include/unistd.h:756:28: error: expected function body after function declarator
extern __pid_t fork (void) __THROWNL;
                           ^
/usr/include/unistd.h:869:11: fatal error: 'bits/getopt_posix.h' file not found
# include <bits/getopt_posix.h>
          ^~~~~~~~~~~~~~~~~~~~~
Interpreter Error: 

From what I understand bits/getopt_posix.h is a GCC only header, thus I think the problem might be because the boost headers are configuring themselves as if they are compiling under GCC instead of cling/clang.

So, how do I properly include boost in a xeus-cling jupyter notebook?


Solution

  • Ηi there,

    I ve been using boost (geometry) with xeus-cling kernel without any issues, so far. I install boost from conda forge (conda install boost -c conda-forge). I tried to include odeint.hpp without any issues on my cling environment:

    enter image description here

    ΒW Giorgos