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 qemu-user-static (Required for Host builds and Docker ARM64 emulation).

Installation

# Recommended: Install in a virtual environment
pip install .

Usage

The tool uses subcommands: init, status, prep, 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)
# Results go into build_arm64/ and install_arm64/
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. Docker-based Development

For a reproducible environment without installing cross-compilers on your host:

  1. Prepare Sysroot: Run cct prep (e.g., cct prep --base-image ros:humble-ros-base) on your Host system.
  2. Build Dev Image: Run cct build-dev to create the cross-compilation container.
  3. Enter Environment: Run cct run-dev to start and enter the container.
  4. Compile: Run cct build inside the container to compile your project.

Note: Your project directory and sysroot are automatically mounted into the container.


🛠 Advanced Features

  • Status Check: cct status to verify environment and sysroot staleness.
  • Selective Build: cct build --packages-select pkg1 (colcon only).
  • Environment Variables: Use CCT_BASE_IMAGE or CCT_SYSROOT to skip flags.
  • CI/CD: Run cct prep on the runner host, then mount sysroot_arm64 into your build.
  • Multi-Package Projects: Put multiple packages in src/ (for colcon) or use a root CMakeLists.txt with add_subdirectory() (for cmake).

🧹 Cleanup

cct clean          # Remove build/install artifacts
cct clean --all    # Also wipe the sysroot

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: cross_compile_tool-0.1.8.tar.gz
  • Upload date:
  • Size: 14.7 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.8.tar.gz
Algorithm Hash digest
SHA256 60e01f160a7363f9eed36d4d61229eddaf50bb9d69de55b5b2219c7738e1b2b4
MD5 722e09d3a6b9f4032e50335f7cdc9aef
BLAKE2b-256 4ed3113473c418e14b9692c1ee701c7a67531713b3cf8ab570befe9e937ccb34

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for cross_compile_tool-0.1.8-py3-none-any.whl
Algorithm Hash digest
SHA256 fd4269e15d13b14c2cbff4f1bd871de069a0e173c0f5a953c368155590181622
MD5 52da3b58d4811d618c8195e6d710b7ba
BLAKE2b-256 482f23b1e1c865d27aaff1fa469762e96501ab2023037d370bea0050ac1a1f48

See more details on using hashes here.

Provenance

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