On Sun, 30 Jul 2017 at 19:34:42 +0900, Benda Xu wrote: > As far as I can see, the easiest relocations are those modifiable in a > plain text, like configuration file, script shebang, etc. The medium > ones are ELF, with which we have tools like patchelf and chrpath, etc. > The most difficult part includes quite a few hidden path assumptions > that can only be specified at build time, like the default GCC include > dir. I don't know whether distributing binary packages can alleviate > the barrier. Chances are many patches are needed to be carried to be > able to override paths at run time.
Lots of packages hard-code paths at build time. This is often not considered to be a bug. Flatpak's approach to this is to use bind-mounts (in a new mount namespace set up by bubblewrap) so that the "app" (the leaf package, together with any libraries that are bundled with it) always appears to be installed in --prefix=/app, which can safely be hard-coded into binaries that are built as Flatpak apps. Flatpak apps are normally recompiled from source with --prefix=/app, but I don't think it's coincidental that /app is the same length as /usr and can therefore be patched in with a binary editor as a last resort :-) S