Why Can’t I Use A Package From A Linux Distro In Another

Packing Up Packages To Go!

First, let’s look at some of the different ways software can be packaged and how this affects how the software works. This will help explain why some software continues to work for years across multiple versions of a distribution and why other applications are tied to a specific version of a specific distribution.

One way software can be assembled is by a method called static linking. What this does is essentially gather all of the code an application needs to use and crafts it into one big piece of software. All the libraries and functions the program needs are all included in one file. Because the application has everything it needs in one file, it can be moved to different environments (different distributions) and still work. Since the program replies on very little outsides of itself, it is quite portable.

Having a statically linked program might sound ideal. It is highly portable and it is simple to move the application around, but there are drawbacks. The statically linked program may be larger than other types of software, for example. This approach also means if any software that was used to make the statically linked program has a security flaw, the developer must update the statically linked application and redistribute it. If the original developer is not on top of security updates, the person using the software is at risk of their program being exploited. These restrictions make statically linked programs relatively rare because they are inconvenient to maintain, both for users and developers.

Another approach is to dynamically link software. What this does is allow a program to remain small and use libraries on the user’s computer as necessary. Dynamically linked programs tend to be fairly small and rely on other software to provide a good deal of their functionality. This makes dynamically linked programs fairly painless to distribute. When a library used by dynamically linked application is found to contain a flaw, the library can be updated independently of the application.

Most Linux distributions use dynamically linked programs. The packages are small, making them relatively painless to download. Dynamically linked packages simplify security a great deal. If we have 500 programs which depend on the C library and the C library needs to be fixed, dynamic linking allows us to just update the C library once. If all 500 programs were statically linked, we would need to download 500 new versions of all those static programs.

The drawback to dynamically linked packages is that they often require a specific version of a specific library to be installed on the system for the program to work. This means if you want to copy a dynamically linked program from one distribution to another, you need to make sure all the libraries the program uses are also present. This is why dynamically linked packages often will not work when moved to another distribution, or across versions of the same distribution.

There is a third packaging option which tends not to get used much in the Linux community, but has been popular on some other platforms. Some organizations, especially those which sell proprietary software, will dynamically link their programs (making them small and easy to update) while packaging the specific libraries their application needs to function. This means the user ends up installing one large package which contains the application and its dependencies. Afterwards, security updates are provided just for the small libraries the application requires, making long-term maintenance easier for all parties.

The third option may sound like the best of both worlds and usually it is, at least when dealing with proprietary applications. However, since most Linux software is open source, it can be updated by anyone and made to work with newer versions of libraries. This is why most open source software tends to be dynamically linked. It may seem less portable at first since we cannot simply throw an application onto a different distribution. In the long run though open source applications can be better tailored to their specific environment and therefore best benefit from dynamic linking.

This is why most packages cannot be moved between distributions. The software is open source and the developers are leaving it up to each distribution to package the software as best fits their platform. However, it is possible for developers to create statically linked (or hybrid) packages and have them work across multiple distributions and continue to work for years to come. Commercial game companies, for example, tend to take this latter approach.

Lately we have been seeing a lot of interest in portable packages among the various Linux distributions. New package formats such as Snap and Flatpak have been gaining momentum recently and may become increasingly common, especially with third-party and commercial developers.


From: Distrowatch

If you have found a spelling error, please, notify us by selecting that text and pressing Ctrl+Enter.

Spelling error report

The following text will be sent to our editors: