www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Building DMD on OpenBSD

reply Anonymous <anonymous example.com> writes:
I did some googling (well, duckduckgoing) and found a few posts 
on this forum indicating that this could work. So I gave it a try 
and followed https://wiki.dlang.org/Building_under_Posix
The build failed because src/posix.mak in the dmd repo was trying 
to download 
http://downloads.dlang.org/releases/2.x/2.072.2/dmd.2.072.2.openbsd.tar.xz
which doesn&apos;t exist. What do I do now?

OTOH it&apos;s a good thing that the build failed. When I saw 
http:// instead of https:// in the console output I went to check 
what the makefile was doing and - wait for it - it was trying to 
download an executable from the internet and run it. I 
couldn&apos;t believe my eyes. I mean, you sure can use an 
unencrypted channel but then you need some kind of cryptographic 
signature to verify the downloaded file. I tried the above with 
2.074.1 (the latest stable) but the trunk version has this too.
Jul 16 2017
next sibling parent reply Seb <seb wilzba.ch> writes:
On Sunday, 16 July 2017 at 19:00:32 UTC, Anonymous wrote:
 I did some googling (well, duckduckgoing) and found a few posts 
 on this forum indicating that this could work. So I gave it a 
 try and followed https://wiki.dlang.org/Building_under_Posix
 The build failed because src/posix.mak in the dmd repo was 
 trying to download 
 http://downloads.dlang.org/releases/2.x/2.072.2/dmd.2.072.2.openbsd.tar.xz
which doesn&apos;t exist. What do I do now?

 OTOH it&apos;s a good thing that the build failed. When I saw 
 http:// instead of https:// in the console output I went to 
 check what the makefile was doing and - wait for it - it was 
 trying to download an executable from the internet and run it. 
 I couldn&apos;t believe my eyes. I mean, you sure can use an 
 unencrypted channel but then you need some kind of 
 cryptographic signature to verify the downloaded file. I tried 
 the above with 2.074.1 (the latest stable) but the trunk 
 version has this too.
Auto-bootstrapping is __only__ used if no host compiler is found on the system. This should only happen on esoteric platforms (not intended as an offense) like yours. There are usually plenty of ways to get your host compiler safely: http://dlang.org/download.html The simplest one on a Posix system is: curl -fsS https://dlang.org/install.sh | bash -s dmd If you have GPG, it will verify the integrity of the downloaded archive. In any case, I submitted a PR to use SSL for AUTO_BOOSTRAP: https://github.com/dlang/dmd/pull/7000
Jul 16 2017
parent reply Anonymous <anonymous example.com> writes:
On Sunday, 16 July 2017 at 19:47:20 UTC, Seb wrote:
 Auto-bootstrapping is __only__ used if no host compiler is 
 found on the system.
 This should only happen on esoteric platforms (not intended as 
 an offense) like yours.
So I should use digger then? I looked through its repo briefly and I can&apos;t really tell if I&apos;m gonna run into the same issue or not. I guess another option is to build GDC and then use it to build DMD.
 In any case, I submitted a PR to use SSL for AUTO_BOOSTRAP:

 https://github.com/dlang/dmd/pull/7000
Thanks.
Jul 16 2017
parent reply Seb <seb wilzba.ch> writes:
On Sunday, 16 July 2017 at 21:05:53 UTC, Anonymous wrote:
 On Sunday, 16 July 2017 at 19:47:20 UTC, Seb wrote:
 Auto-bootstrapping is __only__ used if no host compiler is 
 found on the system.
 This should only happen on esoteric platforms (not intended as 
 an offense) like yours.
So I should use digger then? I looked through its repo briefly and I can&apos;t really tell if I&apos;m gonna run into the same issue or not. I guess another option is to build GDC and then use it to build DMD.
Yes digger could work, but it's written in D and you would need to build it on a different OS. How about simply building the bootstrap binary yourself then? I think 2.067 is the last version that's still written in C++: https://github.com/dlang/dmd/tree/2.067 PS: Do you manually insert the HTML codes? They are escaped.
Jul 16 2017
parent reply Anonymous <anonymous example.com> writes:
On Sunday, 16 July 2017 at 21:37:12 UTC, Seb wrote:
 How about simply building the bootstrap binary yourself then?
 I think 2.067 is the last version that&apos;s still written in 
 C++:

 https://github.com/dlang/dmd/tree/2.067
Yep, that should work. I believe this should be put somewhere on the wiki because otherwise bootstrapping is hard to figure out.
 PS: Do you manually insert the HTML codes? They are escaped.
I noticed them added after a redirect to the captcha page (I&apos;m using tor).
Jul 16 2017
parent reply Joakim <dlang joakim.fea.st> writes:
On Sunday, 16 July 2017 at 22:40:18 UTC, Anonymous wrote:
 On Sunday, 16 July 2017 at 21:37:12 UTC, Seb wrote:
 How about simply building the bootstrap binary yourself then?
 I think 2.067 is the last version that&apos;s still written in 
 C++:

 https://github.com/dlang/dmd/tree/2.067
Yep, that should work. I believe this should be put somewhere on the wiki because otherwise bootstrapping is hard to figure out.
The wiki does explain that you need a bootstrap compiler, it tells you what will be done. Unfortunately, it doesn't explain that the auto-bootstrap will not work for OpenBSD, because we don't put out builds for that OS. The only BSD we regularly put out builds for is FreeBSD. I will update the wiki page to say that. As for bootstrapping, it appears that we have not documented it anywhere on the wiki, I'll add some info on that. The last dmd we released that was written in C++ was 2.067, for which you can still check out the branch. You'd have to build that bootstrap compiler 2.067 first, then worry about the latest dmd. Since we don't regularly build for OpenBSD, it's possible that support has slipped behind. Usually, it's as easy as adding OpenBSD to a couple more #ifdefs, but sometimes you need to adapt the dmd source also for a rarely used platform like OpenBSD.
Jul 17 2017
parent reply Anonymous <anonymous example.com> writes:
On Monday, 17 July 2017 at 09:58:42 UTC, Joakim wrote:
 The last dmd we released that was written in C++ was 2.067, for 
 which you can still check out the branch.  You&apos;d have to 
 build that bootstrap compiler 2.067 first, then worry about the 
 latest dmd.

 Since we don&apos;t regularly build for OpenBSD, it&apos;s 
 possible that support has slipped behind.  Usually, it&apos;s 
 as easy as adding OpenBSD to a couple more #ifdefs, but 
 sometimes you need to adapt the dmd source also for a rarely 
 used platform like OpenBSD.
I managed to build the bootstrap dmd without any trouble. Btw the wiki page doesn&apos;t mention that the dependency is *GNU* Make which is typically installed as gmake on BSDs. Then I tried building the new dmd and got (in dmd/src): CC=c++ dmd -of../generated/openbsd/release/64/idgen ddmd/idgen.d Error: cannot find source code for runtime library file &apos;object.d&apos; dmd might not be correctly installed. Run &apos;dmd -man&apos; for installation instructions. config file: /etc/dmd.conf Specify path to file &apos;object.d&apos; with -I switch gmake[1]: *** [posix.mak:437: ../generated/openbsd/release/64/idgen] Error 1 Now I&apos;m trying to figure out the /etc/dmd.conf business. I found ini/freebsd/bin64/dmd.conf in the 2.067 dmd folder so I guess I&apos;ll start from there. Thanks for the help so far.
Jul 17 2017
parent reply Joakim <dlang joakim.fea.st> writes:
On Monday, 17 July 2017 at 16:45:28 UTC, Anonymous wrote:
 On Monday, 17 July 2017 at 09:58:42 UTC, Joakim wrote:
 The last dmd we released that was written in C++ was 2.067, 
 for which you can still check out the branch.  You&apos;d have 
 to build that bootstrap compiler 2.067 first, then worry about 
 the latest dmd.

 Since we don&apos;t regularly build for OpenBSD, it&apos;s 
 possible that support has slipped behind.  Usually, it&apos;s 
 as easy as adding OpenBSD to a couple more #ifdefs, but 
 sometimes you need to adapt the dmd source also for a rarely 
 used platform like OpenBSD.
I managed to build the bootstrap dmd without any trouble. Btw the wiki page doesn&apos;t mention that the dependency is *GNU* Make which is typically installed as gmake on BSDs. Then I tried building the new dmd and got (in dmd/src): CC=c++ dmd -of../generated/openbsd/release/64/idgen ddmd/idgen.d Error: cannot find source code for runtime library file &apos;object.d&apos; dmd might not be correctly installed. Run &apos;dmd -man&apos; for installation instructions. config file: /etc/dmd.conf Specify path to file &apos;object.d&apos; with -I switch gmake[1]: *** [posix.mak:437: ../generated/openbsd/release/64/idgen] Error 1 Now I&apos;m trying to figure out the /etc/dmd.conf business. I found ini/freebsd/bin64/dmd.conf in the 2.067 dmd folder so I guess I&apos;ll start from there. Thanks for the help so far.
Unfortunately, dmd has not kept porters in mind and hasn't kept the C++ version updated, or kept a workflow that enables easy bootstrapping: http://forum.dlang.org/thread/xgtbpcvbikxlilanrzqa forum.dlang.org You will have to build druntime and phobos for 2.067 also and collect it all in a different location, which you could invoke to bootstrap a new dmd. You may run into issues related to D/C++ integration when building the latest dmd, as that hasn't been tested on OpenBSD, only FreeBSD. Why do you want the latest dmd on OpenBSD? I ask because it will likely require some work, though likely not a lot.
Jul 17 2017
parent reply Anonymous <anonymous example.com> writes:
On Monday, 17 July 2017 at 17:18:23 UTC, Joakim wrote:
 Unfortunately, dmd has not kept porters in mind and hasn&apos;t 
 kept the C++ version updated, or kept a workflow that enables 
 easy bootstrapping:

 http://forum.dlang.org/thread/xgtbpcvbikxlilanrzqa forum.dlang.org

 You will have to build druntime and phobos for 2.067 also and 
 collect it all in a different location, which you could invoke 
 to bootstrap a new dmd.  You may run into issues related to 
 D/C++ integration when building the latest dmd, as that 
 hasn&apos;t been tested on OpenBSD, only FreeBSD.

 Why do you want the latest dmd on OpenBSD?  I ask because it 
 will likely require some work, though likely not a lot.
I&apos;ve already tried building 2.067 druntime by mistake and run into problems. Most are resolvable by just adding TARGET_OPENBSD next to TARGET_FREEBSD. But yeah, it&apos;s gonna take some work. I want it because I&apos;m using OpenBSD as my main OS and I have a project that I want to port to D. Btw I should&apos;ve built the `install` target (got confused by the wiki). Now I get: cp: ../ini/openbsd/bin64/dmd.conf: No such file or directory which is more understandable.
Jul 17 2017
parent reply Joakim <dlang joakim.fea.st> writes:
On Monday, 17 July 2017 at 18:42:39 UTC, Anonymous wrote:
 On Monday, 17 July 2017 at 17:18:23 UTC, Joakim wrote:
 Unfortunately, dmd has not kept porters in mind and 
 hasn&apos;t kept the C++ version updated, or kept a workflow 
 that enables easy bootstrapping:

 http://forum.dlang.org/thread/xgtbpcvbikxlilanrzqa forum.dlang.org

 You will have to build druntime and phobos for 2.067 also and 
 collect it all in a different location, which you could invoke 
 to bootstrap a new dmd.  You may run into issues related to 
 D/C++ integration when building the latest dmd, as that 
 hasn&apos;t been tested on OpenBSD, only FreeBSD.

 Why do you want the latest dmd on OpenBSD?  I ask because it 
 will likely require some work, though likely not a lot.
