Sometimes, when downloading software from the Internet, I find that there is a .deb package ready for either my Debian/Ubuntu and also a tarball to be compiled. In the beginning I would simply use the package for its ease of installation, and wouldn't even dare attempting to compile. Even the sound of it scared me a bit. Nowadays, however, when I have the option I sometimes find myself in a dilemma: is there an unpopular advantage to compiling from source compared with the .deb package? I hope to find out here, thank you.
3 Answers
The advantage of compiling from source is that you can compile packages with certain flags/options which may be missing/disabled in stock-standard Ubuntu packages. Also, it makes it easy to have multiple versions of the same program installed. Also, you can choose an exact version of a package which may be already removed from or not yet present in Ubuntu repositories (example: I have several versions of Python 2.4.x in my /opt/ directory as I need it to run some older software).
The disadvantage of compiling from source is that, unless you build a .deb and then install it, the normal "./configure; make; sudo make install" procedure keeps Ubuntu's package manager completely unaware of the changes you're making, so you're not going to get any updates for the manually-compiled software; and it's possible that package manager will later override/break your package if you're not careful to install it in a separate location.
In short: Always consider installing from standard Ubuntu repositories first, next consider installing a .deb; only compile from sources if you know exactly why you need to do this.
-
I've read also, what the package performance could be different, when it's compiled, kind of better compatibility with current kernel. Didn't benchmarked it personally. Jul 2, 2012 at 14:42
-
@Fedir: I'm not sure kernel has anything to do with this, it's rather processor architecture - for example, in the old days many distributions contained packages compiled with 80386 instruction set for maximum compatibility while manually compiling a program for Pentium would enable it to use more efficient instructions. There are whole distributions, such as Gentoo, which are compiled from source on the host machine for this reason. The difference, however, is usually minimal and can only be noticed in very specific applications.– SergeyJul 2, 2012 at 20:59
-
1Note that using checkinstall in place of make install alleviates a lot of the mentioned disadvantages. See help.ubuntu.com/community/CompilingEasyHowTo– ndemouJun 12, 2016 at 15:40
-
1Sorry for nitpicking, @EliahKagan, but, while virtualenv is awesome, it's more for maintaining multiple Python environments with different libs installed. If you wanted a specific version of Python, maybe compiled with specific settings - you'd still need to install the actual binary - either from a .deb or compiled from scratch.– SergeyAug 3, 2017 at 23:14
-
@Sergey You're right. (And I don't see anything you've said as nitpickiing--if anything I should apologize for my wrong and misleading comment!) As I understand it package managers like
conda
will automatically make virtual environments and install different installations of Python for them, creating and maintaining per-project versions. But as you say virtualenv won't itself do this. Aug 3, 2017 at 23:37
I was arguing on this just yesterday. I think it is extremely important to not build anything fragile, as it is known that there is no such as up to date and good documentation, especially when you are working with a fragile system, there will be no time to fight the fire and write documentation, and where everything is robust the documentation is not needed that much. So you should never ever compile from source, find another solution, use another software, change your architecture, but do not use something that will break after update. And yes it has no anything to do with kernel version, it is about the architecture of your machine, and in nowadays you hardly can get significant difference with compiling from the source code, I bet you will not get any.
It's certainly much easier to install the .deb, although if you can, the best bet is to find it in a repo or a ppa, so that you can be provided updates.
AFAIK there's no real benefit to compiling it yourself unless you plan to alter it first. If you just want the software as is, then install the .deb