www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Usability of D on windows?

reply John Burton <john.burton jbmail.com> writes:
I've recently gone back to looking at D and like what I see.
I've mostly been looking at it on Linux where it seems efficient 
and stable.

However the project I'd really like to use it for is on windows 
(x86-64 but if at all possible I'd like to compiler for x86 as 
well). But my experience on windows has been poor.

What I want to build is a 3d opengl graphics application. 
Performance is fairly important. My experience on Linux is that 
DMD is a great compiler but if you want decent speed you need to 
use GDC or LDC. (And from looking at the generated code, which 
backs up that opinion...)

The problem I have is that I can't see to find a decent, stable 
platform on windows. I installed DMD and visual D and it works 
well enough. And it's great for trying stuff out, but I worry 
about speed of produced code for my application.  The website 
front page tells me that I can run GDC but search all I can and I 
can't find any kind of installer for windows, only for Linux. I 
managed to find and install LDC, and that mostly, somewhat works.

Except that half the time the compiler crashes with a stack 
trace, and sometimes it just hangs. Occasionally if I move and 
rearrange the code it will manage to compile it. There are also 
worrying comments on the LDC web page about how "Most programs 
work just fine" and "Several unit tests still fail" and stuff 
about it relying on stuff from visual c++ in order to work that 
make me seriously doubt it's stability and correctness.

I'm like an honest opinion... Am I wasting my time trying to do 
this project in D on Windows? I'll continue to use and support 
the language but I don't want to fight a losing battle and end up 
having to move away anyway...

Is there a stable LDC, or is there possibly something wrong with 
my install? Is LDC sufficiently working to use for "production"?

If there a GDC port to windows at all? It seems there is, but if 
there is it's well hidden...
Aug 23 2016
next sibling parent reply Cauterite <cauterite gmail.com> writes:
On Tuesday, 23 August 2016 at 21:15:40 UTC, John Burton wrote:

Well, you're fighting a losing battle by trying to use GDC/LDC on 
Windows, since Windows is priority #2 for D, and GDC/LDC are 
still struggling with priority #1 (Linux).

You make the Digital Mars backend sound unusable, but I think you 
should give it another chance. I personally find most bugs 
originating from the backend are triggered by corner-cases which 
can be easily avoided until the bug is fixed.
Aug 23 2016
parent reply John Burton <john.burton jbmail.com> writes:
On Tuesday, 23 August 2016 at 21:25:29 UTC, Cauterite wrote:
 On Tuesday, 23 August 2016 at 21:15:40 UTC, John Burton wrote:

 Well, you're fighting a losing battle by trying to use GDC/LDC 
 on Windows, since Windows is priority #2 for D, and GDC/LDC are 
 still struggling with priority #1 (Linux).

 You make the Digital Mars backend sound unusable, but I think 
 you should give it another chance. I personally find most bugs 
 originating from the backend are triggered by corner-cases 
 which can be easily avoided until the bug is fixed.
Thanks, I'm more worried about the speed of the produced code for DMD. I need to do a lot of vector math and the code produced by DMD just seems way slower. It might be fast enough though so I could try it.
Aug 23 2016
parent Cauterite <cauterite gmail.com> writes:
On Tuesday, 23 August 2016 at 21:36:12 UTC, John Burton wrote:
It might be fast enough
 though so I could try it.
Remember, if you don't like the compiler's output, you can always substitute it with your own (inline assembly!). Incidentally I'm in the process of fixing a number of IASM bugs in the frontend right now.
Aug 23 2016
prev sibling next sibling parent reply Adam D. Ruppe <destructionator gmail.com> writes:
On Tuesday, 23 August 2016 at 21:15:40 UTC, John Burton wrote:
 If there a GDC port to windows at all? It seems there is, but 
 if there is it's well hidden...
It is at the bottom of the downloads page. https://gdcproject.org/downloads
Aug 23 2016
parent reply John Burton <john.burton jbmail.com> writes:
On Tuesday, 23 August 2016 at 21:29:31 UTC, Adam D. Ruppe wrote:
 On Tuesday, 23 August 2016 at 21:15:40 UTC, John Burton wrote:
 If there a GDC port to windows at all? It seems there is, but 
 if there is it's well hidden...
It is at the bottom of the downloads page. https://gdcproject.org/downloads
Although they have windows as a host it says that the target is arm-linux-gnueabi so I assumed they were cross compilers?
Aug 23 2016
next sibling parent Adam D. Ruppe <destructionator gmail.com> writes:
On Tuesday, 23 August 2016 at 21:37:57 UTC, John Burton wrote:
 Although they have windows as a host it says that the target is 
 arm-linux-gnueabi so I assumed they were cross compilers?