I&apos;ve already tried building 2.067 druntime by mistake and run into problems. Most are resolvable by just adding TARGET_OPENBSD next to TARGET_FREEBSD. But yeah, it&apos;s gonna take some work. I want it because I&apos;m using OpenBSD as my main OS and I have a project that I want to port to D. Btw I should&apos;ve built the `install` target (got confused by the wiki). Now I get: cp: ../ini/openbsd/bin64/dmd.conf: No such file or directory which is more understandable.
Alright, there was a contributor who recently got ldc working on NetBSD, take a look at his PRs as a guide for what you'll likely have to do: https://github.com/dlang/dmd/pulls?q=is%3Apr+author%3AnrTQgc https://github.com/dlang/druntime/pulls?q=is%3Apr+author%3AnrTQgc https://github.com/dlang/phobos/pulls?q=is%3Apr+author%3AnrTQgc OpenBSD PRs welcome! :) In the meantime, you can see that I've raised this bootstrap issue internally and hopefully we can make it easier for future porters.
Jul 17 2017
parent reply Kai Nacke <kai redstar.de> writes:
On Monday, 17 July 2017 at 18:58:40 UTC, Joakim wrote:
 On Monday, 17 July 2017 at 18:42:39 UTC, Anonymous wrote:
 On Monday, 17 July 2017 at 17:18:23 UTC, Joakim wrote:
 Unfortunately, dmd has not kept porters in mind and 
 hasn&apos;t kept the C++ version updated, or kept a workflow 
 that enables easy bootstrapping:

 http://forum.dlang.org/thread/xgtbpcvbikxlilanrzqa forum.dlang.org

 You will have to build druntime and phobos for 2.067 also and 
 collect it all in a different location, which you could 
 invoke to bootstrap a new dmd.  You may run into issues 
 related to D/C++ integration when building the latest dmd, as 
 that hasn&apos;t been tested on OpenBSD, only FreeBSD.

 Why do you want the latest dmd on OpenBSD?  I ask because it 
 will likely require some work, though likely not a lot.
I&apos;ve already tried building 2.067 druntime by mistake and run into problems. Most are resolvable by just adding TARGET_OPENBSD next to TARGET_FREEBSD. But yeah, it&apos;s gonna take some work. I want it because I&apos;m using OpenBSD as my main OS and I have a project that I want to port to D. Btw I should&apos;ve built the `install` target (got confused by the wiki). Now I get: cp: ../ini/openbsd/bin64/dmd.conf: No such file or directory which is more understandable.
Alright, there was a contributor who recently got ldc working on NetBSD, take a look at his PRs as a guide for what you'll likely have to do: https://github.com/dlang/dmd/pulls?q=is%3Apr+author%3AnrTQgc https://github.com/dlang/druntime/pulls?q=is%3Apr+author%3AnrTQgc https://github.com/dlang/phobos/pulls?q=is%3Apr+author%3AnrTQgc OpenBSD PRs welcome! :) In the meantime, you can see that I've raised this bootstrap issue internally and hopefully we can make it easier for future porters.
:-) 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. Regards, Kai
Jul 17 2017
parent reply Anonymous <anonymous example.com> writes:
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&apos;ll put my stuff on github as soon as I can.
Jul 18 2017
parent reply Ryan <ryan boggshome.net> writes:
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&apos;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?
Dec 26 2018
parent reply Seb <seb wilzba.ch> writes:
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&apos;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. DragonflyBSD support for DMD and LDC has been added at the end of last year (see e.g. [1] or the respective GitHub PRs). I think the process should be relatively similar: - fixing/adding the bindings in druntime in LTS DMD or LDC, s.t. it can be compiled for DMD (you don't need Phobos to build DMD, though the build scripts might expect it as the testsuite partially requires it). - building the last LTS version - bootstrap yourself to master (you'll probably need to build sth. like 2.079 as an intermediate step) - build the latest master However, it might be possible to use LDC to cross-compile directly for OpenBSD and self yourself all this bootstrapping pain. Good luck and don't hesitate to ask for more help here, on IRC or GitHub. [1]: https://forum.dlang.org/post/elihnyflzlrtfavqyhth forum.dlang.org
Dec 27 2018
parent reply Ryan <ryan boggshome.net> writes:
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&apos;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? Also, i did some checking and I think that I can also use the FreeBSD makefile as a starting point to get the bootstrapper going since there are some similarities between the two systems. Enough to see what it takes to build anyway.
 DragonflyBSD support for DMD and LDC has been added at the end 
 of last year (see e.g. [1] or the respective GitHub PRs). I 
 think the process should be relatively similar:
 - fixing/adding the bindings in druntime in LTS DMD or LDC, 
 s.t. it can be compiled for DMD (you don't need Phobos to build 
 DMD, though the build scripts might expect it as the testsuite 
 partially requires it).
 - building the last LTS version
 - bootstrap yourself to master (you'll probably need to build 
 sth. like 2.079 as an intermediate step)
 - build the latest master
