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_IMAGEorCCT_SYSROOTenvironment variables to skip long flags. - Verbose Mode: Use
-vto 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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
94bfe4624a39b0b10a23fb8f1f3f8610703c31cf677274e618aef1e268c39fb3
|
|
| MD5 |
d6bec23754e91b95001c49c744d7b815
|
|
| BLAKE2b-256 |
9d899186a56fa8a62e350b5c4319aa3cad1dd57679a676e7fd8378c8761d54c6
|
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
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
cross_compile_tool-0.1.3.tar.gz -
Subject digest:
94bfe4624a39b0b10a23fb8f1f3f8610703c31cf677274e618aef1e268c39fb3 - Sigstore transparency entry: 947472359
- Sigstore integration time:
-
Permalink:
Benjamin-Tan/cross-compile-tool@18da382e2919e56e235ee33696833c0faed226a8 -
Branch / Tag:
refs/tags/v0.1.3 - Owner: https://github.com/Benjamin-Tan
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi-publish.yml@18da382e2919e56e235ee33696833c0faed226a8 -
Trigger Event:
push
-
Statement type:
File details
Details for the file cross_compile_tool-0.1.3-py3-none-any.whl.
File metadata
- Download URL: cross_compile_tool-0.1.3-py3-none-any.whl
- Upload date:
- Size: 14.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
906ff28d2fc0e7d45ae380dc3b928da98d1d13056408ca6a36777c8669334247
|
|
| MD5 |
9beba6994aa48ec00b8e0397129a77eb
|
|
| BLAKE2b-256 |
718ff546efbaf82b2eef3b31521423249c7ea6f4ae5adb8604bfe286b69fdf51
|
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
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
cross_compile_tool-0.1.3-py3-none-any.whl -
Subject digest:
906ff28d2fc0e7d45ae380dc3b928da98d1d13056408ca6a36777c8669334247 - Sigstore transparency entry: 947472363
- Sigstore integration time:
-
Permalink:
Benjamin-Tan/cross-compile-tool@18da382e2919e56e235ee33696833c0faed226a8 -
Branch / Tag:
refs/tags/v0.1.3 - Owner: https://github.com/Benjamin-Tan
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi-publish.yml@18da382e2919e56e235ee33696833c0faed226a8 -
Trigger Event:
push
-
Statement type: