sharun allows for the execution of dynamically linked ELF binaries on various architectures, leveraging userland-execve to handle dependencies efficiently. By mapping interpreters into memory and organizing necessary libraries, it simplifies the process of running applications without compatibility issues, enhancing development and deployment versatility.
sharun allows users to run dynamically linked ELF binaries on various platforms, providing support for both musl and glibc. This tool operates by utilizing userland-execve, which maps the interpreter (e.g., ld-linux-x86-64.so.2) into memory. It then constructs a stack that includes the auxiliary vector, command-line arguments, and environment variables, before executing the binary.
bin, shared/{bin,lib,lib32} directories, and generates a lib.path file that lists paths to relevant libraries, formatted for interpreter compatibility.aarch64x86_64To create portable binaries with sharun and manage dependencies using lib4bin, users can utilize commands like the following:
# Create a package of the /bin/bash executable:
./sharun lib4bin --with-sharun --dst-dir test /bin/bash
# Generate hard links for better compatibility:
./sharun lib4bin --hard-links --dst-dir test /bin/bash
After running these commands, the output directory can be transferred across different Linux systems where the binaries can be executed seamlessly:
# Execute the bash version from the new directory:
./test/bin/bash --version
sharun also supports packaging applications into a single executable alongside necessary dependencies. By leveraging wrappe, users can combine multiple binaries or even Python applications into a single file:
# Packing multiple executables into a single file:
./sharun lib4bin --with-wrappe --dst-dir test /bin/bash /bin/env /bin/ls
# Specific entrypoint packing:
./sharun lib4bin --wrappe-exec bash --dst-dir test /bin/bash /bin/env /bin/ls
Several environment variables can be configured to customize the behavior of sharun and the binaries, enabling control over paths, compatibility, and more.
Further details on employing and configuring sharun can be found in the extensive README and the documentation provided within the repository. For practical implementations, this is a valuable resource to explore projects that utilize sharun effectively, including SoarPkgs and AnyLinux-AppImages.
With sharun, running ELF binaries becomes straightforward, enhancing the portability of Linux applications.
No comments yet.
Sign in to be the first to comment.