FreeBSD - saprykin/plibsys GitHub Wiki

Configurations

Version Compilers Status Tests
14.1 (x64) GCC 4.8.5 (x64) Compiled Passed
14.1 (x64) GCC 13.3.0 (x64) Compiled Passed
14.1 (x64) Clang 18.1.8 (x86, x64) Compiled Passed

Installation

FreeBSD can be downloaded from the official page. After installation you can use available binary packages or build ports from source to get required software. Read more about package management on FreeBSD. GCC and Clang are all distributed through the packages.

To compile and run x86 software on x64 host you need to install lib32 package first (can be also done in more recent versions of the installer). You can download archive from the ftp and install it manually using tar -xfp lib32.txz command. Pass -m32 flag to compilers for x86 target. Latest versions of FreeBSD use Clang as default compiler, so you may need to build your own GCC with x86 target support.

QEMU and x64

FreeBSD can be run in QEMU, see example for x64 build below:

qemu-system-x86_64 -m 2048 -M pc -smp cpus=2,sockets=1,cores=2,threads=1 \
  -drive media=cdrom,if=none \
  -drive file=freebsd.qcow2 \
  -nic user,model=e1000,hostfwd=tcp::10022-:22

QEMU and AArch64

FreeBSD runs well on AArch64 machines, refer to FreeBSD wiki for more information and examples. Below is an example for Apple M1/M2 machines:

qemu-system-aarch64 -m 2048M -cpu host -M virt,accel=hvf \
        -bios edk2-aarch64-code.fd \
        -serial telnet::4444,server \
        -nographic \
        -drive if=virtio,file=freebsd.qcow2.aarch64,id=hd0 \
        -drive media=cdrom,if=none \
        -device virtio-net,netdev=net0 \
        -netdev user,id=net0

GCC

You should not have any problems compiling with GCC.

Clang

You should not have any problems compiling with Clang.