I am expecting that I will need to do some patch work while trying to port. My plan was to submit all of my patches during this process as a pull request (or requests depending on the patches) back to dlang for review and inclusion in future releases. But, first thing is first....
 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.
 Good luck and don't hesitate to ask for more help here, on IRC 
 or GitHub.
 [1]: 
 https://forum.dlang.org/post/elihnyflzlrtfavqyhth forum.dlang.org
Dec 27 2018
parent reply Iain Buclaw <ibuclaw gdcproject.org> writes:
On Fri, 28 Dec 2018 at 03:20, Ryan via Digitalmars-d
<digitalmars-d 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&apos;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
Dec 28 2018
parent reply Thomas Mader <thomas.mader gmail.com> writes:
On Friday, 28 December 2018 at 12:02:48 UTC, Iain Buclaw wrote:
 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.
I use ldc 0.17.6 to bootstrap directly to the latest ldc version. I haven't tried it myself but it might be possible to bootstrap dmd directly from ldc 0.17.6.
Dec 28 2018
parent reply Ryan <ryan boggshome.net> writes:
On Friday, 28 December 2018 at 16:37:14 UTC, Thomas Mader wrote:
 On Friday, 28 December 2018 at 12:02:48 UTC, Iain Buclaw wrote:
 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.
ugh, I can see that sort of setup becoming cumbersome to maintain overtime in the OpenBSD ports world. Maybe using 2.068 as the bootstrapper isn't the best approach after all.
 I use ldc 0.17.6 to bootstrap directly to the latest ldc 
 version.
 I haven't tried it myself but it might be possible to bootstrap 
 dmd directly from ldc 0.17.6.
I looked around a bit more and I found some initial work porting ldc to OpenBSD. It's old and doesn't look like it has been touched in a while but it is a start. There are some patches in there as well. They may need some updating but it's good to know what is needed. Using LDC as the bootstrapper may be best approach after all, if it can bootstrap dmd. If so, we could potentially use LDC 0.17.6 not only to boot strap dmd but the main version of LDC as well. Thus killing two birds with one stone. Unless there are other thoughts or considerations, I think I will try the ldc bootstrap route.
Dec 28 2018
next sibling parent Iain Buclaw <ibuclaw gdcproject.org> writes:
On Fri, 28 Dec 2018 at 22:55, Ryan via Digitalmars-d
<digitalmars-d puremagic.com> wrote:
 On Friday, 28 December 2018 at 16:37:14 UTC, Thomas Mader wrote:
 On Friday, 28 December 2018 at 12:02:48 UTC, Iain Buclaw wrote:
 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.
ugh, I can see that sort of setup becoming cumbersome to maintain overtime in the OpenBSD ports world. Maybe using 2.068 as the bootstrapper isn't the best approach after all.
Well, you only need to bootstrap it once, and when you have the 2.076 compiler built, you just keep those binaries around, there's no need to use the 2.068 sources ever again. Hopefully the dmd CI covers that version of ldc. Though if it's based on 2.068, your mileage may vary, as the source code is not compatible with that version anymore. Good luck!
Dec 28 2018
prev sibling parent reply Thomas Mader <thomas.mader gmail.com> writes:
On Friday, 28 December 2018 at 21:52:30 UTC, Ryan wrote:
 ugh, I can see that sort of setup becoming cumbersome to 
 maintain overtime in the OpenBSD ports world.  Maybe using 
 2.068 as the bootstrapper isn't the best approach after all.
I decided against a multi level bootstrap process in NixOS because it increases the build time immensely. In NixOS every dependent package is automatically rebuild if only the slightest change is happening in the base package. The more levels the more complex it gets.
 I looked around a bit more and I found some initial work 
 porting ldc to OpenBSD.  It's old and doesn't look like it has 
 been touched in a while but it is a start.  There are some 
 patches in there as well.  They may need some updating but it's 
 good to know what is needed.
I don't know nothing about OpenBSD. What is the problem with packaging LDC? What makes the packaging in OpenBSD so special?
 Using LDC as the bootstrapper may be best approach after all, 
 if it can bootstrap dmd.  If so, we could potentially use LDC 
 0.17.6 not only to boot strap dmd but the main version of LDC 
 as well.  Thus killing two birds with one stone.  Unless there 
 are other thoughts or considerations, I think I will try the 
 ldc bootstrap route.
In NixOS I use LDC 0.17.6 to bootstrap the latest LDC version and then the latest LDC version to bootstrap dmd. For now it seems that the LDC maintainers find it important to keep the bootstrapping version 0.17.x working as there are new versions every now and then. If you want to have LDC and dmd, which is not a bad idea anyway, you are probably spending your time the most effective way possible currently. Bootstrapping dmd with dmd doesn't have a fixed N as nobody cares really hard about the version required to build the latest version. Because of this it's quite obvious that N will grow in the near future as people might want/need newer features to implement stuff in the dmd frontend or backend.
Jan 02 2019
parent reply Ryan <ryan boggshome.net> writes:
On Wednesday, 2 January 2019 at 21:38:19 UTC, Thomas Mader wrote:
 On Friday, 28 December 2018 at 21:52:30 UTC, Ryan wrote:
 ugh, I can see that sort of setup becoming cumbersome to 
 maintain overtime in the OpenBSD ports world.  Maybe using 
 2.068 as the bootstrapper isn't the best approach after all.
I decided against a multi level bootstrap process in NixOS because it increases the build time immensely. In NixOS every dependent package is automatically rebuild if only the slightest change is happening in the base package. The more levels the more complex it gets.
 I looked around a bit more and I found some initial work 
 porting ldc to OpenBSD.  It's old and doesn't look like it has 
 been touched in a while but it is a start.  There are some 
 patches in there as well.  They may need some updating but 
 it's good to know what is needed.
I don't know nothing about OpenBSD. What is the problem with packaging LDC? What makes the packaging in OpenBSD so special?
Nothing really. It's about the same as trying to get LDC to work on a new OS that LDC doesn't know about yet.
 Using LDC as the bootstrapper may be best approach after all, 
 if it can bootstrap dmd.  If so, we could potentially use LDC 
 0.17.6 not only to boot strap dmd but the main version of LDC 
 as well.  Thus killing two birds with one stone.  Unless there 
 are other thoughts or considerations, I think I will try the 
 ldc bootstrap route.
In NixOS I use LDC 0.17.6 to bootstrap the latest LDC version and then the latest LDC version to bootstrap dmd. For now it seems that the LDC maintainers find it important to keep the bootstrapping version 0.17.x working as there are new versions every now and then. If you want to have LDC and dmd, which is not a bad idea anyway, you are probably spending your time the most effective way possible currently. Bootstrapping dmd with dmd doesn't have a fixed N as nobody cares really hard about the version required to build the latest version. Because of this it's quite obvious that N will grow in the near future as people might want/need newer features to implement stuff in the dmd frontend or backend.
This is what I am doing at the moment. It's taking time because there are OS specific items that need to be added to LDC (mainly druntime so far) for it to work on OpenBSD. Just to bring everyone else up to speed on this. I'm currently focused on porting over LDC 0.17.6 as a bootstrap port for OpenBSD. I have a working Makefile on OpenBSD ports but the build is currently bombing on the DRuntime build, which was expected based on conversations with the person who initially started porting this about a year ago. I'm trying to build patches to get DRuntime to build but it is a slow process, as you can imagine. Quick question for those in the know: I'm working on patching sys/signal.d for this and there is a struct in here called "sigstack" that seems to need defining. However, the struct doesn't seem to exist on OpenBSD. Does anyone know if this struct is actually required or is there a known alternative that I can try?
Jan 14 2019
parent reply Ryan <ryan boggshome.net> writes:
On Monday, 14 January 2019 at 15:34:21 UTC, Ryan wrote:

 Quick question for those in the know:
 I'm working on patching sys/signal.d for this and there is a 
 struct in here called "sigstack" that seems to need defining.  
 However, the struct doesn't seem to exist on OpenBSD.  Does 
 anyone know if this struct is actually required or is there a 
 known alternative that I can try?
