Brian Robert Callahan

submited by
Style Pass
2021-05-21 07:30:03

It works just as well as GDC on OpenBSD/amd64. I want to walk through how I made it happen so that others can replicate if they so choose. And so I can replicate for other archs, like armv7.

Not having an installation of gcc already installed on the machine, I opted to install gcc-8.4.0 from ports with a quick doas pkg_add g++. On arm64, this also installs the GNU assembler, since arm64 does not ship with it. That's good, because we need it for gdc.

I used the build script I normally use for amd64, though I much reduced it so that I would only build the C and D compilers.1 It looks like this:

It turns out that AArch64 support for OpenBSD has not yet been upstreamed, so I needed to pull the appropriate patches from the ports tree. You don't need all of them, or even most of them. I just took the bare minimum to get things built: 1, 2, 3, and 4.

At this point, I had to teach Phobos, the D Standard Library, about OpenBSD/arm64. It wasn't actually Phobos itself that needed teaching, but rather DRuntime, the low-level runtime library that links into Phobos. It's not the best analogy, but you can think of Phobos and DRuntime as you would think of libstdc++ and libsupc++ for C++. Again, it's not really a great analogy but oftentimes libsupc++ gets linked into libstdc++ and much the same, DRuntime gets linked into Phobos.

Leave a Comment