Dependencies in Linux
Dependencies in Linux
Dependencies in Linux – Chapter 8.1
This is the eight of the free articles directly taken from the Manjaro Linux User Guide book, available at https://www.amazon.com/dp/B0C4PSWRQS/. The full list of freely available articles is here: Manjaro Linux User Guide – For newbies, fans, and mid users. More information at the end of the article.
Read time: 4 minutes. Previous article: 6.6 Creating Application Shortcuts And Converting .Deb And .Rpm Packages. Next article: 8.2 Pacman, Pamac, Octopi, And Package Management.
Dependencies in general
Applications in Linux depend on multiple modules to run. These libraries and executables are called dependencies. In Windows, they are .dll libraries (dynamic link libraries) and .exe files. In Linux, the .so (shared object) file format is used for dynamic libraries, and the executables are controlled via file permissions, so they don’t have a dedicated extension. Read more about permissions in Chapters 7, 9, and 13.
As a metaphor, imagine an application as a car. For the car to run, it needs the required dependencies of roads, charging stations, tires, and maintenance, while optional dependencies could be a carwash, a park assistance feature, expensive tires, a garage, and so on. On Windows and macOS, such dependencies are installed during the initial installation/setup procedures. It is the same for Linux, but your package manager explicitly informs you when such are required and will be installed. This is because Linux is based on the fundamental values of transparency, modularity, reusability, and full user control.
Each distribution family has a different package manager; there are around 20 in total. In Arch Linux, this is the command-line interface (CLI) application pacman, supported on Manjaro by default. In addition, Manjaro’s team developed pamac, which is a pacman frontend providing the Add/Remove Software GUI. As we will see, pamac also provides a rich CLI.
We discussed the rare (but possible) dependency collisions in Chapter 5. The Manjaro Official Repositories software (SW) rarely has issues (as it is tested before being released to the Stable branch), and as mentioned in Chapter 5, it is usually faster. We also understood how such rare problems are solved with the Flatpak, AppImage, and Snap application containers. Their advantages are that we have all dependencies packed in them, they have an additional isоlation layer for security, and often provide applications unavailable in Manjaro’s Official Repositories. Their disadvantages, however, are extra usage of HDD storage, RAM, and CPU resources.
The .so shared libraries were made to prevent duplication of the same functionality and to provide modularity. Without the modularity and reusability of the Linux dependencies, the containers would not even exist, as they also contain .so files.
The information in this chapter is related mainly to Official Repositories SW and AUR packages. The package managers download the information for each application and its dependencies from the servers. They also handle all installations, uninstallations, and a database (DB) of the currently installed packages. Thus, they are a key Linux component and contribute to its modularity. In the next section, we will explore all the powerful features of pacman and pamac. In the end, we will briefly examine the alternative Octopi pacman frontend.
This is the moment to say when all these options will be helpful to us as users. Here are a few use cases:
- To analyze our installed packages and their relations
- To identify collisions and sometimes to solve issues
- To clean up our system
- To learn about a given application, find libraries, their sources, and official websites for more information
—– —– —– —– —–
Inspecting the .so dependencies of a library or an application
Before we go on, apart from pamac or pacman, to get the list of dependencies for a package, we can use the magnificent tool ldd, which will list all shared libraries dependencies of an application. As an example, let’s use bash. With $ where bash, we will get the location of the binary, while $ whereis bash will additionally provide its include and library paths. It is located in /usr/bin/bash. Call $ ldd /usr/bin/bash, to list the .so files bash needs. The first is always linux-vdso.so.1, which is not an actual .so file but a virtual library connecting the application with the Linux kernel. The result of ldd for bash is as follows:
In the book we continue in the next sections with Pacman, and Pamac, with which we can get a lot more information on dependencies of packages and applications. They are covered in the next free article.
Next article: 8.2 Pacman, Pamac, Octopi, And Package Management.
* * * * *
You can subscribe for news, discounts, and giveaways HERE. Triple Helix Guarantees 100% privacy and will never provide your data to third parties. We keep the right to inform you on some of the news for our open-source projects, which will be rare. You can unsubscribe at any moment.
You can also follow me for such news on LinkedIn, where the giveaways will take place. I share development news, guides, and helpful content.
All rights reserved. Parts of this free content are allowed to be cited only when the official link to this article is provided as a source of the information, the author’s name is mentioned, as well as the publisher and the book name. Example: “Cited from the article <insert_link> by Atanas Georgiev Rusev, as part of the Manjaro Linux User Guide book, by PACKT publishing. All rights reserved”.