Binary vs. Source Packages: Which Should You Use?
Pinterest Stumbleupon Whatsapp
Advertisement

Regardless of the package manager Which Linux Package Manager (and Distro) Is Right for You? Which Linux Package Manager (and Distro) Is Right for You? A key difference between the main Linux distros is the package manager; the differences are strong enough that it can influence your choice of distro. Let's look at how the various package managers work. Read More you’re using, you have two ways of installing programs on Linux. You either use a pre-built package, or compile it yourself. These days, the former usually wins out by default. There are, however, times when you should consider the alternative.

What Are Binary Packages?

Installing programs on Linux is usually quite different to installing on Windows. Rather than get the installers off a vendor’s website, the files are retrieved from a repository of programs, usually tailored How to Customize the Ubuntu 16.04 LTS Desktop How to Customize the Ubuntu 16.04 LTS Desktop Sick of the default Ubuntu look? Time to customize Ubuntu the way you want it? With the Unity Tweak Tool and a few simple terminal commands, you can make your Unity your own! Read More for your operating system.

Files for separate programs are stored in an archive format What’s The Best File Compression Method? MakeUseOf Tests Zip, RAR & More What’s The Best File Compression Method? MakeUseOf Tests Zip, RAR & More File compression is an important and common task users frequently ask of their computers. Reducing a file’s size makes it easier to email or place on a flash drive. It also reduces bandwidth usage and... Read More . This bundles everything into a single file for easy access later. For example, Debian uses the DEB format to store their programs. These bundles are called binary packages.

deb package format

Installing requires a special program to extract these files and put them onto your computer. That is to say, your package manager (e.g. APT, Yum, and so on). It also does other useful things, such as keep track of what files you have installed, and manage software updates.

Where Do Packages Come From?

All software is written in lines of text called source code. They’re written in specific programming languages 6 Easiest Programming Languages to Learn for Beginners 6 Easiest Programming Languages to Learn for Beginners Learning to program is about finding the right language just as much as it's about the edification process. Here are the top six easiest programming languages for beginners. Read More , such as C or C++. Generally however, you can’t just bundle that into an archive and call it a package. These lines need to be translated into a language your computer can understand and execute.

This process is called compiling How to Compile & Install TAR GZ & TAR BZ2 Files in Ubuntu Linux How to Compile & Install TAR GZ & TAR BZ2 Files in Ubuntu Linux Read More , the end result creating binaries which your computer can run. It’s these binaries that are stored together inside a package, along with other things such as configuration files What Are Config Files, and How Can You Edit Them? What Are Config Files, and How Can You Edit Them? The vast majority of software applications are configured via a menu interface, but some require you to take a step beyond and actually edit a text file. But how do these "config files" work? Read More .

What Is Installing “From Source”?

Compiling source code isn’t just for making packages. In fact, creating such an archive from it is not even necessary. Basically, installing a program “from source” means installing something without using a package manager. You compile the source code and copy the binaries to your computer instead.

Most of the time, you can download a project’s source code from hosting services such as GitHub or BitBucket Love GitHub? 4 Reasons Why You Should Host Your Code On BitBucket Love GitHub? 4 Reasons Why You Should Host Your Code On BitBucket You have to think about where you intend to store your code. It's likely you've have heard of GitHub. That's not surprising. GitHub is used by individuals and enterprises to host code, collaborate on documentation... Read More . Larger programs might even host it on a personal website. The code will usually be zipped up in an archive format (also known as a source package).

source package tree

A special set of tools helps to automate the building process. On Linux desktops, this usually comes in the form of a command line A Quick Guide To Get Started With The Linux Command Line A Quick Guide To Get Started With The Linux Command Line You can do lots of amazing stuff with commands in Linux and it's really not difficult to learn. Read More program called make. Source code written in different languages need specific compilers and commands to change them into binaries. The make program automates How to Schedule Tasks in Linux with Cron and Crontab How to Schedule Tasks in Linux with Cron and Crontab The ability to automate tasks is one of those futuristic technologies that is already here. Every Linux user can benefit from scheduling system and user tasks, thanks to cron, an easy-to-use background service. Read More this process.

emacs makefile

To do this, programs provide make with a makefile that tells it what to do and compile. These days, it’s usually automatically generated by special software such as CMake. This is where the user comes in. Because from here, they can specify exactly what features they’d like compiled into their own software.

Quick Demonstration

For example, the command below generates a configuration file for the Calligra Office Suite Calligra vs. LibreOffice: Which Is The More Productive Linux Office Suite? Calligra vs. LibreOffice: Which Is The More Productive Linux Office Suite? Read More using CMake. The file created tells the make program to only compile the Writer component of Calligra.

cmake -DPRODUCTSET=WORDS -DCMAKE_INSTALL_PREFIX=$HOME/kde/inst5 $HOME/kde/src/calligra

Having done this, all a person has to do is run the make tool to compile and copy the results onto their computer. This is done in the following way:

make
make install

While this is the general pattern for compiling programs, there are many other ways to install source packages. Gentoo Linux Gentoo: A Linux Distribution Where You Compile Your Own Optimized Software Gentoo: A Linux Distribution Where You Compile Your Own Optimized Software The sheer number of different ways in which Linux can be run is astounding, as there are plenty of choices to go around. While there are plenty of distributions which rely on either the .deb... Read More , for example, has a built-in way of handling this, making the process much faster and easier. Along with this, building binary packages takes a few more steps than just the above commands.

