Container bases for cross-compiling for ARMv7 and i686 targets on an x86-64 host.
Go to file
Anthony J. Martinez 356586baa7
Update README.md
2021-08-28 12:33:47 +02:00
docker Initial commit 2021-08-28 12:25:48 +02:00
example Initial commit 2021-08-28 12:25:48 +02:00
LICENSE-APACHE Initial commit 2021-08-28 12:25:48 +02:00
LICENSE-MIT Initial commit 2021-08-28 12:25:48 +02:00
README.md Update README.md 2021-08-28 12:33:47 +02:00

README.md

Cross Build

Provides a Dockerfile to build a container that supports cross compilation for ARMv7 and i686 targets from x86-64 hosts.

This project was created out of a need to have a single-shot process for building a few Rust projects with stripped binaries featuring static C-runtimes for:

  • armv7-unknown-linux-gnueabihf
  • i686-unknown-linux-gnu

While cross exists, and is far more full featured, the project lags behind in updating the base OS, GCC, and QEMU versions used (as of this writing).

An example exists that handles my specific use case for one project, and might serve as inspiration for modifications to suit more complicated needs.

Building

Using podman since I do not have docker itself installed:

# Assuming you have cloned this repository and are in the repo
$ cd docker
$ podman build -t crossbuild:dev -f ./Dockerfile

Use

Again using podman and assuming you're in the repository:

$ podman run --rm \
	-e REPO_URL="https://git.staart.one/ajmartinez/connchk.git" \
	-e BIN_NAME="connchk" -v ./example/:/opt/build \
	crossbuild:dev /opt/build/rust-job.sh

# ...

$ tree example
example/
├── armv7-unknown-linux-gnueabihf_connchk
├── i686-unknown-linux-gnu_connchk
└── rust-job.sh

$ file example/*_connchk
example/armv7-unknown-linux-gnueabihf_connchk: ELF 32-bit LSB executable, ARM, EABI5 version 1 (GNU/Linux), statically linked, BuildID[sha1]=00811fa9637b6abf243fb707a8970b0cea43ba4f, for GNU/Linux 3.2.0, stripped
example/i686-unknown-linux-gnu_connchk:        ELF 32-bit LSB executable, Intel 80386, version 1 (GNU/Linux), statically linked, BuildID[sha1]=6e1d92bb01aed5b0adb673b1dfbe5fb28cf5da18, for GNU/Linux 3.2.0, stripped

License

Licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.