www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - DMD under 64-bit Windows 7 HOWTO

reply Gor Gyolchanyan <gor.f.gyolchanyan gmail.com> writes:
--90e6ba308b86a7883f04d12088bf
Content-Type: text/plain; charset=UTF-8

Good day, fellow D developers.
After spending much time figuring out how to make DMD work fluently under
64-bit Windows 7 I've realized that this is not a trivial task and lots of
people might have trouble with this, so I've decided to post my solution,
that might save people a lot of time.
As we know, there are compatibility problems with 32-bit DMD binaries,
because they are compiled using DMC back-end, which can only produce OMF
binaries, so in order to avoid problems with linking against externally
compiled libraries, it's much easier to stick to 64-bit binaries, so that
DMD will use the Visual Studio linker to produce compatible COFF binaries.
Another problem is that 32-bit DMD binaries are linked against obsolete
32-bit WinAPI libraries, which lack some very important functions, while
the 64-bit binaries are required to link with the 64-bit libraries,
supplied by the the Windows SDK.

And here's how this could be arranged:

1. Prepare your development folder.
1.1. Create a folder with no spaces in its full path.
1.2. Store its full path in the '%DEV_DIR_ROOT%' environment variable.
2. Get the Windows SDK.
2.1. Download the Windows SDK.
2.1.1. Navigate to 'http://msdn.microsoft.com/en-US/windows//bb980924.aspx'
in a web browser.
2.1.2. Under section 2 (number '2' in a green circle) click on the bold
blue 'Install Now' link.
2.1.3. In the opened window click in the blue 'Download' button at the
bottom of the page.
2.1.4. Make sure, that the Windows SDK installer ('winsdk_web.exe') is
downloaded.
2.2. Install the downloaded Windows SDK.
2.2.1. Navigate to the folder, where the Windows SDK installer was
downloaded in a file browser.
2.2.2. Double-click on the installer and agree to security warnings to
launch it.
2.2.3. Click next, read and agree to the license until you reach the
'Install Locations' screen.
2.2.4. Store the path under 'Destination Folder for Tools' in the
'%DEV_DIR_MSWINSDK%' (e.g. 'C:\Program Files (x86)\Microsoft
SDKs\Windows\v7.0A') and click 'Next >'.
2.3.3. On the 'Installation Options' uncheck everything except 'x64
Libraries' and 'Visual C++ Compilers' and click 'Next >'.
2.3.4. Confirm that everything is correct and click 'Next >' to start
installing.
2.3.5. Make sure, tata the installation is completed succesfully.
2.3.6. Store the path to the installed Visual Studio C++ compiler into the
'%DEV_DIR_MSVC%' environment variable (e.g. 'C:\Program Files
(x86)\Microsoft Visual Studio 10.0\VC').
3. Get the DMD.
3.1. Navigate to 'http://ftp.digitalmars.com/dmd2beta.zip' in a web browser.
3.2. Make sure, that the DMD compiler archive ('dmd2beta.zip') is
downloaded.
3.3. Unzip the archive into '%DEV_DIR_ROOT%\Tools', so that the 'dmd2'
folder in the archive will end up in '%DEV_DIR_ROOT%\Tools\dmd2'.
3.4. Adapt the compiler configuration to the development environment.
3.4.1. Open the file '%DEV_DIR_ROOT%\Tools\dmd2\windows\bin\sc.ini' in a
text editor.
3.4.2. Replace the line with 'LIB=' with the line
'LIB="%DEV_DIR_WINSDK%\Lib\x64";"%DEV_DIR_MSVC%\lib\amd64";"% P%\..\lib"'.
3.4.3. Add '-m64 -L/NOLOGO' to  the 'DFLAGS' variable.
3.4.4. Remove the lines with 'VCINSTALLDIR=' and 'WindowsSdkDir='.
3.4.5. Replace the like with 'LINKCMD64=' with the line
'LINKCMD64="%DEV_DIR_MSVC%\bin\amd64\link.exe"'
Now "%DEV_DIR_ROOT%\Tools\dmd2\windows\bin\dmd.exe" will always use the
Windows SDK libraries and Visual C++ compiler to produce 64-bit COFF
binaries.

I hope I was helpful, because when I started to set up a development
environment under 64-bit Windows 7, I went through a lot of problems to get
here and I'd love to have this HOWTO at that time.

-- 
Bye,
Gor Gyolchanyan.

--90e6ba308b86a7883f04d12088bf
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

Good day, fellow D developers.<div>After spending much time figuring out ho=
w to make DMD work=C2=A0fluently=C2=A0under 64-bit Windows 7 I&#39;ve reali=
zed that this is not a trivial task and lots of people might have trouble w=
ith this, so I&#39;ve decided to post my solution, that might save people a=
 lot of time.</div>
<div>As we know, there are compatibility problems with 32-bit DMD binaries,=
 because they are compiled using DMC back-end, which can only produce OMF b=
inaries, so in order to avoid problems with linking against externally comp=
iled libraries, it&#39;s much easier to stick to 64-bit binaries, so that D=
MD will use the Visual Studio linker to produce compatible COFF binaries. A=
nother problem is that 32-bit DMD binaries are linked against obsolete 32-b=
it WinAPI libraries, which lack some very important functions, while the 64=
-bit binaries are required to link with the 64-bit libraries, supplied by t=
he the Windows SDK.</div>
<div><br></div><div>And here&#39;s how this could be arranged:</div><div><b=
r></div><div><div>1. Prepare your development folder.</div><div><span class=
=3D"" style=3D"white-space:pre">	</span>1.1. Create a folder with no spaces=
 in its full path.</div>
<div><span class=3D"" style=3D"white-space:pre">	</span>1.2. Store its full=
 path in the &#39;%DEV_DIR_ROOT%&#39; environment variable.</div><div>2. Ge=
t the Windows SDK.</div><div><span class=3D"" style=3D"white-space:pre">	</=
span>2.1. Download the Windows SDK.</div>
<div><span class=3D"" style=3D"white-space:pre">		</span>2.1.1. Navigate to=
 &#39;<a href=3D"http://msdn.microsoft.com/en-US/windows//bb980924.aspx">ht=
tp://msdn.microsoft.com/en-US/windows//bb980924.aspx</a>&#39; in a web brow=
ser.</div>
<div><span class=3D"" style=3D"white-space:pre">		</span>2.1.2. Under secti=
on 2 (number &#39;2&#39; in a green circle) click on the bold blue &#39;Ins=
tall Now&#39; link.</div><div><span class=3D"" style=3D"white-space:pre">		=
</span>2.1.3. In the opened window click in the blue &#39;Download&#39; but=
ton at the bottom of the page.</div>
<div><span class=3D"" style=3D"white-space:pre">		</span>2.1.4. Make sure, =
that the Windows SDK installer (&#39;winsdk_web.exe&#39;) is downloaded.</d=
iv><div><span class=3D"" style=3D"white-space:pre">	</span>2.2. Install the=
 downloaded Windows SDK.</div>
<div><span class=3D"" style=3D"white-space:pre">		</span>2.2.1. Navigate to=
 the folder, where the Windows SDK installer was downloaded in a file brows=
er.</div><div><span class=3D"" style=3D"white-space:pre">		</span>2.2.2. Do=
uble-click on the installer and agree to security warnings to launch it.</d=
iv>
<div><span class=3D"" style=3D"white-space:pre">		</span>2.2.3. Click next,=
 read and agree to the license until you reach the &#39;Install Locations&#=
39; screen.</div><div><span class=3D"" style=3D"white-space:pre">		</span>2=
.2.4. Store the path under &#39;Destination Folder for Tools&#39; in the &#=
39;%DEV_DIR_MSWINSDK%&#39; (e.g. &#39;C:\Program Files (x86)\Microsoft SDKs=
\Windows\v7.0A&#39;) and click &#39;Next &gt;&#39;.</div>
<div><span class=3D"" style=3D"white-space:pre">		</span>2.3.3. On the &#39=
;Installation Options&#39; uncheck everything except &#39;x64 Libraries&#39=
; and &#39;Visual C++ Compilers&#39; and click &#39;Next &gt;&#39;.</div><d=
iv>
<span class=3D"" style=3D"white-space:pre">		</span>2.3.4. Confirm that eve=
rything is correct and click &#39;Next &gt;&#39; to start installing.</div>=
<div><span class=3D"" style=3D"white-space:pre">		</span>2.3.5. Make sure, =
tata the installation is completed succesfully.</div>
<div><span class=3D"" style=3D"white-space:pre">		</span>2.3.6. Store the p=
ath to the installed Visual Studio C++ compiler into the &#39;%DEV_DIR_MSVC=
%&#39; environment variable (e.g. &#39;C:\Program Files (x86)\Microsoft Vis=
ual Studio 10.0\VC&#39;).</div>
<div>3. Get the DMD.</div><div><span class=3D"" style=3D"white-space:pre">	=
</span>3.1. Navigate to &#39;<a href=3D"http://ftp.digitalmars.com/dmd2beta=
.zip">http://ftp.digitalmars.com/dmd2beta.zip</a>&#39; in a web browser.</d=
iv>
<div><span class=3D"" style=3D"white-space:pre">	</span>3.2. Make sure, tha=
t the DMD compiler archive (&#39;dmd2beta.zip&#39;) is downloaded.</div><di=
v><span class=3D"" style=3D"white-space:pre">	</span>3.3. Unzip the archive=
 into &#39;%DEV_DIR_ROOT%\Tools&#39;, so that the &#39;dmd2&#39; folder in =
the archive will end up in &#39;%DEV_DIR_ROOT%\Tools\dmd2&#39;.</div>
<div><span class=3D"" style=3D"white-space:pre">	</span>3.4. Adapt the comp=
iler configuration to the development environment.</div><div><span class=3D=
"" style=3D"white-space:pre">		</span>3.4.1. Open the file &#39;%DEV_DIR_RO=
OT%\Tools\dmd2\windows\bin\sc.ini&#39; in a text editor.</div>
<div><span class=3D"" style=3D"white-space:pre">		</span>3.4.2. Replace the=
 line with &#39;LIB=3D&#39; with the line &#39;LIB=3D&quot;%DEV_DIR_WINSDK%=
\Lib\x64&quot;;&quot;%DEV_DIR_MSVC%\lib\amd64&quot;;&quot;% P%\..\lib&quot;=
&#39;.</div>
<div><span class=3D"" style=3D"white-space:pre">		</span>3.4.3. Add &#39;-m=
64 -L/NOLOGO&#39; to =C2=A0the &#39;DFLAGS&#39; variable.</div><div><span c=
lass=3D"" style=3D"white-space:pre">		</span>3.4.4. Remove the lines with &=
#39;VCINSTALLDIR=3D&#39; and &#39;WindowsSdkDir=3D&#39;.</div>
<div><span class=3D"" style=3D"white-space:pre">		</span>3.4.5. Replace the=
 like with &#39;LINKCMD64=3D&#39; with the line &#39;LINKCMD64=3D&quot;%DEV=
_DIR_MSVC%\bin\amd64\link.exe&quot;&#39;</div><div><span class=3D"" style=
=3D"white-space:pre">		</span></div>
<div>Now &quot;%DEV_DIR_ROOT%\Tools\dmd2\windows\bin\dmd.exe&quot; will alw=
ays use the Windows SDK libraries and Visual C++ compiler to produce 64-bit=
 COFF binaries.</div><div><br></div><div>I hope I was helpful, because when=
 I started to set up a development environment under 64-bit Windows 7, I we=
nt through a lot of problems to get here and I&#39;d love to have this HOWT=
O at that time.</div>
<div><br></div>-- <br>Bye,<br>Gor Gyolchanyan.<br>
</div>

--90e6ba308b86a7883f04d12088bf--
Dec 18 2012
next sibling parent Walter Bright <newshound2 digitalmars.com> writes:
On 12/18/2012 5:32 AM, Gor Gyolchanyan wrote:
 Good day, fellow D developers.
 After spending much time figuring out how to make DMD work fluently under
64-bit
 Windows 7 I've realized that this is not a trivial task and lots of people
might
 have trouble with this, so I've decided to post my solution, that might save
 people a lot of time.

This belongs in the D wiki.
Dec 18 2012
prev sibling next sibling parent "Mariusz =?UTF-8?B?R2xpd2nFhHNraSI=?= <alienballance gmail.com> writes:
On Tuesday, 18 December 2012 at 14:47:55 UTC, Walter Bright wrote:
 On 12/18/2012 5:32 AM, Gor Gyolchanyan wrote:
 Good day, fellow D developers.
 After spending much time figuring out how to make DMD work 
 fluently under 64-bit
 Windows 7 I've realized that this is not a trivial task and 
 lots of people might
 have trouble with this, so I've decided to post my solution, 
 that might save
 people a lot of time.


:)
 This belongs in the D wiki.

Dec 18 2012
prev sibling next sibling parent Gor Gyolchanyan <gor.f.gyolchanyan gmail.com> writes:
--f46d0401240b3bcec604d12d58bb
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

On Wed, Dec 19, 2012 at 2:04 AM, <"Mariusz Gliwi=C5=84ski\"
<alienballance gmail.com>" puremagic.com> wrote:

 On Tuesday, 18 December 2012 at 14:47:55 UTC, Walter Bright wrote:

 On 12/18/2012 5:32 AM, Gor Gyolchanyan wrote:

 Good day, fellow D developers.
 After spending much time figuring out how to make DMD work fluently
 under 64-bit
 Windows 7 I've realized that this is not a trivial task and lots of
 people might
 have trouble with this, so I've decided to post my solution, that might
 save
 people a lot of time.


This belongs in the D wiki.

Windows_7_(COFF-compatible)<http://wiki.dlang.org/Installing_DMD_on_64-bi=


Glad to be of help. :-) --=20 Bye, Gor Gyolchanyan. --f46d0401240b3bcec604d12d58bb Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On Wed, Dec 19, 2012 at 2:04 AM, <span dir=3D"ltr">&lt;<a href=3D"mailto:&= quot;Mariusz Gliwi=C5=84ski\&quot; &lt;alienballance gmail.com&gt;&quot; pu= remagic.com" target=3D"_blank">&quot;Mariusz Gliwi=C5=84ski\&quot; &lt;alie= nballance gmail.com&gt;&quot; puremagic.com</a>&gt;</span> wrote:<br> <div class=3D"gmail_extra"><div class=3D"gmail_quote"><blockquote class=3D"= gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-= left:1ex"><div class=3D"HOEnZb"><div class=3D"h5">On Tuesday, 18 December 2= 012 at 14:47:55 UTC, Walter Bright wrote:<br> <blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1p= x #ccc solid;padding-left:1ex"> On 12/18/2012 5:32 AM, Gor Gyolchanyan wrote:<br> <blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1p= x #ccc solid;padding-left:1ex"> Good day, fellow D developers.<br> After spending much time figuring out how to make DMD work fluently under 6= 4-bit<br> Windows 7 I&#39;ve realized that this is not a trivial task and lots of peo= ple might<br> have trouble with this, so I&#39;ve decided to post my solution, that might= save<br> people a lot of time.<br> </blockquote></blockquote></div></div> Thanks for this one. Looks like i&#39;ll be trying my code on Windows :)<di= v class=3D"im"><br> <br> <br> <blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1p= x #ccc solid;padding-left:1ex"> This belongs in the D wiki.<br> </blockquote> </div><a href=3D"http://wiki.dlang.org/Installing_DMD_on_64-bit_Windows_7_(= COFF-compatible)" target=3D"_blank">http://wiki.dlang.org/<u></u>Installing= _DMD_on_64-bit_<u></u>Windows_7_(COFF-compatible)</a><br> </blockquote></div><br>Glad to be of help. :-)<br clear=3D"all"><div><br></= div>-- <br>Bye,<br>Gor Gyolchanyan.<br> </div> --f46d0401240b3bcec604d12d58bb--
Dec 18 2012
prev sibling next sibling parent Rainer Schuetze <r.sagitario gmx.de> writes:
On 18.12.2012 14:32, Gor Gyolchanyan wrote:
 Good day, fellow D developers.
 After spending much time figuring out how to make DMD
 work fluently under 64-bit Windows 7 I've realized that this is not a
 trivial task and lots of people might have trouble with this, so I've
 decided to post my solution, that might save people a lot of time.
 As we know, there are compatibility problems with 32-bit DMD binaries,
 because they are compiled using DMC back-end, which can only produce OMF
 binaries, so in order to avoid problems with linking against externally
 compiled libraries, it's much easier to stick to 64-bit binaries, so
 that DMD will use the Visual Studio linker to produce compatible COFF
 binaries. Another problem is that 32-bit DMD binaries are linked against
 obsolete 32-bit WinAPI libraries, which lack some very important
 functions, while the 64-bit binaries are required to link with the
 64-bit libraries, supplied by the the Windows SDK.

 And here's how this could be arranged:

 1. Prepare your development folder.
 1.1. Create a folder with no spaces in its full path.
 1.2. Store its full path in the '%DEV_DIR_ROOT%' environment variable.
 2. Get the Windows SDK.
 2.1. Download the Windows SDK.
 2.1.1. Navigate to
 'http://msdn.microsoft.com/en-US/windows//bb980924.aspx' in a web browser.
 2.1.2. Under section 2 (number '2' in a green circle) click on the bold
 blue 'Install Now' link.
 2.1.3. In the opened window click in the blue 'Download' button at the
 bottom of the page.
 2.1.4. Make sure, that the Windows SDK installer ('winsdk_web.exe') is
 downloaded.
 2.2. Install the downloaded Windows SDK.
 2.2.1. Navigate to the folder, where the Windows SDK installer was
 downloaded in a file browser.
 2.2.2. Double-click on the installer and agree to security warnings to
 launch it.
 2.2.3. Click next, read and agree to the license until you reach the
 'Install Locations' screen.
 2..2.4. Store the path under 'Destination Folder for Tools' in the
 '%DEV_DIR_MSWINSDK%' (e.g. 'C:\Program Files (x86)\Microsoft
 SDKs\Windows\v7.0A') and click 'Next >'.
 2.3.3. On the 'Installation Options' uncheck everything except 'x64
 Libraries' and 'Visual C++ Compilers' and click 'Next >'.
 2.3.4. Confirm that everything is correct and click 'Next >' to start
 installing.
 2.3.5. Make sure, tata the installation is completed succesfully.
 2.3.6. Store the path to the installed Visual Studio C++ compiler into
 the '%DEV_DIR_MSVC%' environment variable (e.g. 'C:\Program Files
 (x86)\Microsoft Visual Studio 10.0\VC').
 3. Get the DMD.
 3.1. Navigate to 'http://ftp.digitalmars.com/dmd2beta.zip
 <http://ftp.digitalmars.com/dmd2beta..zip>' in a web browser.
 3.2. Make sure, that the DMD compiler archive ('dmd2beta.zip') is
 downloaded.
 3.3. Unzip the archive into '%DEV_DIR_ROOT%\Tools', so that the 'dmd2'
 folder in the archive will end up in '%DEV_DIR_ROOT%\Tools\dmd2'.
 3.4. Adapt the compiler configuration to the development environment.
 3.4.1. Open the file '%DEV_DIR_ROOT%\Tools\dmd2\windows\bin\sc.ini' in a
 text editor.
 3.4.2. Replace the line with 'LIB=' with the line
 'LIB="%DEV_DIR_WINSDK%\Lib\x64";"%DEV_DIR_MSVC%\lib\amd64";"% P%\..\lib"'.
 3.4.3. Add '-m64 -L/NOLOGO' to  the 'DFLAGS' variable.
 3.4.4. Remove the lines with 'VCINSTALLDIR=' and 'WindowsSdkDir='.
 3.4.5. Replace the like with 'LINKCMD64=' with the line
 'LINKCMD64="%DEV_DIR_MSVC%\bin\amd64\link.exe"'
 Now "%DEV_DIR_ROOT%\Tools\dmd2\windows\bin\dmd.exe" will always use the
 Windows SDK libraries and Visual C++ compiler to produce 64-bit COFF
 binaries.

 I hope I was helpful, because when I started to set up a development
 environment under 64-bit Windows 7, I went through a lot of problems to
 get here and I'd love to have this HOWTO at that time.

Thanks for doing this. A few notes: - I don't think it is the best idea to have two copies of the compiler to be able to compile for 32-bit and 64-bit targets. That's why I have suggested 2 different environment blocks in sc.ini, but the pull request has not been merged yet: https://github.com/D-Programming-Language/dmd/pull/1220 - With removing VCINSTALLDIR and WindowsSdkDir from sc.ini, you are disabling some magic in the linker invocation. I think this is good, the resulting settings should be in sc.ini. Please note that the environment variables can also be set in the shell environment already (e.g. when using the link to starting cmd.exe created by the SDK installer), setting them to blank might be a good idea. - Most people will already have some other version of the linker and the SDK installed, e.g. as part of Visual Studio or VC++ Express. I think these should be supported aswell. I recently started creating a list of common installations but got distracted somehow. - The Windows 8 SDK uses some other folder hierarchy. - When building with debug information, the linker needs to load some DLLs to generate the PDB file. I had to modify the PATH environment variable in sc.ini as well to not get an error, i.e. 'PATH=%DEV_DIR_MSVC%\bin\amd64;%PATH%'
 --
 Bye,
 Gor Gyolchanyan.

Dec 18 2012
prev sibling parent Gor Gyolchanyan <gor.f.gyolchanyan gmail.com> writes:
--047d7b342c4cad53de04d130d452
Content-Type: text/plain; charset=UTF-8

I'd love to have separate sections in sc.ini
This howto really needs some improvement.



On Wed, Dec 19, 2012 at 11:54 AM, Rainer Schuetze <r.sagitario gmx.de>wrote:

 On 18.12.2012 14:32, Gor Gyolchanyan wrote:

 Good day, fellow D developers.
 After spending much time figuring out how to make DMD
 work fluently under 64-bit Windows 7 I've realized that this is not a
 trivial task and lots of people might have trouble with this, so I've
 decided to post my solution, that might save people a lot of time.
 As we know, there are compatibility problems with 32-bit DMD binaries,
 because they are compiled using DMC back-end, which can only produce OMF
 binaries, so in order to avoid problems with linking against externally
 compiled libraries, it's much easier to stick to 64-bit binaries, so
 that DMD will use the Visual Studio linker to produce compatible COFF
 binaries. Another problem is that 32-bit DMD binaries are linked against
 obsolete 32-bit WinAPI libraries, which lack some very important
 functions, while the 64-bit binaries are required to link with the
 64-bit libraries, supplied by the the Windows SDK.

 And here's how this could be arranged:

 1. Prepare your development folder.
 1.1. Create a folder with no spaces in its full path.
 1.2. Store its full path in the '%DEV_DIR_ROOT%' environment variable.
 2. Get the Windows SDK.
 2.1. Download the Windows SDK.
 2.1.1. Navigate to
 'http://msdn.microsoft.com/en-**US/windows//bb980924.aspx<http://msdn.microsoft.com/en-US/windows//bb980924.aspx>'
 in a web browser.
 2.1.2. Under section 2 (number '2' in a green circle) click on the bold
 blue 'Install Now' link.
 2.1.3. In the opened window click in the blue 'Download' button at the
 bottom of the page.
 2.1.4. Make sure, that the Windows SDK installer ('winsdk_web.exe') is
 downloaded.
 2.2. Install the downloaded Windows SDK.
 2.2.1. Navigate to the folder, where the Windows SDK installer was
 downloaded in a file browser.
 2.2.2. Double-click on the installer and agree to security warnings to
 launch it.
 2.2.3. Click next, read and agree to the license until you reach the
 'Install Locations' screen.
 2..2.4. Store the path under 'Destination Folder for Tools' in the

 '%DEV_DIR_MSWINSDK%' (e.g. 'C:\Program Files (x86)\Microsoft
 SDKs\Windows\v7.0A') and click 'Next >'.
 2.3.3. On the 'Installation Options' uncheck everything except 'x64
 Libraries' and 'Visual C++ Compilers' and click 'Next >'.
 2.3.4. Confirm that everything is correct and click 'Next >' to start
 installing.
 2.3.5. Make sure, tata the installation is completed succesfully.
 2.3.6. Store the path to the installed Visual Studio C++ compiler into
 the '%DEV_DIR_MSVC%' environment variable (e.g. 'C:\Program Files
 (x86)\Microsoft Visual Studio 10.0\VC').
 3. Get the DMD.
 3.1. Navigate to 'http://ftp.digitalmars.com/**dmd2beta.zip<http://ftp.digitalmars.com/dmd2beta.zip>
 <http://ftp.digitalmars.com/**dmd2beta..zip<http://ftp.digitalmars.com/dmd2beta..zip>>'
 in a web browser.

 3.2. Make sure, that the DMD compiler archive ('dmd2beta.zip') is
 downloaded.
 3.3. Unzip the archive into '%DEV_DIR_ROOT%\Tools', so that the 'dmd2'
 folder in the archive will end up in '%DEV_DIR_ROOT%\Tools\dmd2'.
 3.4. Adapt the compiler configuration to the development environment.
 3.4.1. Open the file '%DEV_DIR_ROOT%\Tools\dmd2\**windows\bin\sc.ini' in
 a
 text editor.
 3.4.2. Replace the line with 'LIB=' with the line
 'LIB="%DEV_DIR_WINSDK%\Lib\**x64";"%DEV_DIR_MSVC%\lib\**
 amd64";"% P%\..\lib"'.
 3.4.3. Add '-m64 -L/NOLOGO' to  the 'DFLAGS' variable.
 3.4.4. Remove the lines with 'VCINSTALLDIR=' and 'WindowsSdkDir='.
 3.4.5. Replace the like with 'LINKCMD64=' with the line
 'LINKCMD64="%DEV_DIR_MSVC%\**bin\amd64\link.exe"'
 Now "%DEV_DIR_ROOT%\Tools\dmd2\**windows\bin\dmd.exe" will always use the
 Windows SDK libraries and Visual C++ compiler to produce 64-bit COFF
 binaries.

 I hope I was helpful, because when I started to set up a development
 environment under 64-bit Windows 7, I went through a lot of problems to
 get here and I'd love to have this HOWTO at that time.

Thanks for doing this. A few notes: - I don't think it is the best idea to have two copies of the compiler to be able to compile for 32-bit and 64-bit targets. That's why I have suggested 2 different environment blocks in sc.ini, but the pull request has not been merged yet: https://github.com/D-** Programming-Language/dmd/pull/**1220<https://github.com/D-Programming-Language/dmd/pull/1220> - With removing VCINSTALLDIR and WindowsSdkDir from sc.ini, you are disabling some magic in the linker invocation. I think this is good, the resulting settings should be in sc.ini. Please note that the environment variables can also be set in the shell environment already (e.g. when using the link to starting cmd.exe created by the SDK installer), setting them to blank might be a good idea. - Most people will already have some other version of the linker and the SDK installed, e.g. as part of Visual Studio or VC++ Express. I think these should be supported aswell. I recently started creating a list of common installations but got distracted somehow. - The Windows 8 SDK uses some other folder hierarchy. - When building with debug information, the linker needs to load some DLLs to generate the PDB file. I had to modify the PATH environment variable in sc.ini as well to not get an error, i.e. 'PATH=%DEV_DIR_MSVC%\bin\** amd64;%PATH%'
 --
 Bye,
 Gor Gyolchanyan.


-- Bye, Gor Gyolchanyan. --047d7b342c4cad53de04d130d452 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable I&#39;d love to have separate sections in sc.ini<div>This howto really need= s some improvement.</div><div><br></div><div class=3D"gmail_extra"><br><br>= <div class=3D"gmail_quote">On Wed, Dec 19, 2012 at 11:54 AM, Rainer Schuetz= e <span dir=3D"ltr">&lt;<a href=3D"mailto:r.sagitario gmx.de" target=3D"_bl= ank">r.sagitario gmx.de</a>&gt;</span> wrote:<br> <blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1p= x #ccc solid;padding-left:1ex"><div class=3D"im"><br> <br> On 18.12.2012 14:32, Gor Gyolchanyan wrote:<br> </div><blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-l= eft:1px #ccc solid;padding-left:1ex"><div class=3D"im"> Good day, fellow D developers.<br> After spending much time figuring out how to make DMD<br> work fluently under 64-bit Windows 7 I&#39;ve realized that this is not a<b= r> trivial task and lots of people might have trouble with this, so I&#39;ve<b= r> decided to post my solution, that might save people a lot of time.<br></div=
<div><div class=3D"h5">

because they are compiled using DMC back-end, which can only produce OMF<br=

compiled libraries, it&#39;s much easier to stick to 64-bit binaries, so<br=

binaries. Another problem is that 32-bit DMD binaries are linked against<br=

functions, while the 64-bit binaries are required to link with the<br> 64-bit libraries, supplied by the the Windows SDK.<br> <br> And here&#39;s how this could be arranged:<br> <br> 1. Prepare your development folder.<br> 1.1. Create a folder with no spaces in its full path.<br> 1.2. Store its full path in the &#39;%DEV_DIR_ROOT%&#39; environment variab= le.<br> 2. Get the Windows SDK.<br> 2.1. Download the Windows SDK.<br> 2.1.1. Navigate to<br> &#39;<a href=3D"http://msdn.microsoft.com/en-US/windows//bb980924.aspx" tar= get=3D"_blank">http://msdn.microsoft.com/en-<u></u>US/windows//bb980924.asp= x</a>&#39; in a web browser.<br> 2.1.2. Under section 2 (number &#39;2&#39; in a green circle) click on the = bold<br> blue &#39;Install Now&#39; link.<br> 2.1.3. In the opened window click in the blue &#39;Download&#39; button at = the<br> bottom of the page.<br> 2.1.4. Make sure, that the Windows SDK installer (&#39;winsdk_web.exe&#39;)= is<br> downloaded.<br> 2.2. Install the downloaded Windows SDK.<br> 2.2.1. Navigate to the folder, where the Windows SDK installer was<br> downloaded in a file browser.<br> 2.2.2. Double-click on the installer and agree to security warnings to<br> launch it.<br> 2.2.3. Click next, read and agree to the license until you reach the<br> &#39;Install Locations&#39; screen.<br></div></div> 2..2.4. Store the path under &#39;Destination Folder for Tools&#39; in the<= div class=3D"im"><br> &#39;%DEV_DIR_MSWINSDK%&#39; (e.g. &#39;C:\Program Files (x86)\Microsoft<br=

2.3.3. On the &#39;Installation Options&#39; uncheck everything except &#39= ;x64<br> Libraries&#39; and &#39;Visual C++ Compilers&#39; and click &#39;Next &gt;&= #39;.<br> 2.3.4. Confirm that everything is correct and click &#39;Next &gt;&#39; to = start<br> installing.<br> 2.3.5. Make sure, tata the installation is completed succesfully.<br> 2.3.6. Store the path to the installed Visual Studio C++ compiler into<br> the &#39;%DEV_DIR_MSVC%&#39; environment variable (e.g. &#39;C:\Program Fil= es<br> (x86)\Microsoft Visual Studio 10.0\VC&#39;).<br> 3. Get the DMD.<br> 3.1. Navigate to &#39;<a href=3D"http://ftp.digitalmars.com/dmd2beta.zip" t= arget=3D"_blank">http://ftp.digitalmars.com/<u></u>dmd2beta.zip</a><br></di= v> &lt;<a href=3D"http://ftp.digitalmars.com/dmd2beta..zip" target=3D"_blank">= http://ftp.digitalmars.com/<u></u>dmd2beta..zip</a>&gt;&#39; in a web brows= er.<div class=3D"im"><br> 3.2. Make sure, that the DMD compiler archive (&#39;dmd2beta.zip&#39;) is<b= r> downloaded.<br> 3.3. Unzip the archive into &#39;%DEV_DIR_ROOT%\Tools&#39;, so that the &#3= 9;dmd2&#39;<br> folder in the archive will end up in &#39;%DEV_DIR_ROOT%\Tools\dmd2&#39;.<b= r> 3.4. Adapt the compiler configuration to the development environment.<br> 3.4.1. Open the file &#39;%DEV_DIR_ROOT%\Tools\dmd2\<u></u>windows\bin\sc.i= ni&#39; in a<br> text editor.<br> 3.4.2. Replace the line with &#39;LIB=3D&#39; with the line<br> &#39;LIB=3D&quot;%DEV_DIR_WINSDK%\Lib\<u></u>x64&quot;;&quot;%DEV_DIR_MSVC%= \lib\<u></u>amd64&quot;;&quot;% P%\..\lib&quot;&#39;.<br> 3.4.3. Add &#39;-m64 -L/NOLOGO&#39; to =C2=A0the &#39;DFLAGS&#39; variable.= <br> 3.4.4. Remove the lines with &#39;VCINSTALLDIR=3D&#39; and &#39;WindowsSdkD= ir=3D&#39;.<br> 3.4.5. Replace the like with &#39;LINKCMD64=3D&#39; with the line<br> &#39;LINKCMD64=3D&quot;%DEV_DIR_MSVC%\<u></u>bin\amd64\link.exe&quot;&#39;<= br> Now &quot;%DEV_DIR_ROOT%\Tools\dmd2\<u></u>windows\bin\dmd.exe&quot; will a= lways use the<br> Windows SDK libraries and Visual C++ compiler to produce 64-bit COFF<br> binaries.<br> <br> I hope I was helpful, because when I started to set up a development<br> environment under 64-bit Windows 7, I went through a lot of problems to<br> get here and I&#39;d love to have this HOWTO at that time.<br> </div></blockquote> <br> Thanks for doing this. A few notes:<br> <br> - I don&#39;t think it is the best idea to have two copies of the compiler = to be able to compile for 32-bit and 64-bit targets. That&#39;s why I have = suggested 2 different environment blocks in sc.ini, but the pull request ha= s not been merged yet: <a href=3D"https://github.com/D-Programming-Language= /dmd/pull/1220" target=3D"_blank">https://github.com/D-<u></u>Programming-L= anguage/dmd/pull/<u></u>1220</a><br> <br> - With removing VCINSTALLDIR and WindowsSdkDir from sc.ini, you are disabli= ng some magic in the linker invocation. I think this is good, the resulting= settings should be in sc.ini. Please note that the environment variables c= an also be set in the shell environment already (e.g. when using the link t= o starting cmd.exe created by the SDK installer), setting them to blank mig= ht be a good idea.<br> <br> - Most people will already have some other version of the linker and the SD= K installed, e.g. as part of Visual Studio or VC++ Express. I think these s= hould be supported aswell. I recently started creating a list of common ins= tallations but got distracted somehow.<br> <br> - The Windows 8 SDK uses some other folder hierarchy.<br> <br> - When building with debug information, the linker needs to load some DLLs = to generate the PDB file. I had to modify the PATH environment variable in = sc.ini as well to not get an error, i.e. &#39;PATH=3D%DEV_DIR_MSVC%\bin\<u>= </u>amd64;%PATH%&#39;<span class=3D"HOEnZb"><font color=3D"#888888"><br> <br> <br> <blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1p= x #ccc solid;padding-left:1ex"> <br> --<br> Bye,<br> Gor Gyolchanyan.<br> </blockquote> </font></span></blockquote></div><br><br clear=3D"all"><div><br></div>-- <b= r>Bye,<br>Gor Gyolchanyan.<br> </div> --047d7b342c4cad53de04d130d452--
Dec 19 2012