www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Building from source on Windows

reply forkit <forkit gmail.com> writes:
No matter what instructions, blogs, articles... I use.. I simply 
cannot manage to build druntime,dmd,phobos, from source on 
Windows.

Of course, building from source in linux is a breeze.

But I cannot test my changes on Windows, cause I cannot build 
from source on Windows!

Does anyone have a step-by-step process, that is 'guaranteed' to 
work? (with as few unnecessary dependencies as possible please).

I'm happy to build a dedicated build machine for this purpose, 
with just the software needed to build from source.

NOTE: I said 'guaranteed' to work ;-)  ... I've wasted to much 
time following instructions that just do not work.
Jan 28 2022
next sibling parent reply "H. S. Teoh" <hsteoh quickfur.ath.cx> writes:
On Fri, Jan 28, 2022 at 09:39:39PM +0000, forkit via Digitalmars-d wrote:
 No matter what instructions, blogs, articles... I use.. I simply
 cannot manage to build druntime,dmd,phobos, from source on Windows.
[...]
 Does anyone have a step-by-step process, that is 'guaranteed' to work?
 (with as few unnecessary dependencies as possible please).
[...]
 NOTE: I said 'guaranteed' to work ;-)  ... I've wasted to much time
 following instructions that just do not work.
Would help if you posted the exact error message(s) here (including how you expect it to behave) so that people know how to help you. "It doesn't work" gives no information as to what went wrong, and isn't an actionable bug report. Cf.: https://www.chiark.greenend.org.uk/~sgtatham/bugs.html T -- What do you get if you drop a piano down a mineshaft? A flat minor.
Jan 28 2022
parent forkit <forkit gmail.com> writes:
On Friday, 28 January 2022 at 21:55:07 UTC, H. S. Teoh wrote:
 Would help if you posted the exact error message(s) here 
 (including how you expect it to behave) so that people know how 
 to help you.  "It doesn't work" gives no information as to what 
 went wrong, and isn't an actionable bug report.

 Cf.: https://www.chiark.greenend.org.uk/~sgtatham/bugs.html


 T
the error(s) depend on what instructions I'm following.... yesterday I was using these instructions: https://wiki.dlang.org/Building_under_Windows what the $% % ... it's so complicated! I spent hours on it! when googling about it, all kinds of people had all kinds of error messages.. I got some message about ../generated/ .. something not existing... which made no sense at all... I really would prefer to not waste any more time on things that don't work. I'm more interested in whether someone knows a step-by-step guaranteed way to build a build system **from scratch** (i.e. not adding stuff to an existing system that might cause all kinds of dependency problems, and hence you get all these nonsensical errors). On linux, I just git the source and make. That's it.
Jan 28 2022
prev sibling next sibling parent Steven Schveighoffer <schveiguy gmail.com> writes:
On 1/28/22 4:39 PM, forkit wrote:
 No matter what instructions, blogs, articles... I use.. I simply cannot 
 manage to build druntime,dmd,phobos, from source on Windows.
 
 Of course, building from source in linux is a breeze.
 
 But I cannot test my changes on Windows, cause I cannot build from 
 source on Windows!
 
 Does anyone have a step-by-step process, that is 'guaranteed' to work? 
 (with as few unnecessary dependencies as possible please).
 
 I'm happy to build a dedicated build machine for this purpose, with just 
 the software needed to build from source.
 
 NOTE: I said 'guaranteed' to work ;-)  ... I've wasted to much time 
 following instructions that just do not work.
 
I'm not sure if I've ever done it either... Any changes I make to the main projects, I test on Mac/Linux, and then let the online CI test for Windows. I'd point you at where I would start, but I can't guarantee it will work, having never done it ;) -Steve
Jan 28 2022
prev sibling next sibling parent reply max haughton <maxhaton gmail.com> writes:
On Friday, 28 January 2022 at 21:39:39 UTC, forkit wrote:
 No matter what instructions, blogs, articles... I use.. I 
 simply cannot manage to build druntime,dmd,phobos, from source 
 on Windows.

 Of course, building from source in linux is a breeze.

 But I cannot test my changes on Windows, cause I cannot build 
 from source on Windows!

 Does anyone have a step-by-step process, that is 'guaranteed' 
 to work? (with as few unnecessary dependencies as possible 
 please).

 I'm happy to build a dedicated build machine for this purpose, 
 with just the software needed to build from source.

 NOTE: I said 'guaranteed' to work ;-)  ... I've wasted to much 
 time following instructions that just do not work.
Post exactly what you have tried and what about it doesn't work.
Jan 28 2022
parent reply forkit <forkit gmail.com> writes:
On Friday, 28 January 2022 at 22:22:27 UTC, max haughton wrote:
 Post exactly what you have tried and what about it doesn't work.
I'm really trying for a different approach here. That is, start from something that is guaranteed to work, in all cases ;-) i.e. step 1 - start with a clean install of Windows 7 (ideally, cause I hate Win10!) step 2 - install this version of this ... step 3 - install this version of this ... ... .... ..... ...... then your done! And it all works! My Windows pc has multiple VS versions installed, and all kinds of things as well... so anything other than starting from scratch is just inviting all the problems I've encountered.
Jan 28 2022
parent reply max haughton <maxhaton gmail.com> writes:
On Friday, 28 January 2022 at 22:31:26 UTC, forkit wrote:
 On Friday, 28 January 2022 at 22:22:27 UTC, max haughton wrote:
 Post exactly what you have tried and what about it doesn't 
 work.
I'm really trying for a different approach here. That is, start from something that is guaranteed to work, in all cases ;-) i.e. step 1 - start with a clean install of Windows 7 (ideally, cause I hate Win10!) step 2 - install this version of this ... step 3 - install this version of this ... ... .... ..... ...... then your done! And it all works! My Windows pc has multiple VS versions installed, and all kinds of things as well... so anything other than starting from scratch is just inviting all the problems I've encountered.
I can't help if you don't say what you've actually tried to do. I haven't actually worked on D directly from windows for a while now so I can only fix things that are broken or point you in the right way rather than dictating what you are to do (in part because I'm not a slave)
Jan 28 2022
parent reply forkit <forkit gmail.com> writes:
On Friday, 28 January 2022 at 22:35:14 UTC, max haughton wrote:
 I can't help if you don't say what you've actually tried to do. 
 I haven't actually worked on D directly from windows for a 
 while now so I can only fix things that are broken or point you 
 in the right way rather than dictating what you are to do (in 
 part because I'm not a slave)
As a systems admin/engineer, I build production systems from scratch. They are **guaranteed** to work, as defined. I can provide the instruction/scripts to others, they can run them, and they WILL work... ** guaranteed ** That's the approach I want to take here (as opposed to the approach your suggesting, which starts from an existing system, and which for me, has just wasted too many hours of my life that I cannot get back).
Jan 28 2022
next sibling parent reply Steven Schveighoffer <schveiguy gmail.com> writes:
On 1/28/22 5:45 PM, forkit wrote:
 On Friday, 28 January 2022 at 22:35:14 UTC, max haughton wrote:
 I can't help if you don't say what you've actually tried to do. I 
 haven't actually worked on D directly from windows for a while now so 
 I can only fix things that are broken or point you in the right way 
 rather than dictating what you are to do (in part because I'm not a 
 slave)
As a systems admin/engineer, I build production systems from scratch. They are **guaranteed** to work, as defined. I can provide the instruction/scripts to others, they can run them, and they WILL work... ** guaranteed ** That's the approach I want to take here (as opposed to the approach your suggesting, which starts from an existing system, and which for me, has just wasted too many hours of my life that I cannot get back).
So what Max is asking for, e.g. is: ``` I was using https://wiki.dlang.org/Building_under_Windows and I got to step x, and then the error I got was "blah blah blah" ``` I have to be honest, most people here don't build the compiler or runtime/phobos, and those that do usually are developing on Linux or Mac. So you are likely to get more traction with "I'm here, it doesn't work, please help" than wishing for a person who has the magic recipe. There's a reason the posix build is so much smoother... -Steve
Jan 28 2022
parent forkit <forkit gmail.com> writes:
On Friday, 28 January 2022 at 22:52:57 UTC, Steven Schveighoffer 
wrote:
 I have to be honest, most people here don't build the compiler 
 or runtime/phobos, and those that do usually are developing on 
 Linux or Mac. So you are likely to get more traction with "I'm 
 here, it doesn't work, please help" than wishing for a person 
 who has the magic recipe.
I think it's completely logical to ask, if someone already has the 'magic' recipe, before I go off experimenting myself ;-) Of course, I don't expect that anyone actually has it. I do expect to spend a lot of time on this myself. But that is worthwhile, if what I end up with, is a recipe I can give to others, that will also result in what the recipe says it makes.. guaranteed. Again. I do NOT want to start with an existing system with god knows what on it that would cause god knows what problem with god knows what part of the process.
Jan 28 2022
prev sibling parent reply max haughton <maxhaton gmail.com> writes:
On Friday, 28 January 2022 at 22:45:31 UTC, forkit wrote:
 On Friday, 28 January 2022 at 22:35:14 UTC, max haughton wrote:
 I can't help if you don't say what you've actually tried to 
 do. I haven't actually worked on D directly from windows for a 
 while now so I can only fix things that are broken or point 
 you in the right way rather than dictating what you are to do 
 (in part because I'm not a slave)
As a systems admin/engineer, I build production systems from scratch. They are **guaranteed** to work, as defined. I can provide the instruction/scripts to others, they can run them, and they WILL work... ** guaranteed ** That's the approach I want to take here (as opposed to the approach your suggesting, which starts from an existing system, and which for me, has just wasted too many hours of my life that I cannot get back).
As a human being writing at 11PM I am willing to help but I cannot do so without something to go on. You should readily have this information to hand since you guarantee it doesn't work. As an engineer you should also know how to communicate information effectively to solve a problem faster, you currently aren't doing this.
Jan 28 2022
parent forkit <forkit gmail.com> writes:
On Friday, 28 January 2022 at 23:07:25 UTC, max haughton wrote:
 As a human being writing at 11PM I am willing to help but I 
 cannot do so without something to go on. You should readily 
 have this information to hand since you guarantee it doesn't 
 work.

 As an engineer you should also know how to communicate 
 information effectively to solve a problem faster, you 
 currently aren't doing this.
C'mon...you're really missing the point here. I want to take a different approach. Not your approach. That should be clear by now. I want to start with 'nothing'. Clean! Then take a step-by-step approach to building the system. I do not want to start with a system that is already in operation, with who knows what on it.
 As a human being writing at 11PM I am willing to help but I 
 cannot do so without something to go on. You should readily 
 have this information to hand since you guarantee it doesn't 
 work.
So to your point, there is 'nothing to go on'. I'm starting with 'nothing'.
Jan 28 2022
prev sibling next sibling parent reply MoonlightSentinel <moonlightsentinel disroot.org> writes:
As others have said before, steps + error messages would be 
appreciated s.t. we can determine whether it's a local or general 
issue.

Software:
- Any VS version (already used 17 and 22 but others should work 
as well)
- DM make

Setup for Druntime / Phobos*:
- Change the VS-related variables in `win64.mak` based on your 
specific VS installation (because they change with each version)
   * `VCDIR`
   * `SDKDIR`
   * `BINDIR`

Building should then be as simple as running `make -f win64.mak` 
in each directory (for dmd it simply forwards to `src/build.d`).

---

Currently using VS 2022 which required the following changes:


```diff
diff --git a/win64.mak b/win64.mak
index 505d0d93..91fbed29 100644
--- a/win64.mak
+++ b/win64.mak
   -5,9 +5,10    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

-VCDIR=\Program Files (x86)\Microsoft Visual Studio 10.0\VC
-SDKDIR=\Program Files (x86)\Microsoft SDKs\Windows\v7.0A
+

+VCDIR=C:\Program Files\Microsoft Visual 
Studio\2022\Community\VC\Tools\MSVC\14.30.30705
+SDKDIR=C:\Program Files (x86)\Windows 
Kits\10\Include\10.0.20348.0

  DMD_DIR=..\dmd
  BUILD=release
   -15,9 +16,9    OS=windows
  DMD=$(DMD_DIR)\generated\$(OS)\$(BUILD)\$(MODEL)\dmd


-#BINDIR=$(VCDIR)\bin\Hostx64\x64
+BINDIR=$(VCDIR)\bin\Hostx64\x64

-BINDIR=$(VCDIR)\bin\amd64
+#BINDIR=$(VCDIR)\bin\amd64

  CC=$(BINDIR)\cl
  LD=$(BINDIR)\link
   -37,9 +38,9    DDOCFLAGS=-conf= -c -w -o- -Isrc -Iimport 
-version=CoreDdoc
  UTFLAGS=-version=CoreUnittest -unittest -checkaction=context

  #CFLAGS=/O2 /I"$(VCDIR)"\INCLUDE /I"$(SDKDIR)"\Include
-CFLAGS=/Z7 /I"$(VCDIR)"\INCLUDE /I"$(SDKDIR)"\Include
+#CFLAGS=/Z7 /I"$(VCDIR)"\INCLUDE /I"$(SDKDIR)"\Include

-#CFLAGS=/Z7 /I"$(VCDIR)"\include /I"$(SDKDIR)"\ucrt
+CFLAGS=/Z7 /I"$(VCDIR)"\include /I"$(SDKDIR)"\ucrt

  DRUNTIME_BASE=druntime$(MODEL)
  DRUNTIME=lib\$(DRUNTIME_BASE).lib
```


```diff
diff --git a/etc/c/zlib/win64.mak b/etc/c/zlib/win64.mak
index 83dd0690b..30919d538 100644
--- a/etc/c/zlib/win64.mak
+++ b/etc/c/zlib/win64.mak
   -7,7 +7,7    CC=$(VCDIR)\bin\amd64\cl
  LD=$(VCDIR)\bin\amd64\link
  LIB=$(VCDIR)\bin\amd64\lib

-CFLAGS=/O2 /nologo /I"$(VCDIR)\INCLUDE"
+CFLAGS=/O2 /nologo  /I"$(VCDIR)"\include /I"$(SDKDIR)"\ucrt
  LIBFLAGS=/nologo
  LDFLAGS=/nologo
  O=.obj
diff --git a/win64.mak b/win64.mak
index 041fb19c2..fcbb2dcbf 100644
--- a/win64.mak
+++ b/win64.mak
   -29,13 +29,13    CP=cp
  DIR=\dmd2


-VCDIR=\Program Files (x86)\Microsoft Visual Studio 10.0\VC
-SDKDIR=\Program Files (x86)\Microsoft SDKs\Windows\v7.0A
+VCDIR=C:\Program Files\Microsoft Visual 
Studio\2022\Community\VC\Tools\MSVC\14.30.30705
+SDKDIR=C:\Program Files (x86)\Windows 
Kits\10\Include\10.0.20348.0



  #CFLAGS=/Zi /nologo /I"$(VCDIR)\INCLUDE" /I"$(SDKDIR)\Include"
-CFLAGS=/O2 /nologo /I"$(VCDIR)\INCLUDE" /I"$(SDKDIR)\Include"
+CFLAGS=/O2 /nologo /I"$(VCDIR)"\include /I"$(SDKDIR)"\ucrt



   -54,9 +54,12    UDFLAGS=-conf= -g -m$(MODEL) -O -w 
-preview=dip1000 -preview=fieldwise -I$(DRUNT



-CC=$(VCDIR)\bin\amd64\cl
-LD=$(VCDIR)\bin\amd64\link
-AR=$(VCDIR)\bin\amd64\lib
+BINDIR=$(VCDIR)\bin\Hostx64\x64
+
+CC=$(BINDIR)\cl.exe
+LD=$(BINDIR)\link.exe
+AR=$(BINDIR)\lib.exe
+
  MAKE=make


   -499,7 +502,7    unittest32mscoff:

  $(ZLIB): $(SRC_ZLIB)
         cd etc\c\zlib
-       "$(MAKE)" -f win64.mak MODEL=$(MODEL) zlib$(MODEL).lib 
"CC=$(CC)" "LIB=$(AR)" "VCDIR=$(VCDIR)"
+       "$(MAKE)" -f win64.mak MODEL=$(MODEL) zlib$(MODEL).lib 
"CC=$(CC)" "LIB=$(AR)" "VCDIR=$(VCDIR)" "SDKDIR=$(SDKDIR)"
         cd ..\..\..


```
Jan 28 2022
next sibling parent forkit <forkit gmail.com> writes:
On Friday, 28 January 2022 at 22:55:17 UTC, MoonlightSentinel 
wrote:
 As others have said before, steps + error messages would be 
 appreciated s.t. we can determine whether it's a local or 
 general issue.
Nope. Not going to do that. As explained ;-) I'm taking the alternative path I've laid out.
 Software:
 - Any VS version (already used 17 and 22 but others should work 
 as well)
 - DM make
Thanks. This is information I can actually work with ;-)
Jan 28 2022
prev sibling next sibling parent reply forkit <forkit gmail.com> writes:
On Friday, 28 January 2022 at 22:55:17 UTC, MoonlightSentinel 
wrote:
 ...
 Software:
 - Any VS version (already used 17 and 22 but others should work 
 as well)
I presume you mean the 'build tool' only? Do you know precisely what components are needed? I'm thinking that I will begin this 'recipe', using a the 'Windows Server Core' image. So I have 'Step 1' almost complete ;-)
Jan 28 2022
parent reply forkit <forkit gmail.com> writes:
On Friday, 28 January 2022 at 23:46:10 UTC, forkit wrote:
 I'm thinking that I will begin this 'recipe', using a the 
 'Windows Server Core' image.
no. scratch that. going to build a desktop system instead. ideally all steps will be done for an 'offline' system, using software that does not 'require' access to the internet in order to work. (i.e. need to download what is required outside of the system, and install it manually) Step1: clean install of Windows 7 SP1 (KB976932) plus Update (KB976902) Step2: clean install of .NET Framework 4.7.3 (which also installs KB4019990 ) Step3: install certificates need for installing VS buildtools 2019 16.11 Step4: install VS buildtools 2019 16.11 (ensuring the following components selected) .. ... ....
Jan 28 2022
parent reply zjh <fqbqrr 163.com> writes:
On Saturday, 29 January 2022 at 00:27:28 UTC, forkit wrote:


`must be` win10!
Jan 28 2022
parent reply forkit <forkit gmail.com> writes:
On Saturday, 29 January 2022 at 01:26:56 UTC, zjh wrote:
 On Saturday, 29 January 2022 at 00:27:28 UTC, forkit wrote:


 `must be` win10!
yeah... sadly, I'll have to start with that I guess (since almost everyone will want to start with that ;-) still trying to take-apart this command 'dub run digger'.. wtf is it doing ... I gotta work that out first :-(
Jan 28 2022
parent reply rikki cattermole <rikki cattermole.co.nz> writes:
On 29/01/2022 3:07 PM, forkit wrote:
 still trying to take-apart this command 'dub run digger'.. wtf is it 
 doing ... I gotta work that out first :-(
Step 1: Download digger + dependencies Step 2: Compile digger Step 3: Run digger https://github.com/CyberShadow/Digger/blob/master/dub.sdl Pretty straight forward as far as digger itself is concerned.
Jan 28 2022
parent reply forkit <forkit gmail.com> writes:
On Saturday, 29 January 2022 at 05:00:20 UTC, rikki cattermole 
wrote:
 On 29/01/2022 3:07 PM, forkit wrote:
 still trying to take-apart this command 'dub run digger'.. wtf 
 is it doing ... I gotta work that out first :-(
Step 1: Download digger + dependencies Step 2: Compile digger Step 3: Run digger https://github.com/CyberShadow/Digger/blob/master/dub.sdl Pretty straight forward as far as digger itself is concerned.
gunna try the easy option... so most new-comers are going to want to do just that ;-) 'Building with Visual Studio' From here: https://wiki.dlang.org/Building_under_Windows I started with clean install of Windows 10 and clean install of VS2017 Enterprise (the same version used in the instructions on that site) Downloaded and installed Visual D as it states. All is fine with Visual Studio. Can build D projects, compile and run. ok. Visual D integration with VS2017 seems fine. Proceed to next instructions: So I have all the source in the directory as per the instructions (D:\source\D) I open a cmd prompt: call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" x64 (Ok, that worked fine) cd C:\source\D\druntime set VCDIR="C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC" (everything fine so far) make -f win64.mak -j4 "VCDIR=%VCDIR%" Command error: undefined switch '-j4' (ok, first problem has appeared) (let's try without the -j4 then) make -f win64.mak "VCDIR=%VCDIR%" Error: don't know how to make 'Files' (great. another error) there is no make on my system?? instructions have not factored that in yet??
Jan 28 2022
parent reply forkit <forkit gmail.com> writes:
On Saturday, 29 January 2022 at 05:43:50 UTC, forkit wrote:
 make -f win64.mak -j4 "VCDIR=%VCDIR%"
 Command error: undefined switch '-j4'
 (ok, first problem has appeared)

 (let's try without the -j4 then)

 make -f win64.mak "VCDIR=%VCDIR%"
 Error: don't know how to make 'Files'
 (great. another error)

 there is no make on my system?? instructions have not factored 
 that in yet??
oops. correct that. above occured after I install dmc (which has make) before I installed dmc, the error was:
  make -f win64.mak -j4 "VCDIR=%VCDIR%"
'make' is not recognized as an internal or external command, operable program or batch file. (so that's actually the first part of the instructions, that don't work). I'm getting rid of dmc, and installing msys64 (which I assume is the make its after??)
Jan 28 2022
parent reply forkit <forkit gmail.com> writes:
On Saturday, 29 January 2022 at 05:48:59 UTC, forkit wrote:

so now got a make on my system..whooohoooooo


c:\source\D\druntime>make --version
GNU Make 4.3
Built for x86_64-pc-msys
Copyright (C) 1988-2020 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later 
<http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

now going to proceed with the instructions for Building DRuntime 
(with Visual Studio):

https://wiki.dlang.org/Building_under_Windows

open a command prompt:

 call "C:\Program Files (x86)\Microsoft Visual 
 Studio\2017\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" x64
(ok it seems to run fine) (instructions then say to run this: set VCDIR="C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC" but that env variable is already set in the win64.mak ?? so why type the above command in?? which has a different value to what is in my win64.mak anyway ?? my settings in that file are (I have VS2017 enterprise installed): ---- ..... VCDIR=C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.15.26726 SDKDIR=C:\Program Files (x86)\Windows Kits\10\Include\10.0.17134.0 ..... CFLAGS=/Z7 /I"$(VCDIR)"\INCLUDE /I"$(SDKDIR)"\Include .... ----- so I'll skip that part of the instruction and look at the next one: make -f win64.mak -j4 "VCDIR=%VCDIR%" target well, since I'm not setting VCDIR manually, but using the one in the win64.mak, I'll change that instruction to something simpler: make -f win64.mak c:\source\D\druntime>make -f win64.mak "make" -f mak/WINDOWS import DMD="..\dmd\generated\windows\release\64\dmd" HOST_DMD="dmd" MODEL=64 IMPDIR="import" make[1]: Entering directory '/c/source/D/druntime' make[1]: Nothing to be done for 'import'. make[1]: Leaving directory '/c/source/D/druntime' "make" -f mak/WINDOWS copydir HOST_DMD="dmd" MODEL=64 IMPDIR="import" make[1]: Entering directory '/c/source/D/druntime' make[1]: Nothing to be done for 'copydir'. make[1]: Leaving directory '/c/source/D/druntime' "make" -f mak/WINDOWS copy DMD="..\dmd\generated\windows\release\64\dmd" HOST_DMD="dmd" MODEL=64 IMPDIR="import" make[1]: Entering directory '/c/source/D/druntime' if not exist generated md generated /bin/sh: -c: line 1: syntax error: unexpected end of file make[1]: *** [mak/WINDOWS:48: generated\windows\host_dmd.bat] Error 1 make[1]: Leaving directory '/c/source/D/druntime' make: *** [win64.mak:76: copy] Error 2
Jan 28 2022
next sibling parent forkit <forkit gmail.com> writes:
On Saturday, 29 January 2022 at 06:44:54 UTC, forkit wrote:
 On Saturday, 29 January 2022 at 05:48:59 UTC, forkit wrote:
ooops. "Then compile with DigitalMars make (not to confuse with GNUMake)." I kinda skipped over the line ;-) I better get rid of GNUMake and use DigitialMars make again ;-) ok. now got Digital Mars Make Version 5.06 again. start again.... c:\source\D\druntime>make -f win64.mak "make" -f mak/WINDOWS import DMD="..\dmd\generated\windows\release\64\dmd" HOST_DMD="dmd" MODEL=64 IMPDIR="import" ..\dmd\generated\windows\release\64\dmd -conf= -c -o- -Isrc -Iimport -Hfimport\core\sync\barrier.di src\core\sync\barrier.d Error: '..\dmd\generated\windows\release\64\dmd' not found --- errorlevel 1
Jan 28 2022
prev sibling parent reply forkit <forkit gmail.com> writes:
On Saturday, 29 January 2022 at 06:44:54 UTC, forkit wrote:
 On Saturday, 29 January 2022 at 05:48:59 UTC, forkit wrote:
ooops. "Then compile with DigitalMars make (not to confuse with GNUMake)." I kinda skipped over the line ;-) I better get rid of GNUMake and use DigitialMars make again ;-) ok. now got Digital Mars Make Version 5.06 again. start again.... c:\source\D\druntime>make -f win64.mak "make" -f mak/WINDOWS import DMD="..\dmd\generated\windows\release\64\dmd" HOST_DMD="dmd" MODEL=64 IMPDIR="import" ..\dmd\generated\windows\release\64\dmd -conf= -c -o- -Isrc -Iimport -Hfimport\core\sync\barrier.di src\core\sync\barrier.d Error: '..\dmd\generated\windows\release\64\dmd' not found --- errorlevel 1 A whole day wasted! I think I might stick to linux ;-)
Jan 28 2022
parent reply forkit <forkit gmail.com> writes:
On Saturday, 29 January 2022 at 07:00:29 UTC, forkit wrote:

C:\source\D\druntime>set VCDIR="C:\Program Files (x86)\Microsoft 
Visual Studio\2017\Enterprise\VC"

C:\source\D\druntime>make -f win64.mak
"make" -f mak/WINDOWS import 
DMD="..\dmd\generated\windows\release\64\dmd" HOST_DMD="dmd" 
MODEL=64 IMPDIR="import"
..\dmd\generated\windows\release\64\dmd -conf= -c -o- -Isrc 
-Iimport -Hfimport\core\sync\barrier.di src\core\sync\barrier.d
34 modules passed unittests

..\dmd\generated\windows\release\64\dmd -conf= -c -o- -Isrc 
-Iimport -Hfimport\core\sync\condition.di 
src\core\sync\condition.d
34 modules passed unittests

..\dmd\generated\windows\release\64\dmd -conf= -c -o- -Isrc 
-Iimport -Hfimport\core\sync\config.di src\core\sync\config.d
34 modules passed unittests

..\dmd\generated\windows\release\64\dmd -conf= -c -o- -Isrc 
-Iimport -Hfimport\core\sync\exception.di 
src\core\sync\exception.d
34 modules passed unittests

..\dmd\generated\windows\release\64\dmd -conf= -c -o- -Isrc 
-Iimport -Hfimport\core\sync\mutex.di src\core\sync\mutex.d
34 modules passed unittests

