Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

By building from source do you gain any benefits? Is the code better optimized to your hardware architecture? Is it optimized better in general?

Why would someone choose to build from source rather than using a package management system like APT/yum? If there is some kind of optimization gain when does that outweigh the benefit of a package management system?

share|improve this question
Your two choices are not mutually exclusive. You can customize the sources of a package or even package it yourself. – Faheem Mitha Mar 17 '11 at 6:27
up vote 11 down vote accepted

Building from source provides the following options which are not available when using a version from a binary package manager.

Compiling from source allows you to:

  • use processor-specific optimizations
  • use the very latest version
  • learn how compilation & linking work (suggestion from @mattdm)
  • fix bugs, development work
  • set compile-time options (e.g. include X features in vim)
share|improve this answer
for a regular desktop user, is the gain in processor-specific optimizations worth the cost of the complexity of manually managing dependencies between pieces of software? Is it like a 2% gain or a doubling in performance? – Doug T. Mar 15 '11 at 19:34
@Doug For CPU heavy software the difference can be 10..20%, for typical desktop software, the difference is zero. If you want to try compiling software from source, I would recommend a source based distribution (for example Gentoo). It is a very bad idea to install software from source (apart from 3rd party software installed into /opt) in a binary distribution. – Let_Me_Be Mar 15 '11 at 19:45
I think the performance is not worth going outside your package manager dependencies. However, there are source-based package management systems that keep track of the dependencies and let you compile from source. The advantage listed above that you don't get with this is just 'very latest version' - the package manager has a version picked out that will work with the rest of the distribution. – Shawn J. Goff Mar 15 '11 at 20:49
The one thing I would add is: learn a lot more about what's going on under the hood. That can be worth it in its own. – mattdm Mar 16 '11 at 3:55

I've done this exact thing very recently.

I compiled openssl-1.0.something from source on a Slackware 11.0 linux system. I wanted to patch the login-by-password thing to pause for 7 seconds on a failed login, so as to tarpit those annoying Chinese ssh password guessers.

I compiled Apache httpd 2.2.17 on the same Slackware 11.0 system because it came with Apache 2.0.something, and I wanted to use a 2.2.x httpd.conf from another system.

Come to think of it, I also compiled Alpine 2.0 (email client, pine follow-on) for the same system. Why Slackware 11.0? It's running on a circa 2003 machine with Intel "Brookdale" graphics, and any later Slackware just doesn't support the poorly-documented Intel graphics.

On a different machine, I pulled the TI ACX111 wireless chip support from github and compiled a new driver, allowing me to use a $9 wireless card.

I also habitually recompile Linux kernels to make them specific to the machine they run on.

So in my case it's various reasons of customization, hardware support, and "just because".

Given what we know of epidemiology in a uniform population (http://www.usenix.org/publications/login/2005-12/openpdfs/geer.pdf) why doesn't everyone compile from source on their own systems, with whatever compile-time options they choose? That would make for a vastly more virus- and worm-resistant population.

share|improve this answer
There are simpler ways to slow those ssh-hammering miscreants down... look for iptables rate limiting. That solution has wider applicability, and moreover doesn't void your warranty. – vonbrand Jan 15 '13 at 22:01
Typically linux doesn't come with a warranty. Slackware 11 is some years old at this point. You're begging the question with FUD, specifically, "fear". "Oh no! Don't do that! You'll void your warranty!" How many times does one rely on a warranty? Very few. We'd all like someone else to take responsibility (especially moral, but mostly financial) for all our actions, but that just can't happen without a lot of bad consequences for individuals, and society. I stand by my advice, and more: compile the source yourself, and take all the responsibility. Don't blame anything on anyone else. – Bruce Ediger Jan 16 '13 at 3:07
Oh, come on. If it is RHEL or SLES (or even Ubuntu LTS with a support contract) there certainly is a warranty to be voided. If it was Debian or Fedora, a bug report for your hacked OpenSSH will just be closed without looking twice. – vonbrand Jan 16 '13 at 3:09

Your Answer


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.