


Binary packages vs source code packages under Linux: Which should you choose?
In Linux systems, the installation program is usually different from the traditional Windows installation software method. You can install it from a pre-built package or compile the program yourself. In those increasingly popular distributions, pre-built packages are often the primary solution. But sometimes, you may also need to compile from source code. This is also one of the characteristics of the Linux operating system. Compiling a program from source code ensures that the program will run properly on the system and allows for more flexibility and customization. No matter which method you choose, you need to choose the method that works best for you based on your needs.
What is a binary package?

Installing programs on Linux is usually different from the traditional way of installing software on Windows. Rather than downloading the installer from the vendor's website, the files come from a program repository, usually customized to your Linux distribution. You can access this repository using your Linux package manager or app store.
The programs in these repositories are composed of multiple files and packaged in an archive format for easy access and distribution. For example, Debian uses the DEB format to store and distribute programs. These packaged files are called binary packages.
How to read binary code
You need a special program to extract these files and install them on your computer, usually your package manager or app store. These tools also have other useful features, such as tracking installed files and managing software updates.
Newer package formats, such as Flatpak and Snap, work with different versions of Linux, but they still consist of precompiled binaries. Both require a graphical app store or a command line-based package manager for installation.
What is source code?
All software consists of lines of text called source code, written in a specific programming language, such as C or C++. Normally, you can't just package this source code into an archive file and call it a package. These lines need to be translated into a language that the computer can understand and execute.
This process is called compilation, and the end result is to create a binary file that the computer can run. The difference between a software package and software is that the binary files of software are stored in a package along with other files such as configuration files.
What is "install from source"?

Installing a program from source means installing without using a package manager. You need to compile the source code and copy the binaries to your computer.
In most cases, you can download the project's source code from a hosting service such as GitHub, GitLab, or Bitbucket. Larger programs may even host source code on a personal website. This code is usually compressed in an archive format (also called a source code package).
A special set of tools helps automate the build process. On the Linux desktop, it usually exists in the form of a command line program called make. Source code written in different languages requires specific compilers and commands to convert it into binaries. The make program automates this process.
To make this automation work, the program provides a file called Makefile that tells make what it should do and how to compile it. Nowadays, Makefiles are usually automatically generated by special software such as CMake. This is where you need to step in. From here, you can specify the specific functionality you want compiled into the software.
Example built from source
For example, the following command uses CMake to generate a configuration file for the Calligra office suite. The file created tells the make program to compile only Calligra's Writer component.
cmake -DPRODUCTSET=WORDS -DCMAKE_INSTALL_PREFIX=$HOME/kde/inst5 $HOME/kde/src/calligra
After completing this step, users can simply run the make tool to compile and copy the results to their computer. The steps are as follows:
make make install

Although this is the general mode for compiling a program, there are many other ways to install source code packages. For example, Gentoo Linux has a built-in way of handling source code packages, making the process faster and easier. But building a binary package requires more steps than the above command.
Benefits of using binary packages
If you use Linux, there is a good chance that someone has precompiled the software you have installed. This is more common than using source code packages. But why is this happening?
1. The binary version is easier to manage

Binary packages not only contain compiled installation files, but also store other information, making it easy for your package manager to keep track of all your programs. For example, DEB files (the package format for Debian and its derivatives) also contain important information such as other software required for the program to run and its current version.
This makes installing the package much simpler because you don't need to worry about what other files are needed to successfully run the program. Your package manager can read this information from the package itself and download all necessary dependencies automatically.
And when installing a program from source code, unless the code is compiled into a stand-alone binary package, you will be responsible for managing the software. You need to remember what other programs you need to make it work and install them yourself.
2. The binary version has better stability
People responsible for maintaining package manager repositories often test binaries and try to fix problems that arise. This may result in improved stability, as package maintainers may discover problems that may have been overlooked by those installing the source code.
Additionally, packages usually must adhere to a strict set of rules to ensure they will run on your system. For example, Debian and Ubuntu both have a policy manual, and many other Linux distributions have similar manuals.
Some programs also rely on different versions of the same software dependencies to run. The package repository will try its best to resolve these conflicts to avoid causing trouble for you.
Benefits of compiling source code packages
Installing a program from source is not something everyone needs to do, as it is usually easier to maintain your computer if you stick to binary packages. Still, there are some advantages to using this slightly more complicated way of installing a program.
1. Source code provides the latest software
One drawback to making a program more reliable is that it takes time to improve and fix. Sometimes there may be binaries available, but the source code will be provided later. For those who want to have the latest and greatest software, they may be willing to sacrifice a little stability while exchanging for newer software.
Although there are some Linux operating systems that can meet this need without compiling the program, they also have some disadvantages. For example, software that does not release fixed package versions frequently will have difficulty keeping up to date in the repository. In contrast, installing from source does not have these restrictions.
This is because binary packages are usually made based on officially released program versions. Therefore, changes between these versions are usually not taken into account. By compiling your own software from source code, you can benefit from these changes immediately.
It is also possible that your Linux operating system does not prepare the software you want for you in advance. In the past, this would have made installing from source the only option. Common package formats have changed this. Flatpak and Snap packages also generally receive updates faster than system repositories. But there are still times when compilation is the only way to get the software you want.
2. You can choose the function yourself

