Open aferrero2707 opened 6 years ago
I guess we'd need collect empirical evidence, a.k.a. trial and error, as we have never experimented with this scheme.
While I am not opposed to "crude hacks", maybe there is a cleaner way to implement a similar scheme that does not need symlinks and such: Could we take the code of ld-linux.so and hack it into a custom AppRun that would compare the system version and the bundled version of each library and always load the newer one?
People testing my Rawtherapee and GIMP appimages on various Linux distributions have sometimes reported conflicts between bundled and system libraries, typically showing up as missing symbols. I am currently using CentOS7 for building my packages.
Generally speaking, there is often a need to decide at run-time wether to use the system or the bundled version of some specific library, whichever is newer. One known example is
libstdc++
, but there are other cases as well.Another example is the
fontconfig
library. Currently I am bundling the library, as well as its dependencylibfreetype
, into the appimages. However, I want to use the system-provided/etc/fonts/fonts.conf
file, so that I do not need to bundle fonts into the AppImage itself. Now the problem is that if the system fontconfig version is too new, the bundled library might give errors when parsing/etc/fonts/fonts.conf
. In this case, the bundledlibfontconfig
should be skipped and the system one used instead. However, this might bring other issues with dependent libraries, likelibfreetype
: the systemfontconfig
library requires symbols that are not provided by the bundledlibfreetype
(because it is too old), and the systemlibfreetype
should be used as well...To solve this, I am developing some bash code that, for a given library, compares the versions of the system and bundled copies, and "disables" the bundled one when the system one is newer. The library version is extracted from the suffix of the dereferenced
*.so*
file name. For this to work, I had to introduce some changes into the way the libraries are bundled. In particular, I had to:*.so*
file is available in the bundle (see here). All library files are copied directly into$APPDIR/usr/lib
.$LIBRARY.so*
(see here).LD_LIBRARY_PATH
, but DO NOT ADD$APPDIR/usr/lib
(see here).*.so*
name to determine the library versions, and delete the copy in the temporary library dir if the system library is newer (see here)An example of how this mechanism is used can be fount in the {Rawtheapee AppRun script](https://github.com/aferrero2707/rt-appimage/blob/master/ci/AppRun#L5). With this, I was able to provide compatibility with "rolling" distributions like Sabayon and Majaro (in addition to "classical" ones like Debian stable/testing, Ubuntu and Fedora). However, I would like to have the opinion of the experts (pinging @probonopd and @TheAssassin in particular) regarding this. Of course, if you find this useful, feel free to integrate it in the default AppImage scripts...
Thanks!