Skip to content

Instantly share code, notes, and snippets.

@dsuess
Last active July 31, 2024 10:11
Show Gist options
  • Save dsuess/059b86ea55d639bb99175c9a8cd2ca3e to your computer and use it in GitHub Desktop.
Save dsuess/059b86ea55d639bb99175c9a8cd2ca3e to your computer and use it in GitHub Desktop.
xeus-cling C++ Jupyter kernel inside a docker container
FROM frolvlad/alpine-miniconda3
RUN conda install -y -c conda-forge bash jupyter jupyter_contrib_nbextensions
RUN conda install -y -c conda-forge xeus-cling xtensor
RUN mkdir /notebooks
@dsuess
Copy link
Author

dsuess commented Mar 20, 2019

Run using docker run --rm -p 8888:8888 --workdir /notebooks -it cling jupyter notebook --allow-root --ip 0.0.0.0

@tomssem
Copy link

tomssem commented Jan 6, 2021

Building image as:
docker build -t cling .
and running as above, when presented with the cell:
for(int i = 0; i < 10; ++i) ;
(under c++11/ 14/ 17) yields the error:

ERROR in cling::CIFactory::createCI(): cannot extract standard library include paths!
Invoking:
  LC_ALL=C x86_64-conda-linux-gnu-c++  -O3 -DNDEBUG -xc++ -E -v /dev/null 2>&1 | sed -n -e '/^.include/,${' -e '/^ \/.*++/p' -e '}'
Results was:
With exit code 0
input_line_1:1:10: fatal error: 'new' file not found
#include <new>
         ^~~~~
Warning in cling::IncrementalParser::CheckABICompatibility():
  Failed to extract C++ standard library version.

@mulderp
Copy link

mulderp commented Jan 24, 2021

The cling works with this miniconda version as base image:

 docker run -i -t continuumio/miniconda3 /bin/bash

@daviddwlee84
Copy link

Got similar error under C++11/ 14/ 17

FROM continuumio/miniconda3

RUN conda install -y -c conda-forge bash jupyter jupyter_contrib_nbextensions
RUN conda install -y -c conda-forge xeus-cling xtensor
RUN mkdir /notebooks
[I 10:08:03.305 NotebookApp] KernelRestarter: restarting kernel (5/5), new random ports
In file included from input_line_1:1:
In file included from /opt/conda/bin/../lib/gcc/../../x86_64-conda-linux-gnu/include/c++/10.4.0/new:40:
In file included from /opt/conda/bin/../lib/gcc/../../x86_64-conda-linux-gnu/include/c++/10.4.0/x86_64-conda-linux-gnu/bits/c++config.h:522:
/opt/conda/bin/../lib/gcc/../../x86_64-conda-linux-gnu/include/c++/10.4.0/x86_64-conda-linux-gnu/bits/os_defines.h:39:10: fatal error: 'features.h' file not found
#include <features.h>
         ^~~~~~~~~~~~
Replaced symbol atexit cannot be found in JIT!
Replaced symbol at_quick_exit cannot be found in JIT!
Error: signal 11:
/opt/conda/bin//xcpp(_Z7handleri+0x2b)[0x55a01fca406b]
/lib/x86_64-linux-gnu/libc.so.6(+0x3c050)[0x7fe28727f050]
/opt/conda/bin/../lib/libxeus-cling.so.0(_ZN5clang4Sema22MarkFunctionReferencedENS_14SourceLocationEPNS_12FunctionDeclEb+0x30)[0x7fe28d7da480]
[W 10:08:06.325 NotebookApp] KernelRestarter: restart failed
[W 10:08:06.326 NotebookApp] Kernel 821ba610-275d-47b4-bcaf-81f8700c5704 died, removing from map.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment