Create fat binaries with ease.
Project description
Create fat binaries with ease
This script is not a development of 2020, this GitHub repository could create a false impression. It was lurking around on my computer for years, because I never thought it was quite finished, and therefore never got around to releasing it. In truth it worked the whole time for the current set of features, and I wanted to add some more before releasing it.
This script can be a great alternative to static compilation, or to cases where you have a dynamically linked binary, that you’d like to port to other systems, but you aren’t willing to compile from source, or for some reason can’t. To make this work preloadify uses LD_PRELOAD, a unpacking/run script at the beginning of the created binary, tar, optional compression, and patchelf.
Preloadify goes so far as to include the ld.so in the created binary (which is a sort of self-contained package) in order to make absolutely sure that it will run on every Linux system with compatible processor architecture, in example all 64bit-x86 Linux systems. This allows for porting binaries from a full-fledged GNU/Linux to a bare-bones embedded Linux system, that has for example BusyBox, or some uncommon libc, or no ld.so at all.
The –pack command line option allows you to pack other binaries into the same final fat binary, the kicker here is that for those additional binaries preloadify also searches for needed dynamic libraries and packs them into the fat binary, too. This means that the executable you wanted to convert into a fat executable can also call those other packed executables at runtime and they are also garantueed not to be missing any dynamic library dependencies.
Dependencies: - docopt (pip3 install docopt) - patchelf - tar
The help output (preloadify –help) should be sufficient to understand how it works:
Usage: preloadify [options] EXECUTABLE OUTPUTFILE Create an executable self-containing all dynamic library dependencies of the original. Options: -l, --list Alphabetically sorted list of all dynamic libraries that are included in the preloadified executable. -s, --size Lists the size of all dynamic libraries included in the preloadified executable sorted by size. -b, --blacklist FILE Using a blacklist you can exclude dynamic libraries from being included in the preloadified executable. Blacklist files have the following format: libsomelib libsomeotherlib -a, --addlist FILE Include libraries and their respective dependencies from a list in preloadified executable. These usually are libraries that get dynamically linked at runtime. Addlist files have the following format: libsomelib libsomeotherlib /path/to/lib -c, --compression METHOD One of gzip, bzip2 and xz. By default compression is disabled. Note that compression can influence portability negatively. -t, --tmpdir TMPDIR Set a different tmp directory. Default is /tmp. -r, --run Run preloadified executable as soon as it is created. (For testing purposes) --chrootify With this option the wrapper creates a chroot environment for the executable emulating the system without its libraries. This can be useful to test whether all library dependencies have been taken care of through preloadifying. --pack EXECUTABLES List of additional executables that should be part of the preloadified executable separated by comma. i.e. --pack bash,/path/to/program Note that only the main executable will be executed when executing the generated outputfile. -h, --help Show this help message and exit -v, --version Display version information
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file preloadify-1.0.tar.gz
.
File metadata
- Download URL: preloadify-1.0.tar.gz
- Upload date:
- Size: 6.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.6.0 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.7.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 80c08540079549b09e87e9d1ba829582fc646fc0c582d9e5d31a8cf968a561d8 |
|
MD5 | 7aba58cd3a008853b33cd6d59be26508 |
|
BLAKE2b-256 | eb09c318b18183b1da2fc379be4310a48d9c1747ffd7ccdd5f33331bded60f15 |