Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

So I'm trying to install Halide on my Ubuntu 12.04 (64bit). I need llvm-3.2 and clang to be installed.

Running sudo apt-get install llvm-3.2 ends up with 'package not found'.

Trying sudo apt-get install llvm or sudo apt-get install clang installs 2.9 versions. Google helped me with this

sudo add-apt-repository ppa:kxstudio-team/builds
sudo apt-get update

Now, sudo apt-get install llvm-3.2 clang-3.2 works. But when I run make in Halide folder I still get clang:Command not found.

share|improve this question

migrated from stackoverflow.com Jun 18 '13 at 16:55

This question came from our site for professional and enthusiast programmers.

1  
I assume that "clag:Command not found" should read "clang:Command not found"? –  andyg0808 Jun 17 '13 at 21:20
    
yes, sorry about that –  Andrei Ivanov Jun 17 '13 at 21:23
    
Are you using an Ubuntu with a GUI or one with just a command-line? –  andyg0808 Jun 17 '13 at 23:09
    
Also, do you need clang 3.2 or just clang 3+ ? –  andyg0808 Jun 17 '13 at 23:47
    
I downloaded the Desktop version. I actually need llvm 3.2, there is no word about the version of clang. –  Andrei Ivanov Jun 18 '13 at 3:27

1 Answer 1

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:

  1. Use sudo apt-get purge llvm-3.2 clang-3.2 to completely remove LLVM and clang from your system.
  2. (Optional) Use sudo add-apt-repository --remove ppa:kxstudio-team/builds to remove the PPA from your system.
  3. 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.
  4. Use sudo apt-get update to pull in the information on what packages and versions are now available.
  5. Use sudo apt-get install llvm-3.2/precise-proposed to install LLVM 3.2, and use sudo apt-get install clang/precise-proposed to install Clang 3.0 (I think that's the version you should get).
  6. NEW STEP: Do sudo ln -s /usr/bin/llvm-config-3.2 /usr/local/bin/llvm-config to make the system treat llvm-config-3.2 (which is the llvm-config that came with llvm-3.2) as llvm-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).
  7. 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).

share|improve this answer
    
Thanks a lot! It almost worked. The only problem is that the installed llvm-3.2 doesn't have llvm-config. So when I run make in Halide it tells no llvm is installed. I ran install llvm and now llvm-config --version says 2.9. If I try to install llvm-3.2 it tells me it's the latest version. It seems that llvm-3.2 and llvm are completely independent. –  Andrei Ivanov Jun 18 '13 at 16:40
    
See the new step in the answer; you'll probably want to uninstall the llvm package (sudo apt-get purge llvm) before you do it to make sure you get the right version. You can always check what file you're trying to run by using the command which [command]. For example, which llvm-config should read /usr/local/bin/llvm-config. See en.wikipedia.org/wiki/Which_%28Unix%29 for more info. –  andyg0808 Jun 18 '13 at 21:44
    
why aren't llvm-config linked to llvm-config-3.2 just like it is for gcc? is this a conscious choice? –  Janus Troelsen Jun 11 at 12:36
    
@JanusTroelsen I believe it is a conscious choice. Since the version of LLVM that was available from the llvm package for Ubuntu 12.04 was llvm-2.9, the llvm-config command was linked to the llvm-config from the same version, i.e., llvm-config-2.9. In Ubuntu 13.04 and 13.10, the llvm package installs LLVM 3.2, and I would expect it to then set up llvm-config-3.2 as llvm-config, which it does in Ubuntu 13.10. –  andyg0808 Aug 10 at 1:09

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.