..\dmd\generated\windows\release\64\dmd -conf= -c -o- -Isrc 
-Iimport -Hfimport\core\sync\rwmutex.di src\core\sync\rwmutex.d
34 modules passed unittests

..\dmd\generated\windows\release\64\dmd -conf= -c -o- -Isrc 
-Iimport -Hfimport\core\sync\semaphore.di 
src\core\sync\semaphore.d
34 modules passed unittests


"make" -f mak/WINDOWS copydir HOST_DMD="dmd" MODEL=64 
IMPDIR="import"
conf= -c -o- -Isrc -Iimport -Hfimport\core\sync\barrier.di 
src\core\sync\barrier.d
Error: 'conf=' not found

--- errorlevel 1

C:\source\D\druntime>
Jan 28 2022
next sibling parent reply forkit <forkit gmail.com> writes:
On Saturday, 29 January 2022 at 07:41:02 UTC, forkit wrote:

copydir:
	"$(MAKE)" -f mak/WINDOWS copydir HOST_DMD="$(HOST_DMD)" 
MODEL=$(MODEL) IMPDIR="$(IMPDIR)"

so it seems the line above (in file: 
C:\source\D\druntime\win64.mak )
is causing a problem, when I run:

 cd C:\source\D\druntime
 make -f win64.mak
