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.txtusing hashes. Thebuildcommand 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).
-
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
-
Run with Auto-Mounting: The build command above outputs the exact run command you need. It handles the
HOST_WORKSPACEmapping 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
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.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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6168fa06b8c6f0964ede1762592bcf67b75b21850c84136cab5337a04aa3126f
|
|
| MD5 |
3e86481e4fee20b23d377b2ca1b8f3da
|
|
| BLAKE2b-256 |
81a10d7055b2d6788dfeee8f517a9c2a1be00cabe87a27a7393a3e0c5fd10d2b
|
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
-
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.1.tar.gz -
Subject digest:
6168fa06b8c6f0964ede1762592bcf67b75b21850c84136cab5337a04aa3126f - Sigstore transparency entry: 788338620
- Sigstore integration time:
-
Permalink:
Benjamin-Tan/cross-compile-tool@320bf6a61dc3e8865bfc2fce0df802f63fc48bbd -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/Benjamin-Tan
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi-publish.yml@320bf6a61dc3e8865bfc2fce0df802f63fc48bbd -
Trigger Event:
push
-
Statement type:
File details
Details for the file cross_compile_tool-0.1.1-py3-none-any.whl.
File metadata
- Download URL: cross_compile_tool-0.1.1-py3-none-any.whl
- Upload date:
- Size: 11.1 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 |
a13f1db476570d61d732116c0025b63911fce5d9a3014aefeae1a62b762adc43
|
|
| MD5 |
f03e357cd65af7c6850887ddfa5e1722
|
|
| BLAKE2b-256 |
e66684648dd11e1d000e99085b6324c62bb8b1d53182d0af5f7a2cb611f7038b
|
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
-
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.1-py3-none-any.whl -
Subject digest:
a13f1db476570d61d732116c0025b63911fce5d9a3014aefeae1a62b762adc43 - Sigstore transparency entry: 788338623
- Sigstore integration time:
-
Permalink:
Benjamin-Tan/cross-compile-tool@320bf6a61dc3e8865bfc2fce0df802f63fc48bbd -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/Benjamin-Tan
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi-publish.yml@320bf6a61dc3e8865bfc2fce0df802f63fc48bbd -
Trigger Event:
push
-
Statement type: