www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - How to setup GDC with Visual D?

reply "Marko Grdinic" <mrakgr gmail.com> writes:
DMC works fine, but when I try to compile using GDC it seems it 
can't find the compiler:

Building Release GDC x64\ConsoleApp1.exe...
failed launching gdc -m64 -O3 -frelease "-fXf=Release GDC 
x64\ConsoleApp1.json" "-fdeps=Release GDC x64\ConsoleApp1.dep" -o 
"Release GDC x64\ConsoleApp1.exe" main.d
Building Release GDC x64\ConsoleApp1.exe failed!

I've tried setting the GDC directory to different levels in the 
tree, but it gives me the same error regardless. I haven't tried 
adding GDC binaries to the PATH yet, but I am not sure whether I 
should. I am (trying) to use the latest unsupported alpha build 
because the supported version in from 2013 and so I am unsure 
whether I should use it.

I only dabbled in D a few months ago when I was writing the 
compiler project for the online course, but did not study it 
much. Lately though, I've been trying to solve a tough problem on 

judge which makes all my solutions time out. It would have been 
fine had it been only 2x just as it is on my machine locally.

At any rate, as I've acquired the functional programming style 
recently, I do not want to go back to writing C++ unless I am 
forced to and I know GDC can match it in speed based on what I've 
read on the web.

Any advice regarding how I can get this to work? Thanks.
Jul 03 2015
next sibling parent "rsw0x" <anonymous anonymous.com> writes:
On Friday, 3 July 2015 at 19:17:28 UTC, Marko Grdinic wrote:
 [...]
Have you tried using LDC? I'm unsure of GDC's support on Windows. LDC is D's LLVM compiler, and GDC/LDC generally produce binaries with similar performance. You can find a download link here: https://github.com/ldc-developers/ldc/releases I believe you want the ldc2-0.15.2-beta1-win64-msvc.zip package, but I don't use windows so I'm unsure.
Jul 03 2015
prev sibling parent reply "Guy Gervais" <ggervais videotron.ca> writes:
On Friday, 3 July 2015 at 19:17:28 UTC, Marko Grdinic wrote:
 Any advice regarding how I can get this to work? Thanks.
I got GDC to work with VS2013 + VisualD by going into "Tools->Options" (The VS menu, not the one under "Visual D") and adding the paths under "Projects and Solutions -> Visual D Settings -> GDC Directories". I put the path to the bin folder in MinGW64 and the bin folder in GDC. I get a 10%-15% speed improvement, which is nice, but my binaries are 10 times larger.
Jul 03 2015
next sibling parent "Nicholas Wilson" <iamthewilsonator hotmail.com> writes:
On Friday, 3 July 2015 at 23:45:15 UTC, Guy Gervais wrote:
 On Friday, 3 July 2015 at 19:17:28 UTC, Marko Grdinic wrote:
 Any advice regarding how I can get this to work? Thanks.
I got GDC to work with VS2013 + VisualD by going into "Tools->Options" (The VS menu, not the one under "Visual D") and adding the paths under "Projects and Solutions -> Visual D Settings -> GDC Directories". I put the path to the bin folder in MinGW64 and the bin folder in GDC. I get a 10%-15% speed improvement, which is nice, but my binaries are 10 times larger.
Thats probably due to debug info which GDC does not strip by default.
Jul 03 2015
prev sibling parent reply "Marko Grdinic" <mrakgr gmail.com> writes:
On Friday, 3 July 2015 at 23:45:15 UTC, Guy Gervais wrote:
 On Friday, 3 July 2015 at 19:17:28 UTC, Marko Grdinic wrote:
 Any advice regarding how I can get this to work? Thanks.
I got GDC to work with VS2013 + VisualD by going into "Tools->Options" (The VS menu, not the one under "Visual D") and adding the paths under "Projects and Solutions -> Visual D Settings -> GDC Directories". I put the path to the bin folder in MinGW64 and the bin folder in GDC. I get a 10%-15% speed improvement, which is nice, but my binaries are 10 times larger.
I have no idea where Visual D is supposed to be looking at, but I managed to get it to work by adding the Gdc/bin directory into path. With that it finds it anywhere.
Jul 03 2015
parent reply Johannes Pfau <nospam example.com> writes:
Am Sat, 04 Jul 2015 06:30:31 +0000
schrieb "Marko Grdinic" <mrakgr gmail.com>:

 On Friday, 3 July 2015 at 23:45:15 UTC, Guy Gervais wrote:
 On Friday, 3 July 2015 at 19:17:28 UTC, Marko Grdinic wrote:
 Any advice regarding how I can get this to work? Thanks.
I got GDC to work with VS2013 + VisualD by going into "Tools->Options" (The VS menu, not the one under "Visual D") and adding the paths under "Projects and Solutions -> Visual D Settings -> GDC Directories". I put the path to the bin folder in MinGW64 and the bin folder in GDC. I get a 10%-15% speed improvement, which is nice, but my binaries are 10 times larger.
I have no idea where Visual D is supposed to be looking at, but I managed to get it to work by adding the Gdc/bin directory into path. With that it finds it anywhere.
It's kinda fascinating that GDC/MinGW seems to work for some real world applications. Please note that it's in early alpha state, mostly unsupported and not really well-tested though. (I hope this will change later this year) Then 10x larger binaries are indeed caused by debug info. If you don't need the debug info you can use the included strip.exe to remove it: strip.exe yourapp.exe
Jul 04 2015
parent reply "Guy Gervais" <ggervais videotron.ca> writes:
On Saturday, 4 July 2015 at 08:34:00 UTC, Johannes Pfau wrote:

 It's kinda fascinating that GDC/MinGW seems to work for some 
 real world applications.
I haven't really tried a "real world application" as of yet; mostly small puzzle-type problems to get a feel for D. I did run into a problem with this code: int answer = to!(int[])(split("7946590 6020978")).sum; It compiles fine under DMD but gives the error "Error: no property 'sum' for type 'int[]'" with GDC.
 Then 10x larger binaries are indeed caused by debug info. If 
 you don't need the debug info you can use the included 
 strip.exe to remove it:

 strip.exe yourapp.exe
Yes, that helps. My exe went from 6.9MB to 1MB. The DMD exe is 370K.
Jul 04 2015
parent reply Johannes Pfau <nospam example.com> writes:
Am Sat, 04 Jul 2015 11:15:57 +0000
schrieb "Guy Gervais" <ggervais videotron.ca>:

 On Saturday, 4 July 2015 at 08:34:00 UTC, Johannes Pfau wrote:
 
 It's kinda fascinating that GDC/MinGW seems to work for some 
 real world applications.
I haven't really tried a "real world application" as of yet; mostly small puzzle-type problems to get a feel for D. I did run into a problem with this code: int answer = to!(int[])(split("7946590 6020978")).sum; It compiles fine under DMD but gives the error "Error: no property 'sum' for type 'int[]'" with GDC.
GDC uses a slightly older phobos version. It seems quite some imports changed in the last phobos version. You need to import std.algorithm and your code should work with gdc: http://goo.gl/l4zKki
Jul 05 2015
parent "Guy Gervais" <ggervais videotron.ca> writes:
On Sunday, 5 July 2015 at 19:50:41 UTC, Johannes Pfau wrote:
 GDC uses a slightly older phobos version. It seems quite some 
 imports
 changed in the last phobos version. You need to import 
 std.algorithm
 and your code should work with gdc:
 http://goo.gl/l4zKki
Thanks. Turns out my imports are fine, it's my version of GDC that seems to be too old (it's 4.8.0). I tried to install 4.9.2 (as per the one in used in your link) but now I get a bunch of different errors. (half a dozen of "Error 1 undefined reference to `D2rt5tlsgc4initFZPv (void* rt.tlsgc.init())' ...\src\gcc-4.9.2\libphobos\libdruntime\core\thread.d ") It doesn't really matter; I'm learning D for fun; DMD is more than enough for that purpose.
Jul 06 2015