(error is below) "make" -f mak/WINDOWS import DMD="..\dmd\generated\windows\release\64\dmd" HOST_DMD="dmd" MODEL=64 IMPDIR="import" ..\dmd\generated\windows\release\64\dmd -conf= -c -o- -Isrc -Iimport -Hfimport\core\sync\barrier.di src\core\sync\barrier.d 34 modules passed unittests ..\dmd\generated\windows\release\64\dmd -conf= -c -o- -Isrc -Iimport -Hfimport\core\sync\condition.di src\core\sync\condition.d 34 modules passed unittests ..\dmd\generated\windows\release\64\dmd -conf= -c -o- -Isrc -Iimport -Hfimport\core\sync\config.di src\core\sync\config.d 34 modules passed unittests ..\dmd\generated\windows\release\64\dmd -conf= -c -o- -Isrc -Iimport -Hfimport\core\sync\exception.di src\core\sync\exception.d 34 modules passed unittests ..\dmd\generated\windows\release\64\dmd -conf= -c -o- -Isrc -Iimport -Hfimport\core\sync\mutex.di src\core\sync\mutex.d 34 modules passed unittests ..\dmd\generated\windows\release\64\dmd -conf= -c -o- -Isrc -Iimport -Hfimport\core\sync\rwmutex.di src\core\sync\rwmutex.d 34 modules passed unittests ..\dmd\generated\windows\release\64\dmd -conf= -c -o- -Isrc -Iimport -Hfimport\core\sync\semaphore.di src\core\sync\semaphore.d 34 modules passed unittests "make" -f mak/WINDOWS copydir HOST_DMD="dmd" MODEL=64 IMPDIR="import" conf= -c -o- -Isrc -Iimport -Hfimport\core\sync\barrier.di src\core\sync\barrier.d Error: 'conf=' not found --- errorlevel 1
Jan 29 2022
parent zjh <fqbqrr 163.com> writes:
On Saturday, 29 January 2022 at 09:17:08 UTC, forkit wrote:
 On Saturday, 29 January 2022 at 07:41:02 UTC, forkit wrote:

