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 & dev environments.
  • Cross Compiler: sudo apt install g++-aarch64-linux-gnu (Only required for Host builds).

Installation

# Recommended: Install in a virtual environment
pip install .

Usage

The tool uses subcommands: init, status, prep (or sysroot), build, clean, build-dev, and run-dev.

1. Initialize (New Project)

Create a template apt_packages.txt for your dependencies.

cct init

2. Status check

Check the current environment and sysroot staleness.

cct status

3. Build (The Daily Driver)

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

# Basic usage (compiles current directory)
cct build

# Clean build
cct build --clean

# ROS 2 Specific: Build only selected packages
cct build --packages-select my_pkg1 my_pkg2

Common Options:

  • --packages-select: Build specific packages only (colcon only).
  • --packages-up-to: Build specified packages and their dependencies (colcon only).
  • --packages-ignore: Skip specific packages during the build.
  • --clean: Wipe build directory before compiling.
  • --build-tool [colcon|cmake]: Force a specific tool (default: auto).

4. Dev Environment (Docker)

If you don't want to install cross-compilers on your host, or want a reproducible CI environment:

Step 1: Build the environment

# Uses default tag: cross-compile-dev
cct build-dev

Step 2: Enter the environment

# Automatically handles volume mounts
cct run-dev

Inside the container, you are at /ws and can run cct build immediately.

5. Prep (Environment Management)

Explicitly manage the Docker-based sysroot. Note: Prep must be performed on the Host system.

Common Commands (Run on Host):

# Rebuild the sysroot (forced sync from Docker)
cct prep --rebuild

# Build sysroot using a specific packages file
cct prep --packages-file my_deps.txt

# Specify a different base image (e.g., for a different ROS distro)
cct prep --rebuild --base-image ros:humble-ros-base

6. Clean (Artifact Management)

Wipe build and install directories.

# Clean build/install only
cct clean

# Wipe everything (including sysroot)
cct clean --all

Features:

  • Environment Awareness: Identifies if it's running on Host or in Docker and prevents invalid operations.
  • Smart Defaults: Set CCT_BASE_IMAGE or CCT_SYSROOT environment variables to skip long flags.
  • Verbose Mode: Use -v to see detailed Command/Rsync output.
  • Optional Python: Automatically detects and configures Python headers/libraries in the sysroot.

Configuration

Create an apt_packages.txt in your project root to specify dependencies:

libfmt-dev
ros-humble-ros-base
python3-numpy

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.3.tar.gz (14.3 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.3-py3-none-any.whl (14.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: cross_compile_tool-0.1.3.tar.gz
  • Upload date:
  • Size: 14.3 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.3.tar.gz
Algorithm Hash digest
SHA256 94bfe4624a39b0b10a23fb8f1f3f8610703c31cf677274e618aef1e268c39fb3
MD5 d6bec23754e91b95001c49c744d7b815
BLAKE2b-256 9d899186a56fa8a62e350b5c4319aa3cad1dd57679a676e7fd8378c8761d54c6

See more details on using hashes here.

Provenance

The following attestation bundles were made for cross_compile_tool-0.1.3.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.3-py3-none-any.whl.

File metadata

File hashes

Hashes for cross_compile_tool-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 906ff28d2fc0e7d45ae380dc3b928da98d1d13056408ca6a36777c8669334247
MD5 9beba6994aa48ec00b8e0397129a77eb
BLAKE2b-256 718ff546efbaf82b2eef3b31521423249c7ea6f4ae5adb8604bfe286b69fdf51

See more details on using hashes here.

Provenance

The following attestation bundles were made for cross_compile_tool-0.1.3-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