How to Install Cling?

How to Install Cling?

I am trying to install cling in Ubuntu 12.04. I thought that the proper way was to download the binaries, as they are available here, but the extracted folder looks like this:

~/Desktop/cling » ls      
bin  docs  include  lib  share

This requires, I think, to merge the directories content with some directories of my filesystem. I am not familiar with this method but it seems to me a bit dirty; how can I install it, upgrade it, delete it?

I was thinking about packaging it with a deb, but I never did one so I do not know if it is the correct way..

Is there a better way to install cling?

1

3 Answers

Cling now provides binary snapshots for Ubuntu (as well as Fedora and OSX) which you can find here

For example if you are on ubuntu 16 (or newer?):

sudo apt install -y wget unar
wget 
unar cling_2020-11-05_ROOT-ubuntu2004.tar.bz2
./cling_2020-11-05_ROOT-ubuntu2004/bin/cling
7

Ok, this is not a weekend project and apparently it needs too many stuff to be installed before operative. So, I haven't tested this myself, but is what the instructions says (+ some bits of Ubuntu):

Get the tools first, you need some other may be installed on your system, so to prevent this just:

sudo apt-get install build-essential zlib-bin zlib1g-dev subversion texinfo git

Now, create a directory empty to do your experiment:

mkdir ~/cling-clang
cd ~/cling-clang

This step will take a while if you have slow connection (please use one line at time):

svn co  llvm
cd llvm/tools
svn co  clang
git clone 
cd ..
cat tools/cling/patches/*.diff | patch -p0
cd ../llvm/projects
svn co  compiler-rt
cd ../..
mkdir build
cd build

Now start the fun. If nothing of the above failed you can continue:

../llvm/configure --enable-targets=host
make

This will build LLVM, Clang and Cling. There should be a package maintainer that do this stuff for Debian/Ubuntu, I tip my hat off. This will have the Cling built, but not installed. You may want to use checkinstall instead of sudo make install.

4

cling is now packaged for GNU Guix and Guix can be installed on top of any GNU/Linux distribution such as Ubuntu.

After you've gone through the binary installation of Guix as documented here: , you can install cling via:

$ guix install cling

And verify that it works with:

$ cling '#include <stdio.h>' 'printf("Hello World!\n");'
Hello World!

Hopefully that should save you some time compared to building Cling/LLVM from source.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

David Miller
Author

David Miller

David Miller brings 15 years of experience in global economics, personal finance strategy, and market dynamics. He specializes in turning complex economic trends into actionable insights for everyday readers.