Compiling is a hassle, especially for software with holes.. `However` it seems that `DMD` only needs to click on`dmd.sln` in`windows`, and then it's done.
Jan 29 2022
prev sibling parent reply MoonlightSentinel <moonlightsentinel disroot.org> writes:
On Saturday, 29 January 2022 at 07:41:02 UTC, forkit wrote:
 [...]
 C:\source\D\druntime>make -f win64.mak
 "make" -f mak/WINDOWS import 
 DMD="..\dmd\generated\windows\release\64\dmd" HOST_DMD="dmd" 
 MODEL=64 IMPDIR="import"
 ..\dmd\generated\windows\release\64\dmd -conf= -c -o- -Isrc 
 -Iimport -Hfimport\core\sync\barrier.di src\core\sync\barrier.d
 34 modules passed unittests
 [...]
You apparently built dmd with unittests enabled. D applications build with `-unittest` do snot execute the actual main unless explicitly requested via a Druntime option. So the targets of the make rule are never built, causing the cascading error later on for `copydir`. Not sure how you build that dmd since `make` / `build.d` explicitly use a different name for the unittest executable.
Jan 29 2022
parent reply forkit <forkit gmail.com> writes:
On Saturday, 29 January 2022 at 12:50:40 UTC, MoonlightSentinel 
wrote:
 You apparently built dmd with unittests enabled. D applications 
 build with `-unittest` do snot execute the actual main unless 
 explicitly requested via a Druntime option. So the targets of 
 the make rule are never built, causing the cascading error 
 later on for `copydir`.

 Not sure how you build that dmd since `make` / `build.d` 
 explicitly use a different name for the unittest executable.
