Monday, July 6, 2009

installing LLVM-GCC in fedora 11, 64 bit

Fedora comes with a prepackaged llvm. To install that, you just need to do yum install llvm. But to compile any thing with llvm, you need to install llvm-gcc. Here's how to do it.

1. install llvm by

$ yum install llvm

2. download llvm-gcc source code from here. I downloaded llvm-gcc4.2-2.5.source.tar.gz. Let's say you downloaded it to /path/to/llvm-gcc

3. now extract the tarball by

$ cd /path/to/llvm-gcc
$ tar -zxvf llvm-gcc-version.tar.gz

4. make temp directories for compilation

$ cd /path/to/llvm-gcc/llvm-gcc4.2-2.5.source
$ mkdir install;mkdir obj

5. now comes the fun part of customizing everything to suit your needs. I did

$ cd obj
$ ../configure --prefix=`pwd`/../install --program-prefix=llvm- --enable-llvm=/usr --enable-languages=c,c++,fortran --disable-multilib

The extras here are fortran, disabled multilib for native x86-64 builds and the prefix directory for installation.

6. Now compile and install

$ make -j2

On your machine, it might be a little different depending on how many cpus you can spare for installation.

7. Finally, install it with

$ make install

Now all your stuff will be installed int the $prefix/install/bin directory. Here, $prefix is the path you used to run ./configure, and not some arbitrary environment variable. You may place symlinks at your preferred places.

No comments: