Open-source project
root-project/cling avatar
root-project/cling

cling: no nightly binaries, three build paths, and a profiling recipe that is about to change

The cling C++ interpreter

4,209 stars313 forksC++NOASSERTION

At a glance

What is it?
cling is an interactive C++ interpreter built as a small extension to LLVM and Clang, and its readme tells you to build it: nightly binaries are currently unavailable, and there are two supported ways to produce it, standalone against an existing compiler build or as a target inside that build. Its profiling instructions come in two forms because a linker mode is about to become the default, and its contribution terms transfer copyright to whoever merges your code.
Who is it for?
Use cling if you want to type C++ at a prompt with the compiler's own diagnostics in front of you, and if you have, or can build, the matching compiler version. Two things to know before you start.
Can I use it commercially?
Check first. The repository uses a licence we do not classify automatically, so read its LICENSE file before any commercial use.
Is it still maintained?
Yes. The repository last received commits 3 days ago.
What is it written in?
Mainly C++, according to GitHub's language statistics.

Answers come from the project's GitHub data, last synced on November 15, 2026, and from our analysis. They are not legal advice.

From daily snapshots

Star history

  • root-project/cling4,209 ★ · +14
Star history
Repository2026-09-242026-11-15
root-project/cling4.2k4.2k

14 Stars in the last 52 days, measured from the daily GitHub snapshot. Compare with other projects

Editorial analysis

Nightly binaries are unavailable, so the build is the install

The installation section is three paragraphs long, and the middle one is the reason the other two are long.

There is a link to release notes for what is new. Then the sentence that decides everything else: nightly binary snapshots are currently unavailable.

So there is no download-and-run path. Everything after that is a source build, and the readme points at separate build instructions hosted on the project's own website before giving the commands.

Those commands come in two shapes. One builds the compiler first, from the project's fork of the compiler sources on a branch named for cling, then builds cling against the result. The other asks the compiler build to include cling as an external project, which the readme marks as recommended.

Both begin with a clone of the fork and a checkout of that branch, which tells you something important: cling is versioned against a specific compiler state rather than against a released compiler version. The compiler branch is named for cling, and the version it carries is the one that works.

A fourth, smaller path exists for notebooks and is a build target rather than a separate build.

The recommended build folds cling into the compiler build

The recommended configuration is one CMake invocation with two extra-project variables in it.

bash
cmake -DLLVM_EXTERNAL_PROJECTS=cling -DLLVM_EXTERNAL_CLING_SOURCE_DIR=../cling/ -DLLVM_ENABLE_PROJECTS="clang" -DLLVM_TARGETS_TO_BUILD="host;NVPTX" -DCMAKE_BUILD_TYPE=Release ../llvm-project/llvm
cmake --build . --target clang cling

The first line tells the compiler build system that cling is an external project and where its source is. The second builds two named targets rather than everything, so you get the compiler and the interpreter and nothing else.

The standalone route is different in shape. You configure cling against an existing compiler build by passing the prefix path and the directory holding the compiler's CMake modules.

bash
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH=../llvm-build -DLLVM_DIR=../llvm-build/lib/cmake/llvm ../cling

Two paths to the same compiler build, and the readme gives an example line with relative directories so you can copy it rather than construct it.

One constraint is stated in the standalone instructions, as a note rather than as an error message: you must be outside the compiler source and build directories, because none of the three components allows being built inside its own source tree.

Notebooks are a build target plus a kernel installer

Jupyter support is described as three steps rather than a feature list.

First, build a target. After building cling, run the build system with the Jupyter library target, and that produces the kernel library.

bash
cmake --build . --target libclingJupyter

Second, install Jupyter and cling's own kernel by following the readme in a tools directory inside the repository.

Third: make sure cling is on your PATH when you start Jupyter.

So there are two installations to keep in step: the interpreter you built and configured, and the kernel you installed from the tools directory.

Debugging and profiling are two environment variables with a cost

Interpreted code is not compiled ahead of time, so making a debugger work on it needs a switch, and the readme is direct about that.

Setting the debug variable to one enables debug symbol emission on interpreted code, which allows the use of a standard debugger. The guidance adds that debugging is aided by switching off optimisations and adding frame pointers for better stack traces.

That second half matters more than it looks. Optimised code with inlined frames will give you a stack trace that does not match your source, so the advice is to trade speed for line numbers.

Profiling is the same shape. Setting the profile variable to one enables performance profiling, and the readme says plainly that both features have a runtime cost and are therefore disabled by default.

That is the design decision worth noting: on-the-fly debugging is off unless you ask, because an interpreter used for exploration should not pay for instrumentation nobody is looking at. The cost is that anyone debugging a production run has to know the two variable names.

The profiling recipe changes when jitlink becomes the default

There are two sets of profiling instructions in the readme, and they exist because of a linker mode that is about to change.

When that mode is enabled, profiling requires an extra step between recording and reporting.

bash
perf record -k 1 <cling>
perf inject -j -i perf.data -o perf.jitted.data
perf report -i perf.jitted.data

Record the run with `-k 1`, inject the JIT-compiled code map into the data file, then report on the result. That is three commands where most people expect two.

When the mode is disabled, the readme says profiling is enabled with the legacy performance map instead of a JIT dump, and there is no need for an inject step.

And then the parenthetical that makes this a schedule rather than a footnote: the mode is described as soon being the default.

So the three-command recipe is the future and the two-command one is the past, and both are documented today with no deprecation date. Anyone writing a profiling script against cling should record which mode it assumes.

Contributions are donations and copyright goes to the merger

The contribution section is the most unusual document in this readme, and it is worth reading before you send a patch.

Every contribution is considered a donation, and its copyright and any other related rights become exclusive ownership of the person who merged the code, or in any other case of the main developers of the project.

So there is no separate agreement to sign and no individual contributor agreement file in the repository. The transfer happens by the act of contributing, and the recipient is determined by who merged the patch.

Credit is handled in three places: a contributors page, the release notes, and a credits file that is shipped with every binary and source distribution.

The justification given is legal rather than ideological: the copyright transfer is necessary for the project to be able to defend itself effectively in case of litigation. That is a coherent reason.

The practical consequence for a contributor is that you cannot later relicense your own patch, and you should read the terms before writing something you intend to keep.

The release checklist still tags v0.x

The last section lists the steps for cutting a release, and it is written for a version numbering scheme the project has moved past.

The steps are sensible: update the release notes, remove the development suffix from the version file, add a news entry on the project website, commit, tag the release, and then tag a matching patch branch in the compiler repository.

bash
git tag -a v0.x -m "Tagging release v0.x"

Two observations. The tag format written here is a zero-major version, while the releases in the repository are numbered one point three, one point two and one point one. And the second tag is not in this repository at all: it goes on the compiler project with its own prefix, because cling ships patches to the compiler that have to be identifiable.

Those patches are visible in the tree. There is a patches directory at the top level, alongside the usual include, library, tools, test and documentation directories, plus a file recording the last known good compiler revision from when that project used a different version control system.

The version file's development suffix is the other moving part: the release process is defined as removing it, which means the file in the repository is expected to carry it most of the time.

Editorial conclusion

Use cling if you want to type C++ at a prompt with the compiler's own diagnostics in front of you, and if you have, or can build, the matching compiler version. Two things to know before you start. There are no nightly binaries, so installation means a source build, and the two supported routes differ in who builds what: one asks for an existing LLVM build, the other folds cling into the compiler build itself. And the debugging and profiling switches are off by default because they cost performance, so you opt in per run with environment variables. If you intend to contribute, read the contribution terms first, because copyright in your patch goes to whoever merges it and credit is recorded in a file shipped with every distribution. Pin the version rather than tracking the branch the build instructions name.

Frequently asked questions

how to install cling?

Build it from source. The readme states that nightly binary snapshots are currently unavailable, and gives two supported routes: build cling against an existing LLVM and Clang installation, or build it as an external project inside the compiler build, which is the recommended option. Both start from the project's compiler fork on a branch named for cling.

What is cling?

It is an interactive C++ interpreter built on Clang and LLVM, implementing a read-eval-print loop for rapid application development. It is implemented as a small extension to the two compiler projects so it can reuse their strengths, including their concise and expressive diagnostics.

How do I run a one-line C++ program in cling?

Pass the code as arguments to the built binary, as in an include directive followed by a print statement. If cling was built as a standalone project you also need to point it at the include directory; if it was built as part of the compiler build you do not.

How do I debug code running in cling?

Set the debug environment variable to one, which enables debug symbol emission on interpreted code so a standard debugger can be used. The readme notes that debugging is aided by switching off optimisations and adding frame pointers for better stack traces, and that both debugging and profiling carry a runtime cost and are disabled by default.

How do I profile code running in cling?

Set the profile environment variable to one. When the JIT linker mode is enabled, which the readme says will soon be the default, you also need a perf inject step between recording and reporting; when it is disabled, profiling uses the legacy map path and needs no inject step.

What are the contribution terms for cling?

Every contribution is considered a donation, and its copyright becomes exclusive ownership of whoever merges the code or of the main developers. Credit is recorded on a contributors page, in the release notes, and in a credits file shipped with every binary and source distribution. The stated reason for the transfer is the ability to defend the project in litigation.

Official sources

  1. Issues
  2. README
  3. Releases
  4. root-project/cling on GitHub
Add this badge to your README

If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.

Add this badge to your README

markdown
[![Hysen Labs](https://hysenlabs.com/badge/root-project-cling.svg)](https://hysenlabs.com/projects/root-project-cling)

Star history chart for your README

markdown
[![Star history](https://hysenlabs.com/chart/root-project-cling.svg)](https://hysenlabs.com/projects/root-project-cling)

Was this useful?