FreeBSD Specific Notes
FreeBSD cross compiler depends on gcc and binutils same as Linux cross-compiler, but unlike Linux cross-compiler, FreeBSD cross-compiler does not depend on glibc. It depends on FreeBSD own libc instead, and FreeBSD libc cannot be built in cross-environment from Windows. So, you have to grab it from installed FreeBSD system.
However, building cross-compiler for FreeBSD is easier than for Linux, because we can bypass Cygwin environment entirely.
Overview of Windows-to-FreeBSD cross-compiler preparation process:
- Install FreeBSD of your target version into the virtual machine
- Grab FreeBSD include files (/usr/include + /usr/local/include), FreeBSD libs (/lib + /libexec + /usr/lib + /usr/local/lib) and FreeBSD locales (/usr/share/locale) from FreeBSD virtual machine. Make sure to dereference symlinks when creating archive (tar -L -zcf ...)
- Download gcc-4.2.1 and binutils-2.16.1 from ftp://ftp.gnu.org/. FreeBSD will never have newer versions of these tools because GNU project switched to GPLv3, and FreeBSD Foundation didn't exactly appreciate that move; so last GPLv2-licensed versions will be used forever (or until LLVM/clang is production ready).
- Prepare MinGW virtual machine as for Linux cross-compiler, but please note that 32-bit FreeBSD target is called "i386-pc-freebsd8" or "i386-pc-freebsd9", 64-bit FreeBSD target is called "amd64-pc-freebsd8" or "amd64-pc-freebsd9". Unpack files grabbed from FreeBSD into /opt/crosstool/gcc-4.2.1-freebsd8/*-pc-freebsd8 or /opt/crosstool/gcc-4.2.1-freebsd9/*-pc-freebsd9.
- Rename "usr" folder under FreeBSD cross-root into "i386-pc-freebsd?" or "amd64-pc-freebsd?"
- Binutils and GCC are configured as for Linux, except "--with-arch=i486" option can be omitted.
- Run build_gcc_cross.cmd, strip and test as for Linux.
>> Look at screenshots or
buy already prepared
cross-compiler (€10) to save your time.