I am a big fan of Clang and the whole LLVM project in general. But I kept running into problems trying to compile the recently released LLVM 3.0 infrastructure on my Ubuntu 11.10 computer. Here is the recipe I finally discovered for success.
From Your Shell…
Note: I use the Git repositories for the project. If you prefer to pull from Subversion then you’ll have to substitute the appropriate commands.
$ git clone http://llvm.org/git/llvm.git $ cd llvm/tools/ $ git clone http://llvm.org/git/clang.git $ cd .. # Get back to the root llvm directory. $ sudo apt-get build-dep clang $ sudo apt-get install libc6-dev g++-multilib $ CC="gcc-4.6" CXX="g++" ./configure --prefix=/usr/local && gmake # Go do something for an hour or more... $ sudo gmake install
And that should do it. If you run into any errors post them here in the comments and I’ll try to help you out.
#1 by Beamon on December 25, 2011 - 8:11 am
Quote
After this command : sudo apt-get build-dep clang
some where in middle of download I see like : llvm-2.9-dev , llvm-2.9-source etc. Does this command installs llvm 2.9 instead llvm 3.0?
#2 by Beamon on December 25, 2011 - 8:18 am
Quote
OMG, After this command : ./configure: No such file or directory
I get error: ./configure: No such file or directory
How to resolve this problem?, Thanks
#3 by Beamon on December 25, 2011 - 8:32 am
Quote
I have typo in last message , I get error after command : CC=”gcc-4.6″ CXX=”g++” ./configure –prefix=/usr/local && gmake
#4 by ren on December 25, 2011 - 7:24 pm
Quote
> After this command : sudo apt-get build-dep clang
some where in middle of download I see like : llvm-2.9-dev , llvm-2.9-source etc. Does this command installs llvm 2.9 instead llvm 3.0?
That is installing the libraries necessary to build llvm 2.9. They are all basically needed by 3.0 as well.
> After this command : ./configure: No such file or directory I get error: ./configure: No such file or directory
Hmm, I don’t remember running into that issue myself. Although if there is no configure file you may want to try running ‘autoconf’ in the directory. If you don’t have the program I think you can apt-get install ‘build-essentials’ to get it; or it may be in its own package, I honestly don’t remember.
#5 by Jeff Trull on January 6, 2012 - 12:00 pm
Quote
Thanks for the recipe, works great! btw Beamon is right – before the compilation step you need to “cd ..”, as the configure script is in the llvm directory (not llvm/tools).
#6 by ren on January 7, 2012 - 7:39 am
Quote
Thanks guys. I updated the instructions to add the
cd.