Thread overview
How do you compile DMD on Windows?
6 days ago
Blatnik
6 days ago
Blatnik
5 days ago
Blatnik
5 days ago
Blatnik
5 days ago
Imperatorn
5 days ago
Blatnik
6 days ago

I wanna hack on the compiler, but I've spend 3 hours and I can't get the damned thing to compile!

Building DMD itself was simple since there was a visual studio project (thank you to whoever made it), but for druntime and phobos I can't figure it out.

The instructions on https://wiki.dlang.org/Building_under_Windows look like they're outdated.

They say to use the digitalmars make tool and not the normal make that I have installed. Great, no problem, except it didn't come installed with the compiler as is advertised. I don't have a make program in D/dmd2/windows/bin and I can't find a version of it online.

When I try to build it with regular make (not ditialmars make) I get errors even when I follow the instructions.

Here is the output I get:

C:\D\druntime>make -f win64.mak -j4 lib\druntime64.lib

"\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.27.29110\bin\amd64\cl" -c -Foerrno_c_64.obj /Z7 /I"\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.27.29110"\include /I"\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0"\ucrt src\core\stdc\errno.c
process_begin: CreateProcess(NULL, "\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.27.29110\bin\amd64\cl" -c -Foerrno_c_64.obj /Z7 "/I\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.27.29110\include" "/I\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\ucrt" src\core\stdc\errno.c, ...) failed.
make (e=2): The system cannot find the file specified.
make: *** [win64.mak:79: errno_c_64.obj] Error 2

Is there a windows hacker out there that could lend a hand? :)

6 days ago

On Saturday, 1 May 2021 at 22:44:34 UTC, Blatnik wrote:

>

I wanna hack on the compiler, but I've spend 3 hours and I can't get the damned thing to compile!

You probably need to update the VS paths to match your local installation, Microsoft apparently changed their directory layout a few years ago AFAICT.

I use the following patch for win64.mak in druntime/phobos:

diff --git a/win64.mak b/win64.mak
index 1b4a9208..6f37ba13 100644
--- a/win64.mak
+++ b/win64.mak
@@ -6,7 +6,7 @@ MODEL=64
 #VCDIR=\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.27.29110
 #SDKDIR=\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0
 # Visual Studio 2015 and before
-VCDIR=\Program Files (x86)\Microsoft Visual Studio 10.0\VC
+VCDIR=C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\bin\Hostx64\x64
 SDKDIR=\Program Files (x86)\Microsoft SDKs\Windows\v7.0A

 DMD_DIR=..\dmd
@@ -19,9 +19,9 @@ DMD=$(DMD_DIR)\generated\$(OS)\$(BUILD)\$(MODEL)\dmd
 # Visual Studio 2015 and before
 BINDIR=$(VCDIR)\bin\amd64

-CC=$(BINDIR)\cl
-LD=$(BINDIR)\link
-AR=$(BINDIR)\lib
+CC=$(VCDIR)\cl
+LD=$(VCDIR)\link
+AR=$(VCDIR)\lib
 CP=cp

 DOCDIR=doc
6 days ago

On Saturday, 1 May 2021 at 23:07:35 UTC, MoonlightSentinel wrote:

>

You probably need to update the VS paths to match your local installation, Microsoft apparently changed their directory layout a few years ago AFAICT.

Thanks for the tip. I think I managed to get it to work..

So not only did I have to change the compiler tools path, but also the path to the dmd I compiled earlier. And also there was a "*" in front of the compile command for some reason which made the whole thing not work. Every command actually has that in front of it for some reason...

unittest: $(SRCS) $(DRUNTIME)
  *"$(DMD)" $(UDFLAGS) ...

----->

unittest: $(SRCS) $(DRUNTIME)
  "$(DMD)" $(UDFLAGS) ...

Whatever, that was very needlessly painful... build systems are terrible things.

Here's hoping that phobos isn't as annoying >.>

5 days ago

On Saturday, 1 May 2021 at 23:49:49 UTC, Blatnik wrote:

>

Here's hoping that phobos isn't as annoying >.>

It is just as annoying. Even after patching the paths, still errors out..

C:\D\phobos>make -f win64.mak -j4 phobos64.lib
cd etc\c\zlib
"make" -f win64.mak MODEL=64 zlib64.lib "CC=C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.28.29910\bin\Hostx64\x64\cl" "LIB=C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.28.29910\bin\Hostx64\x64\lib" "VCDIR=C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.28.29910"
make[1]: Entering directory 'C:/D/phobos'
make[1]: *** No rule to make target 'zlib64.lib'.  Stop.
make[1]: Leaving directory 'C:/D/phobos'
make: *** [win64.mak:512: etc\c\zlib\zlib64.lib] Error 2

So then I gave up and tried Digger. I should have just tried that from the start. It just worked.

5 days ago

On Saturday, 1 May 2021 at 22:44:34 UTC, Blatnik wrote:

>

They say to use the digitalmars make tool and not the normal make that I have installed. Great, no problem, except it didn't come installed with the compiler as is advertised. I don't have a make program in D/dmd2/windows/bin and I can't find a version of it online.

Missed that in my initial reply. DM make is included in DMC which is available on this site, see the "other downloads".

e.g. http://downloads.dlang.org/other/dm857c.zip

5 days ago

On Sunday, 2 May 2021 at 00:53:42 UTC, MoonlightSentinel wrote:

>

DM make is included in DMC which is available on this site, see the "other downloads".

Yea thanks, I couldn't find it anywhere separately before.

So in the end even though digger just worked, I didn't realize that it just installs an old version of visual studio. And of course I wanted to build everything with my version. So back to broken make it is.

I managed to make DM make work. But this build "experience" was terrible..

5 days ago

On Saturday, 1 May 2021 at 22:44:34 UTC, Blatnik wrote:

>

I wanna hack on the compiler, but I've spend 3 hours and I can't get the damned thing to compile!

[...]

For me it took 3 minutes.

I opened the VS solution provided and pressed "build". Ta-daa!

5 days ago

On Sunday, 2 May 2021 at 14:19:09 UTC, Imperatorn wrote:

>

I opened the VS solution provided and pressed "build". Ta-daa!

Haha yea, but wait until you try to build the runtime or phobos ;)

I hope you don't have to/want to. But I can try to help if you do.