Building DMD on OpenBSD

Iain Buclaw ibuclaw at gdcproject.org
Fri Dec 28 12:02:48 UTC 2018


On Fri, 28 Dec 2018 at 03:20, Ryan via Digitalmars-d
<digitalmars-d at puremagic.com> wrote:
>
> On Friday, 28 December 2018 at 01:28:31 UTC, Seb wrote:
> > On Wednesday, 26 December 2018 at 21:17:13 UTC, Ryan wrote:
> >> On Tuesday, 18 July 2017 at 21:01:24 UTC, Anonymous wrote:
> >>> On Tuesday, 18 July 2017 at 05:11:30 UTC, Kai Nacke wrote:
> >>>> In master there is already some OpenBSD support. Some time
> >>>> ago I worked on druntime support but I still need to finish
> >>>> this. Mostly there is nothing magic here - just translating
> >>>> the header files. The only non-obvious work is required for
> >>>> the module/shared library stuff (in rt.sections). If there
> >>>> is an OpenBSD expert around who can help here it would be
> >>>> nice.
> >>>
> >>> Maybe talk to OpenBSD porters on their mailing list.
> >>> I'll put my stuff on github as soon as I can.
> >>
> >> Sorry to drag up an old post but I am also interested in
> >> getting dmd on openbsd as it is my OS for my main laptop at
> >> home.  Has there been any progress with this anywhere?  If
> >> not, I would like to give it a try.  My experience with D is
> >> currently limited but I have a decent understanding of the
> >> OpenBSD build system (I am no expert but I have ported some
> >> things to OpenBSD in the past).
> >>
> >> I did look around a bit but I could not find any (official)
> >> instructions on how to build the bootstrap version to use to
> >> build the latest version of dmd.  Is it pretty much straight
> >> forward or are there other considerations that I need to be
> >> aware of?
> >
> > There's the dmd-cxx branch of DMD which was an attempt of
> > back-porting Ian's GDC fixes to DMD. So essentially dmd-cxx is
> > something like 2.076 (though without static foreach), but it
> > doesn't pass the druntime nor Phobos testsuite (it might be
> > enough to build DMD master).
> >
> > The last C++-only version of DMD is 2.068, but in the meantime
> > a lot changed.
>
> Hi Seb,
>
> Thanks for the reply.  My initial thought was to build two ports
> for OpenBSD. One specifically to boot strap using version 2.068
> and the other the actual port.  golang is setup in a similar
> fashion in OpenBSD ports today so I thought that structure would
> work. Do you think it is possible to build the most recent
> version of dmd using 2.068 as the boostrap?  And what compiler
> (and compiler version) should I use?
>

Strictly speaking, the last C++ version of DMD was 2.067, as idgen and
impcnvgen were converted prior to the rest of the codebase (however,
it's trivial to generate id.{c,h} and impcnvtab.c ahead of time).

If you're using 2.068 as a bootstrap, you'll have to make two jumps in
order to get to the latest release, 2.068 -> 2.076 -> 2.084.  You can
then keep 2.076 around as the baseline for building latter versions,
which should be remain true for the next year or so before the next
minimum version bump.

> >
> > However, it might be possible to use LDC to cross-compile
> > directly for OpenBSD and self yourself all this bootstrapping
> > pain.
>
> This could be a nice alternative, however LDC isn't in OpenBSD
> ports today either.  So either route I plan to take will require
> bootstrapping work of some kind.

What about gcc? Granted there will be one patch you'll need to apply
to the compiler to add relevant OpenBSD versions, pthread_mutex_t
sizes, etc... the rest should be only be adding druntime bindings.

-- 
Iain


More information about the Digitalmars-d mailing list