Skip to main content

A generic fast cross-compilation tool using Docker and Sysroots

Project description

cross-compile-tool

A blazing fast, generic cross-compilation utility for C++ and ROS 2. It uses Docker to generate an ARM64 sysroot and standard native tools (GCC/Ninja) for compilation.

Prerequisites

  • Docker: For building the sysroot (only runs when needed).
  • Cross Compiler: sudo apt install g++-aarch64-linux-gnu

Installation

# Recommended: Install in a virtual environment
pip install .

Usage

The tool uses subcommands: build (for compiling) and sysroot (for environment management).

1. Build (The Daily Driver)

Compiles your code. It automatically builds the sysroot if it's missing.

# Basic usage (compiles current directory)
cross-compile-tool build

Common Options:

  • --clean: Wipe build directory before compiling.
  • --build-tool [colcon|cmake]: Force a specific build tool (default: auto).
  • --build-dir: Customize output directory (default: build_arm64).

2. Sysroot (Environment Management)

Explicitly manage the Docker-based sysroot. Use this when you update your dependencies.

Step 1: Create apt_packages.txt in your project root:

libfmt-dev
ros-humble-ros-base

Step 2: Rebuild the sysroot:

cross-compile-tool sysroot --rebuild --packages-file apt_packages.txt

Features:

  • Robustness: Uses a temporary build context, keeping your source tree clean.
  • Staleness Check: Tracks apt_packages.txt using hashes. The build command will warn you if your sysroot is out of date.
  • Optional Python: Automatically detects Python in the sysroot. If missing, it disables Python support in the toolchain (safe for pure C++).

Advanced: CI / Dev Workflow

The tool includes a built-in development environment (Docker).

  1. Build the Dev Image:

    # Default uses ros:humble. You can specify another base image.
    cross-compile-tool build-dev --tag my-ci-image --base-image ros:humble
    
  2. Run with Auto-Mounting: The build command above outputs the exact run command you need. It handles the HOST_WORKSPACE mapping automatically for Docker-in-Docker support.

    docker run -it --rm \
      -v /var/run/docker.sock:/var/run/docker.sock \
      -v $(pwd):/ws \
      -e HOST_WORKSPACE=$(pwd) \
      my-ci-image \
      bash -c "pip install . && cross-compile-tool build"
    

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cross_compile_tool-0.1.1.tar.gz (10.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cross_compile_tool-0.1.1-py3-none-any.whl (11.1 kB view details)

Uploaded Python 3

File details

Details for the file cross_compile_tool-0.1.1.tar.gz.

File metadata

  • Download URL: cross_compile_tool-0.1.1.tar.gz
  • Upload date:
  • Size: 10.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for cross_compile_tool-0.1.1.tar.gz
Algorithm Hash digest
SHA256 6168fa06b8c6f0964ede1762592bcf67b75b21850c84136cab5337a04aa3126f
MD5 3e86481e4fee20b23d377b2ca1b8f3da
BLAKE2b-256 81a10d7055b2d6788dfeee8f517a9c2a1be00cabe87a27a7393a3e0c5fd10d2b

See more details on using hashes here.

Provenance

The following attestation bundles were made for cross_compile_tool-0.1.1.tar.gz:

Publisher: pypi-publish.yml on Benjamin-Tan/cross-compile-tool

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file cross_compile_tool-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for cross_compile_tool-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 a13f1db476570d61d732116c0025b63911fce5d9a3014aefeae1a62b762adc43
MD5 f03e357cd65af7c6850887ddfa5e1722
BLAKE2b-256 e66684648dd11e1d000e99085b6324c62bb8b1d53182d0af5f7a2cb611f7038b

See more details on using hashes here.

Provenance

The following attestation bundles were made for cross_compile_tool-0.1.1-py3-none-any.whl:

Publisher: pypi-publish.yml on Benjamin-Tan/cross-compile-tool

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page