BinForge builds binary datasets from open source projects across compilers, target architectures, optimization levels, and compiler flag sets. It supports configuration driven builds and LLM assisted resolution of build issues.
x86_32x86_64arm_32(little endian)arm_64(little endian)mips_32(little endian)mips_64(little endian)mipseb_32(big endian)mipseb_64(big endian)ppceb_32(big endian)ppceb_64(big endian)ppc_64(little endian)
O0O1O2O3OsOfast
- GCC
gcc-8.5.0gcc-9.5.0gcc-10.5.0gcc-11.5.0gcc-12.4.0gcc-13.3.0
- Clang
clang-7.1.0clang-8.0.1clang-9.0.1clang-10.0.1clang-11.1.0clang-12.0.1clang-13.0.1clang-14.0.6clang-15.0.7clang-16.0.6clang-17.0.6clang-18.1.8clang-19.1.7
- PIE (
pie) - No inlining (
no_inline) - Stack protection (
stack_protector)
combine_extra_compiler_options: false (the default) builds the flag values specified in extra_compiler_options once. Set it to true to build every on/off combination of the options marked true.
Use Ubuntu 24.04 and run these commands from the repository root. A container can be created using the Docker example. Keep the checkout in the same location after building the toolchains because installed compilers can contain absolute paths.
Create a Python 3.12 virtual environment and install the Python requirements:
sudo apt-get update
sudo apt-get install -y python3-venv
python3 -m venv bfenv
source bfenv/bin/activate
python -m pip install -r requirements.txt
python -m pip checkActivate the environment with source bfenv/bin/activate in each new terminal before running the Python commands below.
Install the configured system packages:
python scripts/install_default_packages.py --status
python scripts/install_default_packages.pyBuild the pinned crosstool-ng, GCC, and Clang toolchains. Building all versions takes substantial time and disk space:
python scripts/setup_ctng.py
python scripts/setup_gcc.py --build-bootstrap
python scripts/setup_gcc.py --build-toolchains
python scripts/setup_clang.pyCheck the installations, create the compiler links, and install the wrappers:
python scripts/setup_gcc.py --status
python scripts/setup_clang.py --status
python scripts/link_toolchains.py
python scripts/link_toolchains.py --status
python scripts/setup_wrapper.py --wrap
python scripts/setup_wrapper.py --statuslink_toolchains.py registers system alternatives and may require administrator privileges. To monitor a toolchain build from another terminal, run python scripts/monitor_compilers.py after activating the environment there.
Install the .NET 10 SDK, then install and check the pinned B2R2 tools:
sudo apt-get install -y dotnet-sdk-10.0
python scripts/setup_b2r2.py
python scripts/setup_b2r2.py --statusTo validate a collected dataset later, run python scripts/validate_binaries.py /path/to/dataset/bins.
From the repository root, build the two projects in the smoke configuration:
python scripts/compile.py --config config/examples/binkit-smoke.yaml \
--base-path "$PWD/out/binkit-smoke" --buildThis config requests 216 variants: two projects × four compilers × nine architectures × three optimization levels × one compiler flag set. Outputs go under the Git-ignored out/binkit-smoke/ directory.
For paper reproduction, download paper-sources.tar from the Zenodo record listed in paper sources and place it at ~/archive_binforge/snapshots/paper-sources.tar. BinForge verifies it against the tracked manifest and checksum, then builds without downloading project sources.
Install the required project dependencies first:
python scripts/compile.py --config config/binkit.yaml \
--build-deps --source-mode paper --source-dataset binkit
python scripts/compile.py --config config/popcon.yaml \
--build-deps --source-mode paper --source-dataset popconThen build each dataset in a separate output directory:
python scripts/compile.py --config config/binkit.yaml \
--base-path "$PWD/out/binkit" --build --source-mode paper --source-dataset binkit
python scripts/compile.py --config config/popcon.yaml \
--base-path "$PWD/out/popcon" --build --source-mode paper --source-dataset popconFor ordinary use with the sources specified by a YAML config, omit --source-mode paper and --source-dataset. The default source mode may reuse a local archive. Edit a copy of either config to select fewer projects or build variants.
Run the read-only monitor in another terminal. It finds a single active build automatically and retains the latest completed result:
python scripts/monitor_build.pyIf several builds are active, select one with --base-path. Use python scripts/monitor_compilers.py to monitor toolchain builds.
To generate a build configuration with LLM assistance, supply a config and a local API key file:
python scripts/compile.py --config path/to/config.yaml \
--auto-resolve --llm-api-key-path path/to/api-keyAuto-resolve uses its own dependency state by default. --auto-resolve-use-extra-deps explicitly allows it to use dependencies already installed under tools/extra_deps/.