Use zig to easily cross-compile C programs for other architectures.
Install zig
using asdf.
CC="zig cc -target arm-linux-musleabi -static" make clean all
CC="zig cc -target aarch64-linux-musl -static" make clean all
CC="zig cc -target x86_64-linux-musl -static" make clean all
$ git clone https://github.com/msantos/runcron.git
$ cd runcron
$ CC="zig cc -target arm-linux-musleabi -static" make clean all
The compiled binary:
$ ldd runcron
not a dynamic executable
$ file runcron
runcron: ELF 32-bit LSB shared object, ARM, EABI5 version 1 (SYSV), dynamically linked, with debug_info, not stripped
$ uname -m # host arch
x86_64
(markdown)