CrossBuild Initial Release
CrossBuild 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