Skip to content

Investigate bundling BenchExec+Python #1243

Open

Description

@PhilippWendler

For situations where a (modern) Python is not available, it would be convenient if one can execute BenchExec (or at least runexec) as a tool with as few dependencies as possible. Not sure if this is really feasible, but we should investigate.

Possible variants of this:

  • A ZIP with a bundled Python and BenchExec, potentially even with a static build of Python, or one that only depends on an (old) libc.
  • BenchExec compiled to native code.

Activity

  1. saurabh12nxf commented on Dec 19, 2025

    @saurabh12nxf
    Contributor

    Hi @PhilippWendler ,

    I’d like to investigate this. My plan is to compare PyInstaller, Nuitka, and staticx to see which one best handles BenchExec's specific challenges—particularly the heavy ctypes usage for Linux syscalls/namespaces and the dynamic loading of tool modules.

    I will start by attempting to bundle just runexec as a proof-of-concept, as it should be simpler than the full suite.

    A few quick questions before I dive in: 1. Is a binary size of ~50-100MB acceptable? 2. Do you have a specific minimum target OS or glibc version in mind (e.g., Ubuntu 18.04)?

  2. PhilippWendler commented on Dec 19, 2025

    @PhilippWendler
    MemberAuthor

    I’d like to investigate this. My plan is to compare PyInstaller, Nuitka, and staticx to see which one best handles BenchExec's specific challenges—particularly the heavy ctypes usage for Linux syscalls/namespaces and the dynamic loading of tool modules.

    Thanks! I agree with you.

    I will start by attempting to bundle just runexec as a proof-of-concept, as it should be simpler than the full suite.

    Yes. And actually runexec is the most important part for this.

    1. Is a binary size of ~50-100MB acceptable?

    Certainly. If we manage to do this at all, size is secondary.

    1. Do you have a specific minimum target OS or glibc version in mind (e.g., Ubuntu 18.04)?

    Not really so far. The less dependencies the better, but there might be a tradeoff with effort, we have to see. Yesterday we had a use case where it would have been handy to run runexec on Ubuntu 20.04 (where Python is too old).

  3. saurabh12nxf commented on Jan 3, 2026

    @saurabh12nxf
    Contributor

    Investigation Complete ✅

    Hi @PhilippWendler,

    I've successfully implemented bundling of runexec using PyInstaller and created a pull request.

    Results

    Approach: PyInstaller
    Binary Size: 17 MB (well under the 50-100MB acceptable limit)
    Dependencies: Only standard system libraries (libc, libdl, libz, libpthread)
    Build Time: ~30 seconds

    Testing Results

    ✅ All core features working:

    • Version check and help
    • Command execution
    • Resource limits (--memlimit, --timelimit)
    • Cgroups support and resource measurement
    • Container mode (on native Linux)

    Implementation

    Files added:

    • bundling_investigation/build_bundle.sh - Production build script
    • bundling_investigation/runexec.spec - PyInstaller configuration
    • bundling_investigation/test_pyinstaller.sh - Testing script
    • doc/bundling.md - Comprehensive user documentation
    • bundling_investigation/README.md - Investigation results

    Usage:

    cd bundling_investigation
    ./build_bundle.sh
    ./dist/runexec --version
  4. PhilippWendler commented on Jan 19, 2026

    @PhilippWendler
    MemberAuthor

    For the record: I just found BriefCase, which might also be a solution.

  5. saurabh12nxf commented on Jan 21, 2026

    @saurabh12nxf
    Contributor

    Hi @PhilippWendler ,

    Thanks for sharing! I wasn't aware of BriefCase.

    From a quick look, it seems like an interesting alternative. Since PyInstaller is working well for our current use case (17MB binary, all features working), we could keep BriefCase in mind for future improvements or if we encounter any limitations with PyInstaller.

    Would you like me to do a quick comparison/investigation of BriefCase vs our current PyInstaller approach, or is the current solution sufficient for now?

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions