Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

LLVM and Clang installation: apt-get vs. manual install

apt-get method: I'm trying to install LLVM and Clang on Ubuntu 15.10. I used the commands sudo apt-get install llvm and sudo apt-get install clang. This seemed to have worked, and it only took a few minutes.

Manual method: However, most instructions online have me manually download and build the LLVM and Clang packages (e.g. see here: http://clang.llvm.org/get_started.html). I understand this method could take some time, even a few hours for building LLVM and Clang.

What's the difference between these two methods? Are they equivalent? I just want to make sure I have everything installed correctly. (My background is in Windows, so I'm missing the probably obvious difference.)

like image 788
thatWiseGuy Avatar asked Nov 06 '15 18:11

thatWiseGuy


1 Answers

apt-get installs already compiled packages from the repository of the distribution. It also takes care of installing all dependencies. The package maintainer has compiled the package and makes sure that it dependencies (other packages and their versions) are met.

This approach is very convenient and should, by all means, be preferred. The only major advantage – or argument in favour – of a source installation is that you get more recent packages.

Compiling from source may be necessary when you want to benefit from features that are not yet available in the distribution’s version. In the case of the compiler it may also be that a newer version produces “better” binaries than an earlier version.

Another reason for choosing to compile software yourself may be that you want to influence the building process, e.g. different compiler settings or a different configuration with less dependencies. However, such cases are quite rare – in most case, it isn’t worth the trouble.

Also, as you’ve experienced yourself, installing a pre-compiled package takes only a few minutes (or even just seconds), while compiling will take some time depending on the software to compile and your hardware.

Bottom line, unless you have a good reason, use the distribution’s package(s).

like image 187
lxg Avatar answered Sep 21 '22 22:09

lxg