Skip to main content

StaticX Build Status PyPI

Bundle dynamic executables with their library dependencies so they can be run anywhere, just like a static executable.

Requirements

StaticX currently works only with Linux 64-bit dynamic executables.

The following external tools need to be installed to run StaticX:

  • ldd - Part of GNU C Library
  • readelf - Part of binutils
  • objcopy - Part of binutils
  • patchelf
    • Packages available for Debian 8+, Fedora 14+, others
    • install with pip install patchelf-wrapper

The following additional tools must be installed to build StaticX from source:

Installation

From PyPI

StaticX is avaiable on PyPI. The wheels are built on Travis CI and include a bootloader built with musl-libc.

You can install using Pip. StaticX is compatible with Python Python 3.5+ (pip3):

sudo pip3 install staticx

From source

If you have musl libc installed, you can use it to build the staticx bootloader, resulting in smaller, better binaries. To do so, set the BOOTLOADER_CC environment variable to your musl-gcc wrapper path wehn invoking pip or setup.py:

sudo BOOTLOADER_CC=/usr/local/musl/bin/musl-gcc pip3 install https://github.com/JonathonReinhart/staticx/archive/master.zip
cd staticx
sudo BOOTLOADER_CC=/usr/local/musl/bin/musl-gcc pip3 install .

Usage

Basic wrapping of an executable

staticx /path/to/exe /path/to/output

StaticX will automatically discover and bundle most normal linked libraries. However, libraries loaded by an application at runtime via dlopen() cannot currently be detected. These can be manually included in the application bundle by using the -l option (any number can be specified by repeating the -l option).

staticx -l /path/to/fancy/library /path/to/exe /path/to/output

Caveats

StaticX employs a number of tricks to run applications with only their bundled libraries to ensure compatibilitiy. Because of this, there are some caveats that apply to StaticX-bundled applications:

  • The dynamic linker is instructed (via nodeflib) to only permit bundled libraries to be loaded.
  • Target NSS configuration (/etc/nsswitch.conf) is ignored (for GLIBC-linked applications) which means that some advanced name services (e.g. Active Directory) will not be available at runtime. For example, looking up the UID number of a domain user will not work.

Run-time Information

StaticX sets the following environment variables for the wrapped user program:

  • STATICX_BUNDLE_DIR: The absolute path of the "bundle" directory, the temporary dir where the archive has been extracted.
  • STATICX_PROG_PATH: The absolute path of the program being executed.

License

This software is released under the GPLv2, with an exception allowing the bootloader to be distributed. See LICENSE.txt for more details.

Release files for staticx 0.12.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for staticx 0.12.0
File Size Uploaded
staticx-0.12.0.tar.gz 62.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for staticx 0.12.0
File Interpreter ABI Platform
staticx-0.12.0-py3-none-manylinux1_x86_64.whl Python 3 none Linux glibc 2.5+ x86-64 Details

Total release size:217.0 kB

Release files / staticx-0.12.0.tar.gz

Download URL staticx-0.12.0.tar.gz
Size 62.7 kB
Tags Source
SHA-256 checksum
How to use checksums
91261695101ff5e8a321f08b572088c1831185e4092e0d843b9ffba42dd8a8c2
BLAKE2b-256 checksum
How to use checksums
890e204a1f89b73f8cb9a84663d83d328db79f2d5e83228c836f29439486e9ee
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.50.0 CPython/3.6.7

Release files / staticx-0.12.0-py3-none-manylinux1_x86_64.whl

Download URL staticx-0.12.0-py3-none-manylinux1_x86_64.whl
Size 154.3 kB
Tags Linux glibc 2.5+ x86-64 Python 3
SHA-256 checksum
How to use checksums
9248839ac89e8972c5d0a8829a7355348a6bea639f2467d6d576bbd43e73335f
BLAKE2b-256 checksum
How to use checksums
02db330cdb746f9f16b04de3d4b0c24381b2d0c6f87b6260fe48ebdd0be665c2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.50.0 CPython/3.6.7

Release history Release notifications | RSS feed

0.14.2

2 release files

0.14.0

2 release files

0.13.9

2 release files

0.13.5

2 release files

0.13.4

2 release files

0.13.3

2 release files

0.12.2

2 release files

This release

0.12.0 This release

2 release files

0.11.0

2 release files

0.10.0

2 release files

0.9.1

2 release files

0.9.0

2 release files

0.8.1

2 release files

0.8.0

2 release files

0.7.0

2 release files

0.6.0

2 release files

0.5.0

2 release files

0.4.1

2 release files

0.3.2

2 release files

0.3.1

2 release files

0.3.0

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page