so I just did this: c:\source\D\dmd>make -f win64.mak (output from above command is below - and yes, it seems something is defaulting to "ENABLE_UNITTEST=1) (this is the output below, from the command above) cd src make -f win64.mak dmd -g -ofvcbuild\msvc-lib.exe vcbuild\msvc-lib.d if not exist "..\generated\windows\release\64" mkdir ..\generated\windows\release\64 make -f win32.mak "OS=windows" "BUILD=release" "MODEL=64" "HOST_DMD=" "HOST_DC=dmd" "MAKE=make" "VERBOSE=" "ENABLE_RELEASE=" "ENABLE_DEBUG=" "ENABLE_ASSERTS=" "ENABLE_UNITTEST=" "ENABLE_PROFILE=" "ENABLE_COVERAGE=" "DFLAGS=" "GEN=..\generated" "G=..\generated\windows\release\64" "LIB=vcbuild\msvc-lib" defaulttarget if not exist "..\generated\windows\release\64" mkdir ..\generated\windows\release\64 make -fwin32.mak MAKE="make" HOST_DC="dmd" MODEL=64 CC="" VERBOSE= "ENABLE_DEBUG=1" "ENABLE_UNITTEST=1" ..\generated\windows\release\64\dmd.exe echo "===== DEPRECATION NOTICE =====" "===== DEPRECATION NOTICE =====" echo "===== DEPRECATION: win32.mak is deprecated. Please use src\build.d instead." "===== DEPRECATION: win32.mak is deprecated. Please use src\build.d instead." echo "==============================" "==============================" dmd -m64 -of..\generated\build.exe -g build.d ..\generated\build.exe --called-from-make "OS=windows" "BUILD=release" "MODEL=64" "HOST_DMD=" "HOST_DC=dmd" "MAKE=make" "VERBOSE=" "ENABLE_RELEASE=" "ENABLE_DEBUG=1" "ENABLE_ASSERTS=" "ENABLE_UNITTEST=1" "ENABLE_PROFILE=" "ENABLE_COVERAGE=" "DFLAGS=" ..\generated\windows\release\64\dmd.exe (TX) VERSION (TX) SYSCONFDIR (DC) COMMON (DC) LEXER (DC) BACKEND (DC) DMD Success copy ..\generated\windows\release\64\dmd.exe . 1 file(s) copied.
Jan 29 2022
parent reply MoonlightSentinel <moonlightsentinel disroot.org> writes:
On Sunday, 30 January 2022 at 00:16:41 UTC, forkit wrote:
 so I just did this:
Thanks, seems like the makefiles got hit by the switch to the new default for executables with unittests (run test and exit instead of `main()`). I've raised a PR to fix this issue: https://github.com/dlang/dmd/pull/13585. You can simply skip the deprecated makefiles and run `rdmd src/build.d`.
Jan 29 2022
next sibling parent forkit <forkit gmail.com> writes:
On Sunday, 30 January 2022 at 00:37:46 UTC, MoonlightSentinel 
wrote:
 On Sunday, 30 January 2022 at 00:16:41 UTC, forkit wrote:
 so I just did this:
Thanks, seems like the makefiles got hit by the switch to the new default for executables with unittests (run test and exit instead of `main()`). I've raised a PR to fix this issue: https://github.com/dlang/dmd/pull/13585. You can simply skip the deprecated makefiles and run `rdmd src/build.d`.
Thanks for your help. It's so appreciated! I'm starting to make real progress now... (not sure why this site thought this response was spam though :-(
Jan 29 2022
prev sibling parent reply forkit <forkit gmail.com> writes:
On Sunday, 30 January 2022 at 00:37:46 UTC, MoonlightSentinel 
wrote:

there appears to be another (separate) problem with compiling the 
'tools'

in file:

c:\source\D\tools\win32.mak

it contains this line:
DFLAGS=-O -release -m$(MODEL)

but -m is not a valid option in dmd??

I changed that line to:
DFLAGS=-O -release

and I was then able to build all the tools

(excluding dman which says someeting about a .json file that I 
don't understand - but I don't know what dman.exe is anyway, so 
not too bothered :)


C:\source\D\tools>make -f win32.mak "ROOT=generated\windows\64" 
"MODEL=" generated\windows\64\dman.exe
'Build d-tags.json and copy it here, e.g. by running:'
"    make -C ../dlang.org -f win32.mak d-tags.json && copy 
../dlang.org/d-tags-latest.json d-tags.json"
dmd -O -release -ofgenerated\windows\64\dman.exe dman.d -J.
dman.d(131): Error: file `"d-tags.json"` cannot be found or not 
in a path specified with `-J`
dman.d(131):        Path(s) searched (as provided by `-J`):
dman.d(131):        [0]: `.`

--- errorlevel 1
Jan 29 2022
parent reply frame <frame86 live.com> writes:
On Sunday, 30 January 2022 at 04:33:32 UTC, forkit wrote:

 in file:

 c:\source\D\tools\win32.mak

 it contains this line:
 DFLAGS=-O -release -m$(MODEL)

 but -m is not a valid option in dmd??
Do you realize that it isn't just `-m` but `-mXXXX` because `${MODEL}` stands for a variable which should be set? ;)
 C:\source\D\tools>make -f win32.mak "ROOT=generated\windows\64" 
 "MODEL=" generated\windows\64\dman.exe
If you ignore this and mix up 32 and 64bit / MS-COFF you have not to wonder why something will not work as expected.
Jan 30 2022
parent reply forkit <forkit gmail.com> writes:
On Sunday, 30 January 2022 at 10:03:28 UTC, frame wrote:
 If you ignore this and mix up 32 and 64bit / MS-COFF you have 
 not to wonder why something will not work as expected.
yeah, I knew what, but since -m doesn't work, you gotta remove it. The tools built ok, and all 64bit. (except for the dman.exe tool, which I've never heard of and have no idea what it does, and it's isn't in the D distribution anyway. What I can say, after a lot of mucking around, and a little help, is that building from source on Windows is as easy as it is on linux. just git and make. that's it. providing all the prerequistes programs/settings are in place of course ;-) - an exisiting installation of windows - an exisiting installation of visual studio build tools - an exisiting installation of dmd - an exisiting installation of dmc (which has the 'make' that you'll need) - set the correct settings for VCDIR, SDKDIR, and BINDIR in the win64.mak files for druntime and phobos (didn't need it for dmd or the tools) to match your version of VS. then run 'make -f win64.mak' in each of the folders for dmd, druntime, phobos, tools... and you're done. That's really all there is too it.
Jan 30 2022
next sibling parent reply "H. S. Teoh" <hsteoh quickfur.ath.cx> writes:
On Sun, Jan 30, 2022 at 08:20:06PM +0000, forkit via Digitalmars-d wrote:
[...]
 What I can say, after a lot of mucking around, and a little help, is
 that building from source on Windows is as easy as it is on linux.
 
 just git and make. that's it.
 
 providing all the prerequistes programs/settings are in place of course ;-)
 
 - an exisiting installation of windows
 - an exisiting installation of visual studio build tools
 - an exisiting installation of dmd
 - an exisiting installation of dmc (which has the 'make' that you'll need)
 - set the correct settings for VCDIR, SDKDIR, and BINDIR in the win64.mak
 files for druntime and phobos (didn't need it for dmd or the tools) to match
 your version of VS.
 
 then run 'make -f win64.mak' in each of the folders for dmd, druntime,
 phobos, tools... and you're done.
 
 That's really all there is too it.
This should be incorporated into the wiki page so that the next person that comes along can benefit from it. T -- Freedom of speech: the whole world has no right *not* to hear my spouting off!
Jan 30 2022
parent reply forkit <forkit gmail.com> writes:
On Sunday, 30 January 2022 at 20:33:58 UTC, H. S. Teoh wrote:
 This should be incorporated into the wiki page so that the next 
 person that comes along can benefit from it.


 T
I'm still working on gaining a fuller understanding of all this. Also, I don't just want to know 'what', but also 'why'. The 'what' on it's own, just gives you a very limited understanding, which is problematic when things go wrong. The problem with existing wiki (well, one of it's problem) is it lacks a good explanation of precisely why you need what. The most complex part at the moment, is working out 'precisely' what VS components you need, and why. https://docs.microsoft.com/en-us/visualstudio/install/workload-component-id-vs-community?view=vs-2022&preserve-view=true#desktop-development-with-c Ideally, the whole thing (installing VS/DMD/DMC/GIT/) could be open scripted as well. I don't like the process being hidden behind some executable thing, like dub digger dogger... ....
Jan 30 2022
parent "H. S. Teoh" <hsteoh quickfur.ath.cx> writes:
On Sun, Jan 30, 2022 at 10:20:38PM +0000, forkit via Digitalmars-d wrote:
 On Sunday, 30 January 2022 at 20:33:58 UTC, H. S. Teoh wrote:
 
 This should be incorporated into the wiki page so that the next
 person that comes along can benefit from it.
[...]
 I'm still working on gaining a fuller understanding of all this.
 
 Also, I don't just want to know 'what', but also 'why'.
[...] Excellent. When you find out the 'why's, please update the wiki page to explain it all. T -- Being able to learn is a great learning; being able to unlearn is a greater learning.
Jan 31 2022
prev sibling parent reply pilger <abcd dcba.com> writes:
On Sunday, 30 January 2022 at 20:20:06 UTC, forkit wrote:
 - an exisiting installation of dmc (which has the 'make' that 
 you'll need)
 - set the correct settings for VCDIR, SDKDIR, and BINDIR in the 
 win64.mak files for druntime and phobos (didn't need it for dmd 
 or the tools) to match your version of VS.

 then run 'make -f win64.mak' in each of the folders for dmd, 
 druntime, phobos, tools... and you're done.
there is also "/src/build.d" which you can use instead.
Jan 30 2022
parent forkit <forkit gmail.com> writes:
On Sunday, 30 January 2022 at 23:34:04 UTC, pilger wrote:
 there is also "/src/build.d" which you can use instead.
yeah, but that's only for dmd (and you have to use that currently, due to a problem in the .mak file - see: https://forum.dlang.org/post/winmkmwpjkicdjgtourj forum.dlang.org But for druntime, phobos and tools, the only option is the 'make -f win64.mak'. I don't know why the dmd build has this 'option' of using /src/build.d Ideally, it should just be one command to use for each component.
Jan 30 2022
prev sibling parent forkit <forkit gmail.com> writes:
On Friday, 28 January 2022 at 22:55:17 UTC, MoonlightSentinel 
wrote:
 Software:
 - Any VS version (already used 17 and 22 but others should work 
 as well)
 - DM make

 Setup for Druntime / Phobos*:
 - Change the VS-related variables in `win64.mak` based on your 
 specific VS installation (because they change with each version)
   * `VCDIR`
   * `SDKDIR`
   * `BINDIR`

 Building should then be as simple as running `make -f 
 win64.mak` in each directory (for dmd it simply forwards to 
 `src/build.d`).

 ---

 Currently using VS 2022 which required the following changes:
So I've come up with the following code that will extract those values for me ;-) // ---- module test; import std.stdio : writeln; import std.process : environment; /+ When building from source on Windows, both "druntime\win64.mak" and "phobos\win64.mak" require two variables (VCDIR and SDKDIR) to be set according to the version of Visual Studio you are using. This code below will provide you with the values for those two variables. However, for this code to get those variables, you need to run this within a VS Developer Command Prompt not a normal Command Prompt. +/ int main() { auto VCDIR = environment.get("VCToolsInstallDir"); if (VCDIR is null) { return 1;} writeln("VCDIR=", VCDIR[0..$-1]); // also removes the trailing backslash auto SDKVersion = environment.get("WindowsSDKVersion"); if (SDKVersion is null) { return 1;} auto SDKDIR = environment.get("WindowsSdkDir"); if (SDKDIR is null) { return 1;} writeln("SDKDIR=", SDKDIR ~ "Include\\" ~ SDKVersion[0..$-1]); // also removes the trailing backslash return 0; } // -----
Jan 30 2022
prev sibling next sibling parent 12345swordy <alexanderheistermann gmail.com> writes:
On Friday, 28 January 2022 at 21:39:39 UTC, forkit wrote:
 No matter what instructions, blogs, articles... I use.. I 
 simply cannot manage to build druntime,dmd,phobos, from source 
 on Windows.

 Of course, building from source in linux is a breeze.

 But I cannot test my changes on Windows, cause I cannot build 
 from source on Windows!

 Does anyone have a step-by-step process, that is 'guaranteed' 
 to work? (with as few unnecessary dependencies as possible 
 please).

 I'm happy to build a dedicated build machine for this purpose, 
 with just the software needed to build from source.

 NOTE: I said 'guaranteed' to work ;-)  ... I've wasted to much 
 time following instructions that just do not work.
Hi, I used this for building on windows, it works wonders for me. https://github.com/rainers/dlangvs - Alex
Jan 28 2022
prev sibling parent Andre Pany <andre s-e-a-p.de> writes:
On Friday, 28 January 2022 at 21:39:39 UTC, forkit wrote:
 No matter what instructions, blogs, articles... I use.. I 
 simply cannot manage to build druntime,dmd,phobos, from source 
 on Windows.

 Of course, building from source in linux is a breeze.

 But I cannot test my changes on Windows, cause I cannot build 
 from source on Windows!

 Does anyone have a step-by-step process, that is 'guaranteed' 
 to work? (with as few unnecessary dependencies as possible 
 please).

 I'm happy to build a dedicated build machine for this purpose, 
 with just the software needed to build from source.

 NOTE: I said 'guaranteed' to work ;-)  ... I've wasted to much 
 time following instructions that just do not work.
Not an expert here, I just wonder. As DMD now supports cross compilation,the easiest solution would be to provide a Docker Image which compiles your local source files. Therefore you need only the DMD sources and Docker on your windows OS, nothing more. Kind regards Andre
Jan 29 2022