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:
- Prepare Sysroot: Run
cct prep --rosdepon your Host system (e.g.,cct prep --base-image ros:jazzy-ros-base --rosdep). - Build Dev Image: Run
cct build-devto create the cross-compilation container. - Enter Environment: Run
cct run-devto start and enter the container. - Compile: Run
cct buildinside the container to compile your project.
5. Packaging (Debian)
Generate a Debian package for the target architecture.
# Automatically detects ROS distro (Humble, Jazzy, Kilted, Rolling) and builds the .deb
cct deb
Note: Sysroot generation (via cct prep) must be run on the Host system. Once you have a populated sysroot, you can run cct deb anywhere.
🛠 Advanced Features
- Status Check:
cct statusto verify environment and sysroot staleness. - Selective Build:
cct build --packages-select pkg1(colcon only). - Environment Variables: Use
CCT_BASE_IMAGEorCCT_SYSROOTto skip flags. - CI/CD: Run
cct prepon the runner host, then mountsysroot_arm64into your build. - Multi-Package Projects: Put multiple packages in
src/(for colcon) or use a rootCMakeLists.txtwithadd_subdirectory()(for cmake).
🧹 Cleanup
cct clean # Remove build/install artifacts
cct clean --all # Also wipe the sysroot
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.2.0.tar.gz.
File metadata
- Download URL: cross_compile_tool-0.2.0.tar.gz
- Upload date:
- Size: 17.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4b83afb2057ab716c41732dd3d701c1ba076e03a6f1e04a783a5f4efefea771c
|
|
| MD5 |
99af74541ed90b7592c2d6d40dacee3b
|
|
| BLAKE2b-256 |
610724a5cbe61bda06fbb837b7f11c9ce1b682b12d992838e8bce8610f953c80
|
Provenance
The following attestation bundles were made for cross_compile_tool-0.2.0.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.2.0.tar.gz -
Subject digest:
4b83afb2057ab716c41732dd3d701c1ba076e03a6f1e04a783a5f4efefea771c - Sigstore transparency entry: 983346567
- Sigstore integration time:
-
Permalink:
Benjamin-Tan/cross-compile-tool@4bfbba9644938b6ee268aff85c464029900d63bd -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/Benjamin-Tan
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi-publish.yml@4bfbba9644938b6ee268aff85c464029900d63bd -
Trigger Event:
push
-
Statement type:
File details
Details for the file cross_compile_tool-0.2.0-py3-none-any.whl.
File metadata
- Download URL: cross_compile_tool-0.2.0-py3-none-any.whl
- Upload date:
- Size: 17.6 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 |
1d885d48dabc04f8c3920e9388dd948fc17cc646b658151af86e33e29c837c5b
|
|
| MD5 |
2ddf04f77f90c0946a6520f24dd7287d
|
|
| BLAKE2b-256 |
1bb770a03060f51d79fbe2f363c8cbfcd7e4eca638e9cd425dabaf2d8c9b5bd3
|
Provenance
The following attestation bundles were made for cross_compile_tool-0.2.0-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.2.0-py3-none-any.whl -
Subject digest:
1d885d48dabc04f8c3920e9388dd948fc17cc646b658151af86e33e29c837c5b - Sigstore transparency entry: 983346585
- Sigstore integration time:
-
Permalink:
Benjamin-Tan/cross-compile-tool@4bfbba9644938b6ee268aff85c464029900d63bd -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/Benjamin-Tan
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi-publish.yml@4bfbba9644938b6ee268aff85c464029900d63bd -
Trigger Event:
push
-
Statement type: