www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.ldc - Auto-bootstrapping builds of LDC with DDMD frontend

reply Joseph Rushton Wakeling <joseph.wakeling webdrake.net> writes:
Hello all,

This question relates to my experience snap-packaging LDC (the 
current package is still pending review in the Ubuntu store, BTW).

Since building more recent LDC releases requires a working D 
compiler, the snap package includes `ldc` as a build dependency 
(which means in practice, the snapcraft build process installs 
the ldc deb package included in the standard Ubuntu 
repositories).  However, it would definitely be nicer not to have 
to rely on this being available.

Past threads on the subject describe how to bootstrap manually:
https://forum.dlang.org/post/mailman.1044.1471415063.3131.digitalmars-d-ldc puremagic.com

... but I'm unaware of any auto-bootstrap option akin to dmd's 
`AUTO_BOOTSTRAP=1` make option.

Is there anything currently available or in the works for 
auto-bootstrapping?

Thanks & best wishes,

     -- Joe
Jan 29
parent reply Johan Engelen <j j.nl> writes:
On Sunday, 29 January 2017 at 18:32:28 UTC, Joseph Rushton 
Wakeling wrote:
 ... but I'm unaware of any auto-bootstrap option akin to dmd's 
 `AUTO_BOOTSTRAP=1` make option.

 Is there anything currently available or in the works for 
 auto-bootstrapping?
Not that I know of. I won't work on it, but perhaps you can add a simple shell script that downloads the latest 0.17.x release source and builds/installs it ? - Johan
Jan 29
parent reply Joseph Rushton Wakeling <joseph.wakeling webdrake.net> writes:
On Sunday, 29 January 2017 at 21:29:52 UTC, Johan Engelen wrote:
 Not that I know of.
OK, no worries. Just wanted to check I wasn't missing something.
 I won't work on it, but perhaps you can add a simple shell 
 script that downloads the latest 0.17.x release source and 
 builds/installs it ?
Actually I think it's possible to do entirely from within the `snapcraft.yaml` config file. Probably the best way is to just define a 'part' that builds LDC 0.17.x, and then use the result to build the actual _wanted_ LDC. It's probably quite straightforward, just wanted to check if it was necessary in the first place.
Jan 29
next sibling parent reply David Nadlinger via digitalmars-d-ldc <digitalmars-d-ldc puremagic.com> writes:
On 29 Jan 2017, at 23:13, Joseph Rushton Wakeling via digitalmars-d-ldc 
wrote:
 It's probably quite straightforward, just wanted to check if it was 
 necessary in the first place.
We don't have an alternative right now – in a non-distro setting, though, it's literally just downloading and extracting the binary release. This is not to say that such additions wouldn't be welcome, though, if they are sufficiently robust. — David
Jan 30
parent reply Joseph Rushton Wakeling <joseph.wakeling webdrake.net> writes:
On Monday, 30 January 2017 at 17:33:19 UTC, David Nadlinger wrote:
 This is not to say that such additions wouldn't be welcome, 
 though, if they are sufficiently robust.
If I come up with something I'll certainly share.
Jan 30
parent reply Matthias Klumpp <mak debian.org> writes:
On Monday, 30 January 2017 at 18:01:28 UTC, Joseph Rushton 
Wakeling wrote:
 On Monday, 30 January 2017 at 17:33:19 UTC, David Nadlinger 
 wrote:
 This is not to say that such additions wouldn't be welcome, 
 though, if they are sufficiently robust.
If I come up with something I'll certainly share.
Auto-bootstrapping would help us a lot in Debian too - bootstrapping is a bit annoying at time.
Jan 30
parent reply David Nadlinger <code klickverbot.at> writes:
On Monday, 30 January 2017 at 18:32:35 UTC, Matthias Klumpp wrote:
 Auto-bootstrapping would help us a lot in Debian too - 
 bootstrapping is a bit annoying at time.
Why do you need to bootstrap, though – can't you just have a build-time dependency on a D compiler? — David
Jan 30
next sibling parent reply David Nadlinger <code klickverbot.at> writes:
On Monday, 30 January 2017 at 21:06:44 UTC, David Nadlinger wrote:
 Why do you need to bootstrap, though – can't you just have a 
 build-time dependency on a D compiler?
(Maybe a separate helper package with the C++-only version, if you only have LDC available and can't directly depend on an older version of the same package.)
Jan 30
parent Pjotr Prins <pjotr.public12 thebird.nl> writes:
On Monday, 30 January 2017 at 21:13:54 UTC, David Nadlinger wrote:
 On Monday, 30 January 2017 at 21:06:44 UTC, David Nadlinger 
 wrote:
 Why do you need to bootstrap, though – can't you just have a 
 build-time dependency on a D compiler?
(Maybe a separate helper package with the C++-only version, if you only have LDC available and can't directly depend on an older version of the same package.)
With GNU Guix Fred Muriithi created a package for ldc 1.1.0 that bootstraps from source successfully. It is part of GNU Guix now and will run on any Linux distribution (even old ones). Installation takes ~15 minutes if you install Guix from scratch.
Jan 30
prev sibling parent reply Matthias Klumpp <mak debian.org> writes:
On Monday, 30 January 2017 at 21:06:44 UTC, David Nadlinger wrote:
 On Monday, 30 January 2017 at 18:32:35 UTC, Matthias Klumpp 
 wrote:
 Auto-bootstrapping would help us a lot in Debian too - 
 bootstrapping is a bit annoying at time.
Why do you need to bootstrap, though – can't you just have a build-time dependency on a D compiler?
We need to have one in the first place ^^ - if GDC could compile LDC, we could solve the issue that way. Right now, we upload a new version of LDC, let it fail build or not-build, then Markos logs into a porterbox, bootstraps the current LDC there, rebuilds it with itself and uploads the resulting binaries to the archive. So, LDC can depend on itself then. This works, until one LDC release fails to compile the other properly, then the bootstrap process starts again. Btw, we have a request for an arm64 LDC package, but so far bootstrapping on that platform was unsuccessful.
Jan 31
next sibling parent kinke <noone nowhere.com> writes:
On Tuesday, 31 January 2017 at 17:39:09 UTC, Matthias Klumpp 
wrote:
 We need to have one in the first place
Can't you use the old 0.17.1 package? That worked for bootstrapping on big-endian PPC64 IIRC.
 Btw, we have a request for an arm64 LDC package, but so far 
 bootstrapping on that platform was unsuccessful.
Yep, Markos created issue #1931 (https://github.com/ldc-developers/ldc/issues/1931) about that. Noone from the LDC team is currently working on that platform (Dan Olson is using AArch64 with iOS (different ABI), and that seems to work fine), so it's very likely that it won't be fixed soon.
Jan 31
prev sibling parent David Nadlinger via digitalmars-d-ldc <digitalmars-d-ldc puremagic.com> writes:
On 31 Jan 2017, at 18:39, Matthias Klumpp via digitalmars-d-ldc wrote:
 We need to have one in the first place ^^ - if GDC could compile LDC, 
 we could solve the issue that way.
This is why I asked whether you can't just keep an old version of LDC around separately. In a non-distro-packager scenario, it's utterly straightforward to have _any_ suitable compiler around, for example by just downloading a recent binary release of DMD or LDC. Of course, in many distros the objective is to root everything in a (self-bootstrapped) C compiler binary, but can't you just keep a separate package with a C++-based release (0.17.x) around that you can then simply build-depends on? We've been keeping DMD/LDC backwards-compatible with that for this very reason, that is making bootstrapping simple. — David
Jan 31
prev sibling parent Joseph Rushton Wakeling <joseph.wakeling webdrake.net> writes:
On Sunday, 29 January 2017 at 22:13:54 UTC, Joseph Rushton 
Wakeling wrote:
 Actually I think it's possible to do entirely from within the 
 `snapcraft.yaml` config file.  Probably the best way is to just 
 define a 'part' that builds LDC 0.17.x, and then use the result 
 to build the actual _wanted_ LDC.  It's probably quite 
 straightforward, just wanted to check if it was necessary in 
 the first place.
PR to ldc2.snap that implements such an approach: https://github.com/ldc-developers/ldc2.snap/pull/2
Jan 31