Build/Install of LLVM without root access

Hi Folks,

I am trying to figure out how to install LLVM as a user on a *NIX machine rather than as root. Is there any reference to doing this successfully? I keep running into problems with locations not writeable or obsolete versions of tools on which LLVM is dependent.

Thank you for any pointers or references,

–Bryan Ewbank, Software Language Developer. www.sas.com

I haven’t installed newer versions of LLVM lately, but if you’re building LLVM with the configure script and make, all you should need to do is specify an install location that you have access to: ./configure --prefix= make – John T.

Hi Bryan,

Are you using source or binary distribution?

If source, try using configure with --prefix=/some/dir/you/have/write/access or the equivalent -DCMAKE_INSTALL_PREFIX=…

If binary, just unzipping the file to a local dir would be enough, if you call the binary with full path. Otherwise, put the bin directory in your path, and it should just work.

cheers,
–renato

I am using the source distribution, and the first puzzle is that it doesn’t seem to match with the installation instructions from svn. E.g., svn talks about llvm, cfe, compiler-rt, etc; however, the source is in many differently named *.tar.gz files:

clang-3.4.src.tar.gz libcxx-3.4.src.tar.gz polly-3.4.src.tar.gz

clang-tools-extra-3.4.src.tar.gz lld-3.4.src.tar.gz test-suite-3.4.src.tar.gz

compiler-rt-3.4.src.tar.gz lldb-3.4.src.tar.gz

dragonegg-3.4.src.tar.gz llvm-3.4.src.tar.gz

So, how do I shuffle/merge the content of the tar.gz files to produce the source tree that would result from the various svn actions described in http://clang.llvm.org/get_started.html (etc)?

– Bryan

Bryan, you'll first need to decide which packages are relevant. If you would like to build a simple LLVM install using the CLANG frontend, do the following:

$> mkdir build
$> 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
$> cd clang/tools/
$> svn co http://llvm.org/svn/llvm-project/clang-tools-extra/trunk extra
$> cd ../../../..
$> cd llvm/projects
$> svn co http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
$> cd ../../
$> cd build
$> ./llvm/configure --prefix=/path/to/your/resting/place
$> make
$> make install

cheers
john

John D. Leidel
Software Compiler Development Manager
Micron Technology, Inc.
jleidel@micron.com
office: 972-521-5271
cell: 214-578-8510

I must not be asking clearly. I have a machine on which I have placed the tarballs - but no internet access.

How do I use the *src.tar.gz files from the llvm 3.4 downloads page? I understand the layout produced by the svn actions, but if I have just the tarballs, do I simply replace "svn co" with "tar -xvzf" in the sequence? How do the names of the tarballs map to the names of the svn projects?

-- Bryan

The source tar ball structure should be identical to the svn/git repository
checkout. Simply replacing svn for tar should do the trick, yes.

cheers,
--renato

Thanks for all the information on build and source hierarchy. I have to give up for now because I have gcc 3.4.6, which dies a miserable death when I attempt to compile LLVM….

In file included from llvm-3.4/lib/Support/ConstantRange.cpp:24:

IR/InstrTypes.h: In static member function `static bool llvm::TerminatorInst::classof(const llvm::Value*)’:

IR/InstrTypes.h:80: error: call of overloaded `cast(const llvm::Value*&)’ is ambiguous

Support/Casting.h:231: note: candidates are: typename llvm::cast_retty<To, From>::ret_type llvm::cast(Y&) [with X = llvm::Instruction, Y = const llvm::Value*]

Support/Casting.h:238: note: typename llvm::cast_retty<X, Y*>::ret_type llvm::cast(Y*) [with X = llvm::Instruction, Y = const llvm::Value]

Rats. Off to find a newer gcc (and all that it requires).

Again, thanks for your help!

– Bryan