This creates a container that can be used to cross-compile FreeBSD binaries natively on Linux.
docker build -t freebsd-cross .
docker run --rm -it freebsd-cross bash
There is /freebsd/bin on the path. It has all of the build tools (e.g. x86_64-pc-freebsd12-gcc)
It is likely you would add a
-v switch to the run (to put your
code on a mount).
There is a second Dockerfile that can be used to cross-compile FreeBSD Rust binaries.
docker build -f Dockerfile.rust -t freebsd-cross-rust .
See the following script for an example of its use on a Rust project: