Hacker News new | ask | show | jobs
by gwmnxnp_516a 1866 days ago
One of the greatest problems of desktop Linux is the huge fragmentation. Linux desktop has fewer users than MacOSX and Windows, and lots of distributions, each one with a different packaging methods and incompatible dependencies which may result in work duplication and dependency hell, that can happen if one needs to install an application outside of repository, but it needs a dependency that overrides an already installed library. Other problems of Linux distributions is that they not allow keeping multiple versions of the same application and multiple versions of the same compiler. The packaging issue is not relevant for people using Linux as server due to Docker, that can package any application alongside the configuration, dynamic linker, GlibC and shared libraries.

Another reason why is hard to find binaries for Linux is the lack GlibC backward compatibility. Even a fully statically linked application or packaged with all shared libraries dependencies via LD_LIBRARY_PATH or RPATH may crash if the application was linked against a newer version of GLIBC and is deployed on an Linux distro with an older version of GLIBC. The linking error happens due to the lack of backward compatibility of the GLibC, which is the main bridge between the user-space and kernel-space on Linux.

A possible solution for packaging an application for multiple distribution with minimal work duplication might be: 1 - minimize the number of dependencies; 2 - static link as much as possible; 3 - instead of linking directly against shared libraries such as Curl, Gtk or SSL, load those libraries through dlopen(), dlsym() Unix APIs; 4 - build the application on distro or docker containing an older version of GlibC for dealing with GlibC compatibility problems; 5 - pack all shared libraries dependencies on the same directory as the application setting RPATH to a relative path to the shared libraries dependencies; 6 - embed all files additional non-source files such as images or text in the binary using resource compilation; 7 - distribute the application in a zipped archive; 8 - use GO (Golang) which is able to static link almost all dependencies and also bypass the GlibC by performing system calls directly. A golang binary will just run everywhere with minimal effort.

Linux distributions could make the developers life easier if they copied the MacOSX app bundle idea where applications are distributed as <APPLICATION-NAME>.app directories containing metadata, the executable and all shared libraries dependencies. The advantage of this approach, is that the application can be installed by just dragging and dropping a folder to the /Applications directory and uninstalled by just deleting a directory. Another benefit is that the user can keep multiple versions of same application and not fear dependency hell or overriding a previously-installed library.