llvm and clang installation on ubuntu
Ok, so I successfully compiled Halide on Ubuntu 13.04 by installing llvm
, clang
, and build-essential
. My only guess as to your issue is that the LLVM or clang from the PPA you installed might not have worked quite right. It seems it's actually possible to get LLVM 3.2 from Ubuntu for 12.04, via what is known as the "proposed" archive. You might try purging the LLVM you have and installing it from "proposed". I'll explain how to do that below. Since you mentioned you're new to Ubuntu (in the original question version), I'll first explain what each command you've already used does, as best I can.
So, sudo apt-get install llvm-3.2
attempts to install the package named llvm-3.2
from the current repositories enabled on your system. In your case, it couldn't be found, so the command failed. sudo apt-get install llvm
installed the llvm
package, which is probably a special package that just uses the most up-to-date LLVM available in your standard repositories. In your case, that was 2.9. Same idea applies to sudo apt-get install clang
. sudo add-apt-repository ppa:kxstudio-team/builds
adds what's called a personal package archive or PPA to your system. This lets you get more software from another repository, or software source. See https://help.launchpad.net/Packaging/PPA for more info. Finally, sudo apt-get update
tells Ubuntu to get information on what packages are available from the currently available repositories. You might take a look at http://www.debian.org/doc/manuals/debian-faq/ch-pkgtools.en.html for more info on package management in Debian (most of which should apply to Ubuntu as well, since Ubuntu is based on Debian).
So, the steps to remove the packages you've got and install the versions available from precise-proposed:
- Use
sudo apt-get purge llvm-3.2 clang-3.2
to completely remove LLVM and clang from your system. - (Optional) Use
sudo add-apt-repository --remove ppa:kxstudio-team/builds
to remove the PPA from your system. - Follow the instructions at https://wiki.ubuntu.com/Testing/EnableProposed to enable the Proposed archive (right at the top of the page), and also follow the instructions for "Selective upgrading from -proposed". The first part will enable the actual Ubuntu version of the
llvm-3.2
package, and the second will keep the system from trying to upgrade everything to the Proposed versions. - Use
sudo apt-get update
to pull in the information on what packages and versions are now available. - Use
sudo apt-get install llvm-3.2/precise-proposed
to install LLVM 3.2, and usesudo apt-get install clang/precise-proposed
to install Clang 3.0 (I think that's the version you should get). -
NEW STEP: Do
sudo ln -s /usr/bin/llvm-config-3.2 /usr/local/bin/llvm-config
to make the system treatllvm-config-3.2
(which is thellvm-config
that came withllvm-3.2
) asllvm-config
. More completely, this creates a symbolic link (or symlink) to llvm-config-3.2 in another place where Ubuntu will look for programs (more info: ln, FHS, PATH). Thus, when you run "llvm-config", Ubuntu will find the symlink and run the program it points to (llvm-config-3.2
). - See if everything compiles correctly now.
Hopefully that works. I've not tested any of this, so use at your own risk, etc. I'm pretty sure, however, that it shouldn't do anything terrible.
EDIT: Note that llvm
and llvm-3.2
are independent. llvm
depends on llvm-2.9
(see here), while llvm-3.2
is separate (see dependencies here)
Also, I'm not sure if you know about tab completion; it can be helpful if you're looking for a command but don't quite know the name (for example, in this case, it would probably have shown that llvm-config
was called llvm-config-3.2
).