Benefits of Using Binary Packages

If you’re using Linux, chances are that the programs you have installed were pre-compiled. These days, it’s much more common than using source packages. There are a few reasons why that’s the case.

Easier to Manage

Binary packages contain much more than just compiled installation files. They also store information that makes it easy for your package manager Your Guide to Ubuntu Repositories and Package Management Your Guide to Ubuntu Repositories and Package Management Read More to keep track of all your programs. For example, DEB files (the package format for Debian Debian: Enjoy One Of The Most Stable And Trusted Linux Distributions Debian: Enjoy One Of The Most Stable And Trusted Linux Distributions There are plenty of Linux users out there who are using distributions such as Ubuntu or one of the many distributions which are based from Ubuntu, including Linux Mint. However, no matter what you're using,... Read More and Debian derivatives) also contain important information such as what other software the program needs to run, and its current version.

deb package format

This makes packages much easier to install. You don’t need to worry about what other files you need to install to make a program run for example. Since your package manager can read that information from the package itself, it handles all that automatically.

Compare this to installing programs from source. Unless you compile the code into a binary package of its own, you will be in charge of managing that software. You’d need to keep in mind what other programs you need to make it work, and install them yourself.

Improved Stability

Package repositories tend to test their binaries for problems, and do their best to fix them when they appear. This can lead to improved stability of programs, something a person who installed from source might miss out on.

For example, there are a number of packages in Debian’s repositories that have fixes applied to them. This can even include large programs such as web browsers Are You Using the Best Web Browser for Linux in 2016? Are You Using the Best Web Browser for Linux in 2016? Using the "wrong" browser can lead to a lot of unnecessary headaches, wasted productivity, and even lost data. So which browser is the best for your Linux computer? Let's find out. Read More !

debian patches

Along with this, packages usually must adhere to a strict set of rules to help ensure they’ll run on your system. Both Debian and Ubuntu have a policy manual for example, as do many other Linux operating systems.

Some programs also rely on different versions of the same software dependency to run. Package repositories do their best to resolve these conflicts so you don’t have to worry about this.

Benefits of Compiling Source Packages

Installing programs from source isn’t something that everyone needs to do. In fact, it’s best if you stick with binary packages. Even so, there are still some advantages to using this slightly more involved way of installing programs.

Latest Software

One disadvantage of making programs more reliable is that it takes time to improve and fix. As a result, this can lead to you using older versions of software. For people who want the latest and greatest 5 Linux Operating Systems That Offer Bleeding Edge Updates 5 Linux Operating Systems That Offer Bleeding Edge Updates A system that's always improving and updating has its benefits, e.g. gains in speed and security. If you're ready to try bleeding edge Linux, here are some operating systems to consider. Read More , they might even prefer a bit of instability in exchange for it.

While there are Linux operating systems which cater for this need without compiling programs, they do have a few drawbacks. For example, software that doesn’t frequently release set package versions are harder to keep up to date Why You Should Always Keep Your Ubuntu Installation Updated [Linux] Why You Should Always Keep Your Ubuntu Installation Updated [Linux] Read More  in a repository, than installing from source.

This is because binary packages are usually made from official releases of programs. As such, changes between these versions are usually not taken into account. By compiling your own software from source, you can benefit immediately from these changes.

It’s also possible that your Linux operating system doesn’t have the software you want pre-made for you. If that’s the case, installing it from source is your only option.

Pick and Choose

Another benefit to using source packages is that you gain more control over the programs that you install. When installing from a binary repository, you’re restricted in the ways you can customize your packages.

For example, look at FFmpeg, the command-line-based audio and video converter 10 Great Apps to Convert Audio & Video Files in Linux 10 Great Apps to Convert Audio & Video Files in Linux Read More . By default, it comes with a huge number of features, some of which you might never even touch. For instance, JACK audio support is available in FFmpeg, even though this software is usually used in production environments 6 Linux Distros Designed for Artists, Musicians and Editors 6 Linux Distros Designed for Artists, Musicians and Editors Read More only.

ffmpeg features

Compiling FFmpeg allows you to remove the things you don’t want from it, leaving it lighter, and tailored to your needs. And the same applies to other heavyweight programs.

When resources are scarce, removing features can be a great way of lightening the load. It’s no wonder that Chrome OS The Chrome OS Challenge: A New User's Day on a Chromebook The Chrome OS Challenge: A New User's Day on a Chromebook What are Chromebooks like for someone who's used to a Windows or Mac setup? As a newcomer to Chrome OS, I'm here to tell you. Read More , found on many low-end computers, is based off Gentoo Linux. Gentoo, being source-based, compiles a lot of its software, potentially making these systems run much lighter.

Why Not Install With Both?

While you probably won’t want to compile packages on a daily basis, it’s something useful to keep in mind. If ever you don’t find your software repositories good enough, remember that there’s another, older way of getting things installed.

Have you ever had to compile software before? Why?

Image Credit: Andrii Symonenko via Shutterstock.com

Leave a Reply

Your email address will not be published. Required fields are marked *

  1. Rise of the Fallen
    June 23, 2017 at 4:14 pm

    For Slackware users, it's pretty natural having to compile source code, as they don't really have a package manager.