Skip to content

Instantly share code, notes, and snippets.

@bellbind
Created August 23, 2012 10:15
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bellbind/3435167 to your computer and use it in GitHub Desktop.
Save bellbind/3435167 to your computer and use it in GitHub Desktop.
[cling][llvm][clang][bash] building cling on ubuntu 12.04 amd64
#!/bin/bash
# build cling on ubuntu 12.04
# dependencies see: http://llvm.org/docs/GettingStarted.html#requirements
sudo apt-get install libtool dejagnu subversion python-all-dev expect texinfo \
perl autoconf automake make gcc g++ libstdc++6-4.6-dev libffi-dev \
bzip2 gzip tar sed grep binutils coreutils findutils zip unzip \
doxygen cmake ruby
export LANG=C # very important: build cling used svn "English" message output
ROOT=$HOME/exp/cling
PREFIX=$ROOT/usr
#GCCVER=4.6.3
#GCCARCH=x86_64-linux-gnu
GCCVER=$(ruby -e 'puts IO.popen("gcc --version").readlines[0].split[-1]')
GCCARCH=$(ruby -e 'puts IO.popen("gcc -v 2>&1").readlines[3].split[1]')
GCCINCS=(
/usr/include
/usr/include/$GCCARCH
/usr/include/c++/$GCCVER
/usr/include/c++/$GCCVER/$GCCARCH
#/usr/lib/gcc/$GCCARCH/$GCCVER/include
)
mkdir -p $ROOT
cd $ROOT
svn co -q http://llvm.org/svn/llvm-project/llvm/trunk llvm
cd llvm/tools
svn co -q http://llvm.org/svn/llvm-project/cfe/trunk clang
svn co -q https://root.cern.ch/svn/root/trunk/cint/cling
cd $ROOT/llvm/tools/clang/tools
svn co -q http://llvm.org/svn/llvm-project/clang-tools-extra/trunk extra
cd $ROOT/llvm/projects
svn co -q http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
cd $ROOT/llvm
cat tools/cling/patches/*.diff | patch -p0
cd $ROOT
mkdir build
cd build
../llvm/configure --prefix=$PREFIX --enable-optimized --enable-targets=all \
--enable-shared --enable-bindings --enable-libffi \
--with-c-include-dirs=$(IFS=":"; echo "${GCCINCS[*]}")
make -j2 LDFLAGS="-LRelease+Asserts/lib -lLLVM-3.2svn"
make -j2 LDFLAGS="-LRelease+Asserts/lib -lLLVM-3.2svn"
make install
@bellbind
Copy link
Author

use it with bash not sh

@MattRWallace
Copy link

I got a 404 for svn co -q https://root.cern.ch/svn/root/trunk/cint/cling.

I used git clone http://root.cern.ch/git/cling.git from the official instructions and it worked fine from there.

@john9631
Copy link

john9631 commented Jul 4, 2013

Matt, I think the issue is that the cint directory has been replaced by interpreter so now its:

https://root.cern.ch/svn/root/trunk/interpreter/cling/

The easiest way to do the install now (if it works) seems to be to download the binaries and copy them to your directory structure. I did this with Linux Mint 15 (Ubuntu 13.04 with a traditional (proper :)) desktop).

Simply download the 12.04 binaries from here.

@fasiha
Copy link

fasiha commented Jul 13, 2013

What about this tidbit in the cling instructions, "Check out the cling-compatible revision of clang and llvm, which can be found here"? Currently, this is supposed to be llvm r179269, but I'm not sure if I checked that revision out correctly (or how I can get it to check out the corresponding clang) because the patch step is failing :(. Sorry if this doesn't make sense, someone is talking into my ear (and not helping).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment