Thread overview
Bootstrapped D to OpenBSD; need help with (hopefully!) the last push to a fully functioning runtime
Mar 12, 2021
Brian
Mar 13, 2021
James Blachly
Mar 13, 2021
Walter Bright
Mar 13, 2021
Brian
March 12, 2021
Hello all --

I hope this is the right part of the forum (if not please let me know).

I was able to successfully build GDC on OpenBSD. I used the tip of the GCC tree.
I was then able to build both LDC and DMD with GDC.

On my GitHub account, I set up forks for each of dmd, druntime, and phobos.  I have also committed the current WIP to each (in branches dmd-openbsd, druntime-openbsd, and phobos-openbsd):
https://github.com/ibara/dmd
https://github.com/ibara/druntime
https://github.com/ibara/phobos
I am aware that much of this is ugly. Happy to fix as needed to get it into shape.

I also placed a bootstrap dmd for openbsd-64 in the dmd repo as well:
https://github.com/ibara/dmd/releases/tag/bootstrap

All three compilers are able to successfully build a hello world (https://en.wikibooks.org/wiki/D_(The_Programming_Language)/d2/Hello,_World!) and dub.

dub init works fine. Using dub to build and run the skeleton project also works fine. However, dub fetch (or anything using network access, really) causes dub to segfault. The backtrace can be found in the same place as the bootstrap dmd:
https://github.com/ibara/dmd/releases/tag/bootstrap (dub-gdb.txt)

I am happy to provide any other information or code needed to get D fully working. I am new to the D world, and I'd both like to be able to use D on OpenBSD as well as offer a package of dmd to our users (I am an OpenBSD developer) once this (hopefully last!) issue is overcome.

I am aware of other OpenBSD efforts on this forum. However, the code repos for some of those efforts appear to have gone to the great bitbucket in the sky.
March 12, 2021
On 3/12/21 5:55 PM, Brian wrote:
> Hello all --
> 
> I hope this is the right part of the forum (if not please let me know).
> 
> I was able to successfully build GDC on OpenBSD. I used the tip of the GCC tree.
> I was then able to build both LDC and DMD with GDC.

Awesome, thank you!

> dub init works fine. Using dub to build and run the skeleton project also works fine. However, dub fetch (or anything using network access, really) causes dub to segfault. The backtrace can be found in the same place as the bootstrap dmd:
> https://github.com/ibara/dmd/releases/tag/bootstrap (dub-gdb.txt)
> 

Interestingly, the segfault appears not to be in network code but here:

#0  0x00000974d21442cc in std.regex.RegexMatch!(char[]).RegexMatch.this!(std.regex.internal.ir.Regex!(char).Regex).this(char[], std.regex.internal.ir.Regex!(char).Regex) ()

when parsing the header.

based on the backtrace.
March 13, 2021
On 3/12/2021 2:55 PM, Brian wrote:
> I am aware of other OpenBSD efforts on this forum. However, the code repos for some of those efforts appear to have gone to the great bitbucket in the sky.

This is nice work, thank you!

Even though the D Foundation doesn't officially support OpenBSD, the changes needed to support it are welcome in the official dlang repository. Please submit PRs for your changes!

(That way they won't go that great bitbucket in the sky!)
March 13, 2021
On Saturday, 13 March 2021 at 20:34:37 UTC, Walter Bright wrote:
> On 3/12/2021 2:55 PM, Brian wrote:
>> I am aware of other OpenBSD efforts on this forum. However, the code repos for some of those efforts appear to have gone to the great bitbucket in the sky.
>
> This is nice work, thank you!
>
> Even though the D Foundation doesn't officially support OpenBSD, the changes needed to support it are welcome in the official dlang repository. Please submit PRs for your changes!
>
> (That way they won't go that great bitbucket in the sky!)

Thanks Walter. I will tidy up what I have and send some PRs your way.