Compared to the "Build VirtualBox ≥ 5.1.2 on OSX ≥ 10.9" instructions, here's what I did differently to build VirtualBox (I tested this with VirtualBox 6.0.4 and 6.0.6, but not 6.0.8 yet):
If Java is not already installed, don't install it at the beginning. Instead, do it after installing MacPorts. (There's nothing really wrong with installing Java before MacPorts, but if you install MacPorts first, you can install Java as just another port, and that's the easiest/fastest way to do it.)
At some point, install the latest OpenSSL by doing something like the following example:
Code: Select all
tar zxf ~/Downloads/openssl-1.1.1b.tar.gz
cd openssl-1.1.1b
./config --prefix=/opt/openssl-1.1.1b --openssldir=/opt/openssl-1.1.1b/etc
make -j4
make test
sudo make install
(This is because I wasn't able to compile VirtualBox using any of the MacPorts versions of OpenSSL.)
Before installing any other ports, install an OpenSSL or LibreSSL port (openssl, openssl11, or libressl), if you haven't already done so. If you're only going to be using MacPorts for building VirtualBox, then just install the openssl port (the other ports will install faster that way, versus installing openssl11 or libressl). However, if you're going to need openssl11 or libressl instead of openssl, for some reason unrelated to building VirtualBox, now's the time to install it, before the openssl port gets automatically installed as a dependency for some other port.
Aside from openssl, I installed fewer ports because I didn't care about rebuilding the documentation. I installed:
pkgconfig (not explicitly installing pkgconfig caused other problems later on)
libidl
qt56
openjdk12 (to get Java)
(By the way, if you're going to install all the ports mentioned in "Build VirtualBox ≥ 5.1.2 on OSX ≥ 10.9", I think nowadays it should be OK to omit the "+universal" -- I think that has probably been unnecessary since OS X 10.9 became the minimum version for building VirtualBox. However, I haven't actually tested that yet.)
I downloaded the VirtualBox source from the Downloads page of the VirtualBox website, instead of using svn. (I'm not saying you shouldn't use svn, it's just that downloading the source tarball happened to be more convenient in my case.)
In addition to socratis's patch for the Qt stuff (which applied without problems for me), I had to patch something else as well: In Config.kmk, comment out the line that says "VBOX_WITH_DARWIN_R0_DARWIN_IMAGE_VERIFICATION = 1".
Since I installed my own OpenSSL, the config line becomes something like:
./configure --disable-hardening --with-xcode-dir=/Volumes/Xcode/Xcode.app --with-openssl-dir=/opt/openssl-1.1.1b
And with those changes to the directions, I was able to build and run VirtualBox from source on macOS 10.13.6.