geeze, you're right. I thought they used to have it. I always just use dmd on windows anyway myself.
Aug 23 2016
prev sibling parent Cauterite <cauterite gmail.com> writes:
On Tuesday, 23 August 2016 at 21:37:57 UTC, John Burton wrote:
 Although they have windows as a host it says that the target is 
 arm-linux-gnueabi so I assumed they were cross compilers?
I heard that GDC worked with MinGW at some point in the past, so it may still be feasible without cross-compilation. You'll have to ask someone else about this though.
Aug 23 2016
prev sibling next sibling parent reply John Colvin <john.loughran.colvin gmail.com> writes:
On Tuesday, 23 August 2016 at 21:15:40 UTC, John Burton wrote:
 Except that half the time the compiler crashes with a stack 
 trace, and sometimes it just hangs. Occasionally if I move and 
 rearrange the code it will manage to compile it. There are also 
 worrying comments on the LDC web page about how "Most programs 
 work just fine" and "Several unit tests still fail" and stuff 
 about it relying on stuff from visual c++ in order to work that 
 make me seriously doubt it's stability and correctness.

 I'm like an honest opinion... Am I wasting my time trying to do 
 this project in D on Windows? I'll continue to use and support 
 the language but I don't want to fight a losing battle and end 
 up having to move away anyway...

 Is there a stable LDC, or is there possibly something wrong 
 with my install? Is LDC sufficiently working to use for 
 "production"?

 If there a GDC port to windows at all? It seems there is, but 
 if there is it's well hidden...
LDC is what you want. I predict you will run into some bugs occasionally, but some of the documentation / wiki stuff is probably old and overly pessimistic about the state of affairs. Please report any bugs you do hit to https://github.com/ldc-developers/ldc/issues (any compiler crash is a bug). If you have no patience for any bugs and must have the best optimised code on windows, D isn't quite there yet. However, if you can stomach a little pain, the reward is pretty good. P.S. relying on the microsoft linker is not much different (once it's installed) to relying on ld on linux.
Aug 23 2016
parent reply John Burton <john.burton jbmail.com> writes:
On Tuesday, 23 August 2016 at 22:15:33 UTC, John Colvin wrote:
 If you have no patience for any bugs and must have the best 
 optimised code on windows, D isn't quite there yet. However, if 
 you can stomach a little pain, the reward is pretty good.

 P.S. relying on the microsoft linker is not much different 
 (once it's installed) to relying on ld on linux.
Interestingly I found that LDC is crashing when I compile my code from visual D but not from the command line. It looks like it's using the same options but it's hard to tell exactly. I'll investigate further tomorrow and give it another try.
Aug 23 2016
parent reply Kagamin <spam here.lot> writes:
On Tuesday, 23 August 2016 at 22:30:29 UTC, John Burton wrote:
 Interestingly I found that LDC is crashing when I compile my 
 code from visual D but not from the command line.
I probably use LDC since it appeared and never seen it crash, but I compile from command line.
Aug 24 2016
parent rikki cattermole <rikki cattermole.co.nz> writes:
On 25/08/2016 12:54 AM, Kagamin wrote:
 On Tuesday, 23 August 2016 at 22:30:29 UTC, John Burton wrote:
 Interestingly I found that LDC is crashing when I compile my code from
 visual D but not from the command line.
I probably use LDC since it appeared and never seen it crash, but I compile from command line.
A couple of releases ago it use to crash for me most of the time. Now though? I'm quite happy using it, fairly stable (only through CLI).
Aug 24 2016
prev sibling next sibling parent Seb <seb wilzba.ch> writes:
On Tuesday, 23 August 2016 at 21:15:40 UTC, John Burton wrote:
 Is there a stable LDC, or is there possibly something wrong 
 with my install? Is LDC sufficiently working to use for 
 "production"?
Forgot the part about the struggling fight of LDC. Their development has caught up quite a lot lately and they are now on par with the DMD frontend. Also LDC does support Windows, unfortunately the link is a bit hidden from the official downloads page: https://github.com/ldc-developers/ldc/releases
Aug 23 2016
prev sibling next sibling parent Sean Campbell <sycam.inc gmail.com> writes:
On Tuesday, 23 August 2016 at 21:15:40 UTC, John Burton wrote:
 I've recently gone back to looking at D and like what I see.
 I've mostly been looking at it on Linux where it seems 
 efficient and stable.

 [...]
A MingW version of GDC can be found here: http://botcode.net/gdc-5.2.0+2.066.1.7z It seems to work most of the time.
 trace, and sometimes it just hangs. Occasionally if I move and 
 rearrange the code it will manage to compile it. There are also 
 worrying comments on the LDC web page about how "Most programs 
 work just fine" and "Several unit tests still fail" and stuff 
 about it relying on stuff from visual c++ in order to work that 
 make me seriously doubt it's stability and correctness.

 [...]
Aug 23 2016
prev sibling next sibling parent Joakim <dlang joakim.fea.st> writes:
On Tuesday, 23 August 2016 at 21:15:40 UTC, John Burton wrote:
 I'm like an honest opinion... Am I wasting my time trying to do 
 this project in D on Windows? I'll continue to use and support 
 the language but I don't want to fight a losing battle and end 
 up having to move away anyway...

 Is there a stable LDC, or is there possibly something wrong 
 with my install? Is LDC sufficiently working to use for 
 "production"?
Dmd is very well-supported on Windows, but its optimizing backend is not as good as llvm. Ldc's MSVC support has only been around for a year or two, so while it produces faster code, you may run into some bugs. If you have to have speed, your best bet is to use ldc and report any issues you run into. I don't think gcc supports Windows very well, so I doubt gdc can either.
Aug 23 2016
prev sibling parent reply kink <noone nowhere.com> writes:
 I managed to find and install LDC, and that mostly, somewhat 
 works.
 
 Except that half the time the compiler crashes with a stack 
 trace, and sometimes it just hangs. Occasionally if I move and 
 rearrange the code it will manage to compile it. There are also 
 worrying comments on the LDC web page about how "Most programs 
 work just fine" and "Several unit tests still fail" and stuff 
 about it relying on stuff from visual c++ in order to work that 
 make me seriously doubt it's stability and correctness.
The times when Windows wasn't a first class target for LDC are over. We've got Windows CI for a year now, so there should be no severe Windows-specific bugs (all unittests and the LDC-specific set of DMD tests work). What's still missing is proper debuginfos, and I'm unsure about DLL support. As you didn't mention the LDC version you tried, I recommend using bleeding-edge master for Windows: https://github.com/ldc-developers/ldc/releases/tag/LDC-Win64-master I've never experienced any hangs; compiler crashes may occur, but should be very rare. Be sure to let us know when you hit something at https://github.com/ldc-developers/ldc/issues - we can't fix stuff we don't know about!
 Interestingly I found that LDC is crashing when I compile my 
 code from visual D but not from the command line.
Worth investigating.
 I'm like an honest opinion... Am I wasting my time trying to do 
 this project in D on Windows? I'll continue to use and support 
 the language but I don't want to fight a losing battle and end 
 up having to move away anyway...
I've been working on LDC for a couple of years (focusing on Windows), mainly because I want to be able to replace C++ at work at some point. Instead of waiting for others to fix it, I realized one needs to get involved to push things forward. I still don't write any D code except for unittests and occasional DMD front-end mods, so I'd love to get some feedback on real-world usage of LDC on Windows. On Tuesday, 23 August 2016 at 21:25:29 UTC, Cauterite wrote:
 Well, you're fighting a losing battle by trying to use GDC/LDC 
 on Windows, since Windows is priority #2 for D, and GDC/LDC are 
 still struggling with priority #1 (Linux).
Cauterite: You obviously have no idea about LDC at least, so please stop making such noninformed claims.
Aug 24 2016
next sibling parent Chris <wendlec tcd.ie> writes:
On Wednesday, 24 August 2016 at 08:23:26 UTC, kink wrote:

 I've been working on LDC for a couple of years (focusing on 
 Windows), mainly because I want to be able to replace C++ at 
 work at some point. Instead of waiting for others to fix it, I 
 realized one needs to get involved to push things forward. I 
 still don't write any D code except for unittests and 
 occasional DMD front-end mods, so I'd love to get some feedback 
 on real-world usage of LDC on Windows.
Cool. I'll soon (try to) switch to LDC on Windows for release builds, since it seems to have improved a lot. I'll keep you updated.
Aug 24 2016
prev sibling parent reply Guillaume Piolat <first.last gmail.com> writes:
On Wednesday, 24 August 2016 at 08:23:26 UTC, kink wrote:
 I've been working on LDC for a couple of years (focusing on 
 Windows), mainly because I want to be able to replace C++ at 
 work at some point. Instead of waiting for others to fix it, I 
 realized one needs to get involved to push things forward. I 
 still don't write any D code except for unittests and 
 occasional DMD front-end mods, so I'd love to get some feedback 
 on real-world usage of LDC on Windows.
Since several versions the configuration on Windows became "plug'n play". Using DUB I still use --combined because of a bug that may have been fixed already. A minor problem is that on Windows users expect both x86 and x86_64 builds so one has to juggle with the 2 LDC PATH to release both. I've said this thrice already and it's quite minor really. Honestly since 1.0.0-b2 it's pure bliss and I've come to trust it very much.
Aug 24 2016
parent reply kinke <noone nowhere.com> writes:
On Wednesday, 24 August 2016 at 21:13:45 UTC, Guillaume Piolat 
wrote:
 A minor problem is that on Windows users expect both x86 and 
 x86_64 builds so one has to juggle with the 2 LDC PATH to 
 release both. I've said this thrice already and it's quite 
 minor really.
There's a multilib edition for the CI builds for the time being. Just make NOT to run it inside a 'VS Tools Command Prompt', so that LDC can set up the MSVC++ environment variables for 32/64 bit linking.
 Honestly since 1.0.0-b2 it's pure bliss and I've come to trust 
 it very much.
Thanks, appreciated!
Aug 24 2016
parent reply John Burrton <john.burton jbmail.com> writes:
On Thursday, 25 August 2016 at 06:08:50 UTC, kinke wrote:
 On Wednesday, 24 August 2016 at 21:13:45 UTC, Guillaume Piolat 
 wrote:
 A minor problem is that on Windows users expect both x86 and 
 x86_64 builds so one has to juggle with the 2 LDC PATH to 
 release both. I've said this thrice already and it's quite 
 minor really.
There's a multilib edition for the CI builds for the time being. Just make NOT to run it inside a 'VS Tools Command Prompt', so that LDC can set up the MSVC++ environment variables for 32/64 bit linking.
 Honestly since 1.0.0-b2 it's pure bliss and I've come to trust 
 it very much.
Thanks, appreciated!
Thanks everyone for the information here. I think my best approach is to use visual D with DMD for most of my development work as it seems better supported and debugger works better etc. And then make *frequent* builds from command line to test with LDC and use that for "production". It sounds from what I read here that it's stable enough to use for that :) I'll try to find a small test case that crashes the compiler in visual D and check out what version I'm using etc, and submit a bug report if I am able.
Aug 25 2016
parent reply Kagamin <spam here.lot> writes:
On Thursday, 25 August 2016 at 09:57:28 UTC, John Burrton wrote:
 I'll try to find a small test case that crashes the compiler in 
 visual D and check out what version I'm using etc, and submit a 
 bug report if I am able.
Did you try to get error messages from LDC? IIRC it will print colored text, which may not work with a pipe.
Aug 25 2016
parent reply John Burton <john.burton jbmail.com> writes:
On Thursday, 25 August 2016 at 11:52:51 UTC, Kagamin wrote:
 On Thursday, 25 August 2016 at 09:57:28 UTC, John Burrton wrote:
 I'll try to find a small test case that crashes the compiler 
 in visual D and check out what version I'm using etc, and 
 submit a bug report if I am able.
Did you try to get error messages from LDC? IIRC it will print colored text, which may not work with a pipe.
I will try to get the exact messages tomorrow but I found that the difference is that under visual D it adds (amongst others) the -O and -deps filename options. If I add _both_ of those on the ldc2.exe command line it often crashes. without either it's stable. I'll try to get a self contained report tomorrow.
Aug 25 2016
parent reply David Nadlinger <code klickverbot.at> writes:
On Thursday, 25 August 2016 at 20:31:59 UTC, John Burton wrote:
 I'll try to get a self contained report tomorrow.
Please do – the -deps switch is certainly not the most well-tested part of LDC. It mostly inherits this part of the code from DMD, but there might be a subtle, unintentional difference hiding somewhere. (There is also https://github.com/ldc-developers/ldc/issues/1625.) — David
Aug 25 2016
parent John Burton <john.burton jbmail.com> writes:
On Thursday, 25 August 2016 at 20:47:28 UTC, David Nadlinger 
wrote:
 On Thursday, 25 August 2016 at 20:31:59 UTC, John Burton wrote:
 I'll try to get a self contained report tomorrow.
Please do – the -deps switch is certainly not the most well-tested part of LDC. It mostly inherits this part of the code from DMD, but there might be a subtle, unintentional difference hiding somewhere. (There is also https://github.com/ldc-developers/ldc/issues/1625.) — David
If I try to compile this :- import std.stdio; void process(ref float[1] data) { for(int i = 0; i < 1; i++) data[i] = data[i] + 1.0f; } void main() { float[1] data; readf("%s", &data[0]); process(data); writefln("The answer is %s\n", data[0]); } using the command line :- ldc2 -O -deps=out.txt test.d Then sometimes it works and sometimes it crashes with a traceback (but without useful symbols for most of it). Sounds like it could be that bug that was linked. I don't care about the deps myself but the visual D seems to add it.
Aug 25 2016