# Cling 1.1 for Ubuntu 22.04 and 24.04

**URL:** <https://root-forum.cern.ch/t/cling-1-1-for-ubuntu-22-04-and-24-04/61764>\
**Category:** Cling\
**Created:** [September 23, 2024, 10:53pm UTC](https://root-forum.cern.ch/t/cling-1-1-for-ubuntu-22-04-and-24-04/61764 "2024-09-23T22:53:34Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![dimitry\_ishenko](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/d/7ab992/32.png) [@dimitry\_ishenko](https://root-forum.cern.ch/u/dimitry_ishenko)\
**Post date:** [September 23, 2024, 10:53pm UTC](https://root-forum.cern.ch/t/cling-1-1-for-ubuntu-22-04-and-24-04/61764/1 "2024-09-23T22:53:35Z")

</div>

For my fellow Ubuntu users out there, I’ve created native (.deb) Ubuntu packages for **cling** 1.1.

🎉 🥁 🎉 🥁

They are located here: [ppa:ppa-verse/cling](https://launchpad.net/~ppa-verse/+archive/ubuntu/cling)

Installation is as easy as:

```sh
sudo add-apt-repository ppa:ppa-verse/cling
sudo apt install cling

```

(You may need to install `software-properties-common`, if your system can’t find the `add-apt-repository` command.)

The difference between these packages and the official way of building **cling** is that:

1. These packages are linked dynamically against patched versions of LLVM-16 (which is also provided by the PPA). This means the size of the **cling** binary is several times smaller than the official statically linked one.

2. Additionally, these packages provide a small wrapper script called `cliche`, which makes it very easy to pass arguments into your C++ scripts. Here is an example:

3. And… you can also run **cling** on your beloved Raspberry Pi. Installation instructions are slightly different:

4. Share and enjoy.

D-mo

---

<div class="post-metadata">

**Author:** ![vvassilev](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/v/f0a364/32.png) [@vvassilev](https://root-forum.cern.ch/u/vvassilev)\
**Post date:** [September 24, 2024, 7:25am UTC](https://root-forum.cern.ch/t/cling-1-1-for-ubuntu-22-04-and-24-04/61764/2 "2024-09-24T07:25:47Z")

</div>

Thank you for sharing. I was wondering how the wrapper is different from `cling "arg1" "arg2"`?

Very cool that things work now on Raspberry pi. If you are interested in sharing more information about your work please feel free to reach out via email to me and we can organize a talk.

---

<div class="post-metadata">

**Author:** ![prabhu634](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/p/ea666f/32.png) [@prabhu634](https://root-forum.cern.ch/u/prabhu634)\
**Post date:** [September 24, 2024, 7:47am UTC](https://root-forum.cern.ch/t/cling-1-1-for-ubuntu-22-04-and-24-04/61764/3 "2024-09-24T07:47:55Z")

</div>

Hi @dimitry_ishenko ,  
My Ubuntu version: 24.04

I followed the above steps as you have mentioned and installed CLING in my ubuntu machine.  
I get seg fault when upon launching CLING as below:  
**test@test-Z790-Taichi-Lite:~/Prabhu/CLING$ which cling**  
**/usr/bin/cling**  
**test@test-Z790-Taichi-Lite:~/Prabhu/CLING$ cling**  
**Segmentation fault (core dumped)**

test@test-Z790-Taichi-Lite:~/Prabhu/CLING$ ldd /usr/bin/cling  
linux-vdso.so.1 (0x00007ffcac7fe000)  
libLLVM-16.so.1 =\> /lib/x86\_64-linux-gnu/libLLVM-16.so.1 (0x00007bb4c4000000)  
libstdc++.so.6 =\> /lib/x86\_64-linux-gnu/libstdc++.so.6 (0x00007bb4c3c00000)  
libm.so.6 =\> /lib/x86\_64-linux-gnu/libm.so.6 (0x00007bb4ced61000)  
libgcc\_s.so.1 =\> /lib/x86\_64-linux-gnu/libgcc\_s.so.1 (0x00007bb4ced34000)  
libc.so.6 =\> /lib/x86\_64-linux-gnu/libc.so.6 (0x00007bb4c3800000)  
/lib64/ld-linux-x86-64.so.2 (0x00007bb4cee61000)  
libffi.so.8 =\> /lib/x86\_64-linux-gnu/libffi.so.8 (0x00007bb4ced26000)  
libedit.so.2 =\> /lib/x86\_64-linux-gnu/libedit.so.2 (0x00007bb4cecec000)  
libz.so.1 =\> /lib/x86\_64-linux-gnu/libz.so.1 (0x00007bb4cecd0000)  
libzstd.so.1 =\> /lib/x86\_64-linux-gnu/libzstd.so.1 (0x00007bb4c3f46000)  
libtinfo.so.6 =\> /lib/x86\_64-linux-gnu/libtinfo.so.6 (0x00007bb4cec9c000)  
libxml2.so.2 =\> /lib/x86\_64-linux-gnu/libxml2.so.2 (0x00007bb4c3a1e000)  
libbsd.so.0 =\> /lib/x86\_64-linux-gnu/libbsd.so.0 (0x00007bb4cec84000)  
libicuuc.so.74 =\> /lib/x86\_64-linux-gnu/libicuuc.so.74 (0x00007bb4c3400000)  
liblzma.so.5 =\> /lib/x86\_64-linux-gnu/liblzma.so.5 (0x00007bb4c3f14000)  
libmd.so.0 =\> /lib/x86\_64-linux-gnu/libmd.so.0 (0x00007bb4cb5f1000)  
libicudata.so.74 =\> /lib/x86\_64-linux-gnu/libicudata.so.74 (0x00007bb4c1600000)

Am I missing something here?

---

<div class="post-metadata">

**Author:** ![dimitry\_ishenko](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/d/7ab992/32.png) [@dimitry\_ishenko](https://root-forum.cern.ch/u/dimitry_ishenko)\
**Post date:** [September 24, 2024, 2:55pm UTC](https://root-forum.cern.ch/t/cling-1-1-for-ubuntu-22-04-and-24-04/61764/4 "2024-09-24T14:55:40Z")

</div>

> [@vvassilev](#):
>
> Thank you for sharing. I was wondering how the wrapper is different from `cling "arg1" "arg2"`?

@vvassilev let’s say you have a C++ script that you want to run with cling:

**script.cpp**

```cpp
#!/usr/bin/cling

#include <iostream>
auto name = "Vassil";
std::cout << "Hello " << name << std::endl;

```

Make it executable and now you can run it like so:

```sh
user@linux:~$ ./script.cpp 
Hello Vassil

```

What if you want to pass in the name as an argument to the script?

**Problem #1:** if you do this…

```sh
user@linux:~$ ./script.cpp Vassil
Hello Vassil
input_line_6:2:2: error: use of undeclared identifier 'Vassil'
 Vassil
 ^

```

… you get an error.

**Problem #2:** even if that worked, how do you access the args here?

```cpp
#!/usr/bin/cling

#include <iostream>
auto name = ???; // HOW DO I ACCESS THE ARGS?
std::cout << "Hello " << name << std::endl;

```

That’s where `cliche` comes in handy. It simply wraps the args into the `getargs()` macro and passes it to cling using the -D option. In other words, we change the script to this:

**script.cpp**

```cpp
#!/usr/bin/cliche

#include <array>
#include <iostream>
auto args = getargs();
std::cout << "Hello " << args[1] << std::endl;

```

And, now you can do this:

```sh
user@linux:~$ ./script.cpp Vassil
Hello Vassil

```

---

<div class="post-metadata">

**Author:** ![dimitry\_ishenko](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/d/7ab992/32.png) [@dimitry\_ishenko](https://root-forum.cern.ch/u/dimitry_ishenko)\
**Post date:** [September 24, 2024, 3:40pm UTC](https://root-forum.cern.ch/t/cling-1-1-for-ubuntu-22-04-and-24-04/61764/5 "2024-09-24T15:40:47Z")

</div>

> [@vvassilev](#):
>
> Very cool that things work now on Raspberry pi. If you are interested in sharing more information about your work please feel free to reach out via email to me and we can organize a talk.

To be honest, I didn’t do much other than merging your patched version of LLVM-16 with Ubuntu’s version, plus adding Debian packaging on top of cling, and sending it all to the Launchpad to be compiled on all platforms. 🙊 🙊 🙊

You can find my forks here:

> **[GitHub - dimitry-ishenko-cpp/llvm-toolchain-16: The LLVM Project is a collection of modular and...](https://github.com/dimitry-ishenko-cpp/llvm-toolchain-16)**
>
> The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.

> **[GitHub - dimitry-ishenko-cpp/cling: The cling C++ interpreter](https://github.com/dimitry-ishenko-cpp/cling)**
>
> The cling C++ interpreter

The cliche wrapper is in the debian folder. I will drop you an email in case you still want to discuss anything.

D-mo

---

<div class="post-metadata">

**Author:** ![dimitry\_ishenko](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/d/7ab992/32.png) [@dimitry\_ishenko](https://root-forum.cern.ch/u/dimitry_ishenko)\
**Post date:** [September 24, 2024, 3:57pm UTC](https://root-forum.cern.ch/t/cling-1-1-for-ubuntu-22-04-and-24-04/61764/6 "2024-09-24T15:57:07Z")

</div>

Try running from a different directory.

---

<div class="post-metadata">

**Author:** ![dimitry\_ishenko](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/d/7ab992/32.png) [@dimitry\_ishenko](https://root-forum.cern.ch/u/dimitry_ishenko)\
**Post date:** [September 25, 2024, 5:35pm UTC](https://root-forum.cern.ch/t/cling-1-1-for-ubuntu-22-04-and-24-04/61764/7 "2024-09-25T17:35:15Z")

</div>

Ubuntu 20.04 is now also supported.

---

<div class="post-metadata">

**Author:** ![system](https://root-forum.cern.ch/uploads/default/original/3X/e/f/efe4f24398fd8ffeb76bccb6ecc46d9d9c003376.png) [@system](https://root-forum.cern.ch/u/system)\
**Post date:** [October 9, 2024, 5:35pm UTC](https://root-forum.cern.ch/t/cling-1-1-for-ubuntu-22-04-and-24-04/61764/8 "2024-10-09T17:35:25Z")

</div>

Closed on October 9, 2024, 5:35pm UTC

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
