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: build, sysroot, build-dev, and run-dev.

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

# ROS 2 Specific: Build only selected packages
cross-compile-tool 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).

2. 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
cross-compile-tool build-dev

Step 2: Enter the environment

# Automatically handles volume mounts
cross-compile-tool run-dev

Inside the container, you are at /ws and can run cross-compile-tool build immediately.

3. Sysroot (Environment Management)

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

Common Commands (Run on Host):

# Rebuild the sysroot (forced sync from Docker)
cross-compile-tool sysroot --rebuild

# Build sysroot using a specific packages file
cross-compile-tool sysroot --packages-file my_deps.txt

# Specify a different base image (e.g., for a different ROS distro)
cross-compile-tool sysroot --rebuild --base-image ros:humble-ros-base

Features:

  • Environment Awareness: The tool identifies if it's running on Host or in Docker and prevents invalid operations (like generating sysroots inside the container).
  • Staleness Check: Tracks dependencies using hashes and warns you if your sysroot needs an update.
  • 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.2.tar.gz (11.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.2-py3-none-any.whl (12.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: cross_compile_tool-0.1.2.tar.gz
  • Upload date:
  • Size: 11.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.2.tar.gz
Algorithm Hash digest
SHA256 ca2c238947a736a110520d24bed274d6bd1d44ae3bbb549a77e39b822be0e007
MD5 7ada2f9f3879978208b7a270a8153f91
BLAKE2b-256 bed2ada14219e19523f7df1842a0258a558d0476ec35107dfe0bbc110c246b13

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for cross_compile_tool-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 c8f33d1d843fc24af4b3db65d6ab313ffb227bc1ca62431d37d76eaaba47fe70
MD5 22ac2c24785e09305328dd004d4487cf
BLAKE2b-256 b19f730974ffc64675c9168514bb405b80251e659e7184a33ac2696c443356a4

See more details on using hashes here.

Provenance

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