New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Investigate rtldi and PatchELF for AppImages that bundle "everything" #84

Open
probonopd opened this Issue Sep 3, 2016 · 7 comments

Comments

Projects
None yet
1 participant
@probonopd
Member

probonopd commented Sep 3, 2016

Although not generally recommended, there might be some edge cases in which it might be desirable to bundle all dependencies, not just the ones that cannot be expected to be part of the base system(s).

For these cases, we should investigate to use
http://bitwagon.com/rtldi/rtldi.html
although it can be done in some cases without it, too.

Also see
http://joeyh.name/blog/entry/completely_linux_distribution-independent_packaging/
for an example.

@probonopd

This comment has been minimized.

Member

probonopd commented Sep 4, 2016

Also, check patchelf --set-interpreter. http://nixos.org/patchelf.html
May be even more elegant.

@probonopd probonopd changed the title from Investigate rtldi for AppImages that bundle "everything" to Investigate rtldi and PatchELF for AppImages that bundle "everything" Sep 4, 2016

@probonopd

This comment has been minimized.

Member

probonopd commented Oct 30, 2016

We need to prevent the loader from loading stuff outside of the bundle.

The loader has hardcoded instructions to load libraries from /lib!

when I patch /lib to ./li, then

Inconsistency detected by ld.so: dl-load.c: 719: _dl_init_paths: Assertion `pelem->dirname[0] == '/'' failed!

Hence we patch these paths to other (empty) absolute paths

sed -i -e 's|/lib|/xib|g' lib/x86_64-linux-gnu/ld-linux-x86-64.so.2
sed -i -e 's|/etc|/xtc|g' lib/x86_64-linux-gnu/ld-linux-x86-64.so.2

Now it no longer loads something from somewhere. I can now actually run a bleeding-edge VLC on a much older base system like this:

QT_PLUGIN_PATH=./lib/x86_64-linux-gnu/qt5/plugins/ ../lib/x86_64-linux-gnu/ld-linux-x86-64.so.2 --library-path '../lib/x86_64-linux-gnu/:./lib/x86_64-linux-gnu/:./lib/'  ./bin/vlc
@probonopd

This comment has been minimized.

Member

probonopd commented Dec 1, 2016

Some experimentation in this regard, using the glibc deb package from, e.g., debian sid:

# This does not work
[me@host ~]$  LD_LIBRARY_PATH=/mnt/usr/lib64/ /mnt/usr/bin/gnome-font-viewer /mnt/usr/bin/gnome-font-viewer: relocation error: /mnt/usr/lib64/libc.so.6: symbol _dl_find_dso_for_object, version GLIBC_PRIVATE not defined in file ld-linux-x86-64.so.2 with link time reference

# This doesn't cut it
[me@host ~]$ LD_LIBRARY_PATH=/mnt/usr/lib64/ '/home/me/Downloads/libc6_2.21-3_amd64/lib/x86_64-linux-gnu/ld-2.21.so' /mnt/usr/bin/gnome-font-viewer /mnt/usr/bin/gnome-font-viewer: relocation error: /mnt/usr/lib64/libc.so.6: symbol _dl_starting_up, version GLIBC_PRIVATE not defined in file ld-linux-x86-64.so.2 with link time reference

# This doesn't cut it either
[me@host ~]$ LD_LIBRARY_PATH='/home/me/Downloads/libc6_2.21-3_amd64/lib/x86_64-linux-gnu':/mnt/usr/lib64/  /mnt/usr/bin/gnome-font-viewer 
/mnt/usr/bin/gnome-font-viewer: relocation error: /home/me/Downloads/libc6_2.21-3_amd64/lib/x86_64-linux-gnu/libc.so.6: symbol _dl_find_dso_for_object, version GLIBC_PRIVATE not defined in file ld-linux-x86-64.so.2 with link time reference

# This works!!! 
# On CentOS 7 I can run gnome-font-viewer from Fedora 23
[me@host ~]$ LD_LIBRARY_PATH='/home/me/Downloads/libc6_2.21-3_amd64/lib/x86_64-linux-gnu':/mnt/usr/lib64/ '/home/me/Downloads/libc6_2.21-3_amd64/lib/x86_64-linux-gnu/ld-2.21.so' /mnt/usr/bin/gnome-font-viewer 
@probonopd

This comment has been minimized.

Member

probonopd commented Feb 7, 2017

https://github.com/matthewbauer/nix-bundle/ creates AppImages that bundle everything, down to ld-linux.so - but are broken in other ways matthewbauer/nix-bundle#8

@probonopd

This comment has been minimized.

Member

probonopd commented Jul 23, 2017

Also check https://github.com/lvml/makeaoi, a tool that bundles "everything"

@probonopd

This comment has been minimized.

Member

probonopd commented Feb 2, 2018

Another option that automates this:

https://github.com/Intoli/exodus#how-it-works

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment