🌍 multiarch cross compiling environments
This is a multiarch Docker build environment image. You can use this image to produce binaries for multiple architectures.
Triple | Aliases | linux | freebsd |
---|---|---|---|
x86_64-linux-gnu | (default), linux, amd64, x86_64 | ✔ | |
arm-linux-gnueabihf | armhf, armv7, armv7l | ✔ | |
aarch64-linux-gnu | arm64, aarch64 | ✔ | |
x86_64-pc-freebsd14 | freebsd | ✔ |
$ docker run --rm -v $(pwd):/workdir authelia/crossbuild make helloworld
cc helloworld.c -o helloworld
$ file helloworld
helloworld: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.32, BuildID[sha1]=9cfb3d5b46cba98c5aa99db67398afbebb270cb9, not stripped
Misc: using cc
instead of make
$ docker run --rm -v $(pwd):/workdir authelia/crossbuild cc test/helloworld.c
$ docker run --rm -v $(pwd):/workdir -e CROSS_TRIPLE=arm-linux-gnueabihf authelia/crossbuild make helloworld
$ docker run --rm -v $(pwd):/workdir -e CROSS_TRIPLE=aarch64-linux-gnu authelia/crossbuild make helloworld
$ docker run -it --rm -v $(pwd):/workdir -e CROSS_TRIPLE=x86_64-pc-freebsd14 authelia/crossbuild make helloworld
This project is inspired by the cross-compiler by the venerable Steeve Morin
MIT