How to install cling?

Solution 1:

Cling now provides binary snapshots for Ubuntu (as well as Fedora and OSX) which you can find here https://root.cern.ch/download/cling

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

sudo apt install -y wget unar
wget https://root.cern/download/cling/cling_2020-11-05_ROOT-ubuntu2004.tar.bz2
unar cling_2020-11-05_ROOT-ubuntu2004.tar.bz2
./cling_2020-11-05_ROOT-ubuntu2004/bin/cling

Solution 2:

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 http://llvm.org/svn/llvm-project/llvm/trunk llvm
cd llvm/tools
svn co http://llvm.org/svn/llvm-project/cfe/trunk clang
git clone http://root.cern.ch/git/cling.git
cd ..
cat tools/cling/patches/*.diff | patch -p0
cd ../llvm/projects
svn co http://llvm.org/svn/llvm-project/compiler-rt/trunk 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.