Function of FFmpeg Another benefit of using source code packages is that you have more control over the programs you install. When installing from a binary repository, you are limited in your ability to customize packages.
Take FFmpeg as an example, it is a command line-based audio and video conversion tool. By default, it comes with a ton of features, some of which you may never use. For example, FFmpeg supports JACK audio, although this software is typically only used in production environments.
By compiling FFmpeg, you can remove features you don't need and make it more lightweight and fit your needs. The same principle applies to other huge programs.
When resources are limited, removing functions can effectively reduce the load. It's no wonder that Gentoo Linux-based ChromeOS is used on many low-end computers. Gentoo is based on source code and compiles many software, potentially making these systems lighter to run.
Why not use both binary and source packages?
While you may not want to compile packages every day, this is a useful approach. Still, with the new universal package format available from sites like the Snap Store and Flathub, you're less likely to need to build from source to get the latest software.
The above is the detailed content of Binary packages vs source code packages under Linux: Which should you choose?. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

For many users, hacking an Android TV box sounds daunting. However, developer Murray R. Van Luyn faced the challenge of looking for suitable alternatives to the Raspberry Pi during the Broadcom chip shortage. His collaborative efforts with the Armbia

DeepSeek is a powerful intelligent search and analysis tool that provides two access methods: web version and official website. The web version is convenient and efficient, and can be used without installation; the official website provides comprehensive product information, download resources and support services. Whether individuals or corporate users, they can easily obtain and analyze massive data through DeepSeek to improve work efficiency, assist decision-making and promote innovation.

There are many ways to install DeepSeek, including: compile from source (for experienced developers) using precompiled packages (for Windows users) using Docker containers (for most convenient, no need to worry about compatibility) No matter which method you choose, Please read the official documents carefully and prepare them fully to avoid unnecessary trouble.

How to download BitPie Bitpie Wallet App? The steps are as follows: Search for "BitPie Bitpie Wallet" in the AppStore (Apple devices) or Google Play Store (Android devices). Click the "Get" or "Install" button to download the app. For the computer version, visit the official BitPie wallet website and download the corresponding software package.

BITGet is a cryptocurrency exchange that provides a variety of trading services including spot trading, contract trading and derivatives. Founded in 2018, the exchange is headquartered in Singapore and is committed to providing users with a safe and reliable trading platform. BITGet offers a variety of trading pairs, including BTC/USDT, ETH/USDT and XRP/USDT. Additionally, the exchange has a reputation for security and liquidity and offers a variety of features such as premium order types, leveraged trading and 24/7 customer support.

The system variable $n is the parameter passed to the script or function. n is a number indicating the number of parameters. For example, the first parameter is $1, and the second parameter is $2$? The exit status of the previous command, or the return value of the function. Returns 0 on success, 1 on failure $#Number of parameters passed to the script or function $* All these parameters are enclosed in double quotes. If a script receives two parameters, $* is equal to $1$2$0The name of the command being executed. For shell scripts, this is the path to the activated command. When $@ is enclosed in double quotes (""), it is slightly different from $*. If a script receives two parameters, $@ is equivalent to $1$2$$the process number of the current shell. For a shell script, this is the process I when it is executing

1. Installation environment (Hyper-V virtual machine): $hostnamectlStatichostname:localhost.localdomainIconname:computer-vmChassis:vmMachineID:renwoles1d8743989a40cb81db696400BootID:renwoles272f4aa59935dcdd0d456501Virtualization:microsoftOperatingSystem:CentOS Linux7(Core)CPEOSName:cpe:

Ouyi OKX, the world's leading digital asset exchange, has now launched an official installation package to provide a safe and convenient trading experience. The OKX installation package of Ouyi does not need to be accessed through a browser. It can directly install independent applications on the device, creating a stable and efficient trading platform for users. The installation process is simple and easy to understand. Users only need to download the latest version of the installation package and follow the prompts to complete the installation step by step.
