{"id":13713461,"url":"https://github.com/compiler-research/xeus-clang-repl","last_synced_at":"2025-05-06T23:32:03.572Z","repository":{"id":63874164,"uuid":"523819582","full_name":"compiler-research/xeus-clang-repl","owner":"compiler-research","description":null,"archived":false,"fork":false,"pushed_at":"2024-11-11T22:48:06.000Z","size":5286,"stargazers_count":36,"open_issues_count":16,"forks_count":14,"subscribers_count":8,"default_branch":"main","last_synced_at":"2025-04-27T14:23:18.066Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Jupyter Notebook","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/compiler-research.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2022-08-11T17:55:41.000Z","updated_at":"2025-01-01T07:41:18.000Z","dependencies_parsed_at":"2023-12-26T13:04:56.859Z","dependency_job_id":"11928efd-4299-4de3-992c-48c7f6ec3b41","html_url":"https://github.com/compiler-research/xeus-clang-repl","commit_stats":{"total_commits":94,"total_committers":11,"mean_commits":8.545454545454545,"dds":0.5957446808510638,"last_synced_commit":"a7d54b9cd0636c2ab53b9d35ec844eb234528482"},"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/compiler-research%2Fxeus-clang-repl","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/compiler-research%2Fxeus-clang-repl/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/compiler-research%2Fxeus-clang-repl/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/compiler-research%2Fxeus-clang-repl/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/compiler-research","download_url":"https://codeload.github.com/compiler-research/xeus-clang-repl/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252655179,"owners_count":21783414,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-02T23:01:36.940Z","updated_at":"2025-05-06T23:32:03.556Z","avatar_url":"https://github.com/compiler-research.png","language":"Jupyter Notebook","funding_links":[],"categories":["Jupyter Notebook"],"sub_categories":[],"readme":"## Try it online\n\nTo try out xeus-clang-repl interactively in your web browser, just click on the binder\nlink:\n\n[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/compiler-research/xeus-clang-repl/v0.2.0?labpath=notebooks/index.ipynb)\n\n### Xeus-Clang-REPL\n\n## Description\n\n`xeus-clang-repl` integrates clang-repl with the xeus protocol and is a platform for C++ usage in Jupyter Notebooks. The demo developed in this repository shows a Python - CPP integraton in Jupyter Notebooks, where variables can be transfered between Python and CPP.\n\n`Disclaimer: this work is highly experimental and might not work beyond the examples provided`\n\n## Installation\n\nxeus-clang-repl has not been packaged for the mamba (or conda) package manager.\n\nTo ensure that the installation works, it is preferable to install `xeus-clang-repl` in a\nfresh environment. It is also needed to use a\n[miniforge](https://github.com/conda-forge/miniforge#mambaforge) or\n[miniconda](https://conda.io/miniconda.html) installation because with the full\n[anaconda](https://www.anaconda.com/) you may have a conflict with the `zeromq` library\nwhich is already installed in the anaconda distribution.\n\nFirst clone the repository, and move into that directory\n```bash\ngit clone --depth=1 https://github.com/compiler-research/xeus-clang-repl.git\ncd ./xeus-clang-repl\n```\nThe safest usage of xeus-clang-repl is to build and install it within a clean environment named `xeus-cpp`. You can create and activate this environment \nwith mamba by executing the following\n```bash\nmamba create -n \"xeus-clang-repl\" python=3.10.6\nmamba activate \"xeus-clang-repl\"\n```\nWe will now install the dependencies needed to compile xeus-clang-repl from source within this environment by executing the following\n```bash\nmamba install --quiet --yes -c conda-forge \\\n                               cmake \\\n                              'xeus\u003e=2.0' \\\n                              xeus-zmq \\\n                              'nlohmann_json\u003e=3.9.1,\u003c3.10' \\\n                              'cppzmq\u003e=4.6.0,\u003c5' \\\n                              'xtl\u003e=0.7,\u003c0.8' \\\n                              'openssl\u003c4' \\\n                              ipykernel \\\n                              pugixml \\\n                              zlib \\\n                              libxml2 \\\n                              'cxxopts\u003e=2.2.1,\u003c2.3' \\\n                              libuuid \\\n                              pytest \\\n                              jupyter_kernel_test \nmamba install -y jupyter\n```\nWe are now in a position to be able to install xeus-clang-repl by executing the following\n```bash\ngit clone --depth=1 https://github.com/compiler-research/xeus-clang-repl.git\ngit clone --depth=1 -b release/17.x https://github.com/llvm/llvm-project.git\ncd llvm-project\ngit apply -v ../xeus-clang-repl/patches/llvm/clang17-*.patch\nmkdir build\ncd build\ncmake -DLLVM_ENABLE_PROJECTS=clang                  \\\n      -DLLVM_TARGETS_TO_BUILD=\"host;NVPTX\"          \\\n      -DCMAKE_BUILD_TYPE=Release                    \\\n      -DLLVM_ENABLE_ASSERTIONS=ON                   \\\n      -DLLVM_ENABLE_LLD=ON                          \\\n      -DCLANG_ENABLE_STATIC_ANALYZER=OFF            \\\n      -DCLANG_ENABLE_ARCMT=OFF                      \\\n      -DCLANG_ENABLE_FORMAT=OFF                     \\\n      -DCLANG_ENABLE_BOOTSTRAP=OFF                  \\\n      ../llvm\ncmake --build . --target clang clang-repl --parallel $(nproc --all)\nLLVM_BUILD_DIR=$PWD\ncd ../..\ngit clone --depth=1 https://github.com/compiler-research/CppInterOp.git\nmkdir CppInterOp/build\ncd  CppInterOp/build\ncmake -DBUILD_SHARED_LIBS=ON -DUSE_CLING=Off -DUSE_REPL=ON -DLLVM_DIR=$LLVM_DIR/build/lib/cmake/llvm -DClang_DIR=$LLVM_DIR/build/lib/cmake/clang ..\ncmake --build . --parallel $(nproc --all)\nCPPINTEROP_BUILD_DIR=$PWD\ncd ../../xeus-clang-repl\nmkdir build\ncd build\ncmake -DCMAKE_BUILD_TYPE=Release \\\n      -DLLVM_CMAKE_DIR=$LLVM_BUILD_DIR \\\n      -DCMAKE_PREFIX_PATH=$(conda info --base) \\\n      -DCMAKE_INSTALL_PREFIX=$(conda info --base) \\\n      -DCMAKE_INSTALL_LIBDIR=lib \\\n      -DLLVM_CONFIG_EXTRA_PATH_HINTS=$LLVM_BUILD_DIR/lib \\\n      -DCPPINTEROP_DIR=$CPPINTEROP_BUILD_DIR \\\n      -DLLVM_USE_LINKER=lld  \\\n      .. \ncmake --build . --target install --parallel $(nproc --all)\n```\n\n## Docker\nIt is possible to build xeus-clang-repl within a Docker container. On an arm based Apple machine with docker, docker-compose and colima installed, you can try out xeus-clang-repl using the following commands (cpu represents number of cores, and memory is in GiB, so adjust according to your machine)\n```bash\ngit clone https://github.com/compiler-research/xeus-clang-repl.git\ncd xeus-clang-repl\ncolima start --cpu 8 --memory 8 --arch aarch64 --vm-type=vz --vz-rosetta\nchmod a+x ./build-and-run-docker.sh\n./build-and-run-docker.sh\n```\nOnce the bash script finishes running, you can experiment with xeus-clang-repl by opening up your browser and visiting http://127.0.0.1:8888/lab\n\n\n## Try it online (for developers)\n\nTo try out xeus-clang-repl interactively in your web browser, just click on the binder\nlink (Warning! This is Nightly build):\n\n[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/compiler-research/xeus-clang-repl/HEAD?labpath=notebooks/index.ipynb)\n\n\n\u003cimg\n   src=\"./integration-demo-readme.png\"\n   alt=\"Alt text\"\n   title=\"Optional title\"\n   style=\"display: block; margin: 0 auto; max-width: 450px\"\u003e\n\n## Documentation\n\nTo get started with using `xeus-clang-repl`, The Documentation work is under Development.\n\n## Dependencies\n\n`xeus-clang-repl` depends on\n\n- [xtl](https://github.com/xtensor-stack/xtl)\n- [nlohmann_json](https://github.com/nlohmann/json)\n- [cppzmq](https://github.com/zeromq/cppzmq)\n- [clang](https://github.com/llvm/llvm-project/)\n- [cxxopts](https://github.com/jarro2783/cxxopts)\n\n|   `xeus-clang-repl`   |       `xtl`     |  `clang`  | `pugixml` | `cppzmq` | `cxxopts` | `nlohmann_json` | `dirent` (windows only) |\n|-----------------------|-----------------|-----------|-----------|----------|-----------|-----------------|-------------------------|\n|   \t~0.1.0 \t\t      |  \u003e=0.7.0,\u003c0.8.0 | \u003e=16,\u003c17  | ~1.8.1    | ~4.3.0   |  \u003e=3.0.0  |  \u003e=3.6.1,\u003c4.0   |    \u003e=2.3.2,\u003c3           |\n\n## License\n\nThis software is licensed under the `Apache License`. See the [LICENSE](LICENSE)\nfile for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcompiler-research%2Fxeus-clang-repl","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcompiler-research%2Fxeus-clang-repl","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcompiler-research%2Fxeus-clang-repl/lists"}