FreeBSD 13 is still supported as of this writing (much to the chagrin of the KDE-FreeBSD folks, who would like 14-only as soon as possible for ease of support and patching). My own machine is a weird Franken-beastie somewhere between 13.2 and 13.3, but I’ve been wrestling with some package-building failures on the FreeBSD cluster machines for all of 13.2, 13.3 and 14.0 – it builds on my machine, and then fails with compiler errors on the cluster. More weirdly still, it looks like “obvious missing C++ headers”, so I don’t understand why it works for me. Here’s some notes for my future self about quickly setting up a virtual machine for ports testing.

After I wrote this down, and started doing some testing, it turned out I had a local fix, which I had forgotten to push. Facepalm time, but at least I have a handful of notes for future me when I have an actual problem.

  • Set up a VirtualBox VM with a CD drive and a 40GiB hard disk,
  • Get a FreeBSD 13.2 install ISO image,
  • Run through the FreeBSD installation. This takes maybe 5 minutes with all of the default settings and creating a single user. I used automatic UFS on the whole virtual disk. Don’t bother with the ports tree.

After booting the newly-installed system, configuration for ports testing can start.

  • As root, pkg install git cmake , which will first install the package manager, then git and cmake, which are two things we’re going to need anyway.
  • As root, clone the ports tree. I used git clone --depth 50 -b 2024Q2 /usr/ports to get the quarterly branch.
  • Use the package manager to find out the dependencies of the desired port. With pkg rquery %dn followed by the name of the desired port, you get the dependencies of the port. Since most FreeBSD ports are developer-batteries-included, those are also the build dependencies.
  • Use pkg install to install them. Backtick expansion can make things easier here.
  • If there’s no package available, then the ports framework offers make build-depends-list run-depends-list which will print full paths to the ports directories of the dependencies. With a little bit of sed(1) processing, this turns into a list of installable packages.

Once the system is up, ports builds can proceed as usual.