Figured this out and moved on to the next batch of OpenBSD porting issues, which is currently rt/sections.d and elf related items. FYI - If anyone is curious about the progress on this, I've push this work to the link below. It's just the bootstrap port but it is the beginning. And I am working on more patches which I will push to the repo below as time permits... https://github.com/jasperla/openbsd-wip/tree/master/lang/ldc-bootstrap Thanks, Ryan
Jan 19 2019
parent Ryan <ryan boggshome.net> writes:
On Saturday, 19 January 2019 at 15:35:23 UTC, Ryan wrote:

 FYI - If anyone is curious about the progress on this, I've 
 push this work to the link below.  It's just the bootstrap port 
 but it is the beginning.  And I am working on more patches 
 which I will push to the repo below as time permits...

 https://github.com/jasperla/openbsd-wip/tree/master/lang/ldc-bootstrap
https://github.com/rmboggs/dmd-druntime/tree/openbsd-wip Made more progress but I am now trying to work on rt/sections.d and rt/sections_elf_shared.d but I am having some trouble with these. Should I be coming here for questions on these files or is there somewhere else I should go? Thanks, Ryan
Jan 26 2019
prev sibling parent Jonathan M Davis via Digitalmars-d <digitalmars-d puremagic.com> writes:
On Sunday, July 16, 2017 19:00:32 Anonymous via Digitalmars-d wrote:
 I did some googling (well, duckduckgoing) and found a few posts
 on this forum indicating that this could work. So I gave it a try
 and followed https://wiki.dlang.org/Building_under_Posix
 The build failed because src/posix.mak in the dmd repo was trying
 to download
 http://downloads.dlang.org/releases/2.x/2.072.2/dmd.2.072.2.openbsd.tar.xz
 which doesn&apos;t exist. What do I do now?

 OTOH it&apos;s a good thing that the build failed. When I saw
 http:// instead of https:// in the console output I went to check
 what the makefile was doing and - wait for it - it was trying to
 download an executable from the internet and run it. I
 couldn&apos;t believe my eyes. I mean, you sure can use an
 unencrypted channel but then you need some kind of cryptographic
 signature to verify the downloaded file. I tried the above with
 2.074.1 (the latest stable) but the trunk version has this too.
I'm pretty sure that druntime would need to be updated before you'd get much of anywhere with OpenBSD. dmd _might_ work as-is, depending on what's missing in druntime, but all of the various bindings would need to be updated. grepping druntime, it does look like there are a number of version blocks checking OpenBSD, but nowhere near as many as FreeBSD or linux. So, to have the same level of functionality, I'd expect that more places would need to be doing else version(OpenBSD) and doing the right thing for OpenBSD, but I don't know how many would be required to get off the ground so to speak. Clearly, someone put in some time and effort towards getting OpenBSD working, but I have no idea how close they got. Most of the missing bindings would probably be pretty close to what's in the FreeBSD version blocks though. Most of the time, the tedium with getting the system bindings set up for a new POSIX system is going over each section and making sure that when it's created, the bindings match the new system. They're generally _very_ close but slightly different - which is why they aren't just put under version(Posix) and left at that. - Jonathan M Davis
Jul 17 2017