digitalmars.D - DMD under 64-bit Windows 7 HOWTO
- Gor Gyolchanyan <gor.f.gyolchanyan gmail.com> Dec 18 2012
- Walter Bright <newshound2 digitalmars.com> Dec 18 2012
- "Mariusz =?UTF-8?B?R2xpd2nFhHNraSI=?= <alienballance gmail.com> Dec 18 2012
- Gor Gyolchanyan <gor.f.gyolchanyan gmail.com> Dec 18 2012
- Rainer Schuetze <r.sagitario gmx.de> Dec 18 2012
- Gor Gyolchanyan <gor.f.gyolchanyan gmail.com> Dec 19 2012
--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've reali= zed that this is not a trivial task and lots of people might have trouble w= ith this, so I'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'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'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 '%DEV_DIR_ROOT%' 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= '<a href=3D"http://msdn.microsoft.com/en-US/windows//bb980924.aspx">ht= tp://msdn.microsoft.com/en-US/windows//bb980924.aspx</a>' in a web brow= ser.</div> <div><span class=3D"" style=3D"white-space:pre"> </span>2.1.2. Under secti= on 2 (number '2' in a green circle) click on the bold blue 'Ins= tall Now' link.</div><div><span class=3D"" style=3D"white-space:pre"> = </span>2.1.3. In the opened window click in the blue 'Download' 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 ('winsdk_web.exe') 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 'Install Locations&#= 39; screen.</div><div><span class=3D"" style=3D"white-space:pre"> </span>2= .2.4. Store the path under 'Destination Folder for Tools' in the &#= 39;%DEV_DIR_MSWINSDK%' (e.g. 'C:\Program Files (x86)\Microsoft SDKs= \Windows\v7.0A') and click 'Next >'.</div> <div><span class=3D"" style=3D"white-space:pre"> </span>2.3.3. On the '= ;Installation Options' uncheck everything except 'x64 Libraries'= ; and 'Visual C++ Compilers' and click 'Next >'.</div><d= iv> <span class=3D"" style=3D"white-space:pre"> </span>2.3.4. Confirm that eve= rything is correct and click 'Next >' 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 '%DEV_DIR_MSVC= %' environment variable (e.g. 'C:\Program Files (x86)\Microsoft Vis= ual Studio 10.0\VC').</div> <div>3. Get the DMD.</div><div><span class=3D"" style=3D"white-space:pre"> = </span>3.1. Navigate to '<a href=3D"http://ftp.digitalmars.com/dmd2beta= .zip">http://ftp.digitalmars.com/dmd2beta.zip</a>' 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 ('dmd2beta.zip') is downloaded.</div><di= v><span class=3D"" style=3D"white-space:pre"> </span>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'.</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 '%DEV_DIR_RO= OT%\Tools\dmd2\windows\bin\sc.ini' in a text editor.</div> <div><span class=3D"" style=3D"white-space:pre"> </span>3.4.2. Replace the= line with 'LIB=3D' with the line 'LIB=3D"%DEV_DIR_WINSDK%= \Lib\x64";"%DEV_DIR_MSVC%\lib\amd64";"% P%\..\lib"= '.</div> <div><span class=3D"" style=3D"white-space:pre"> </span>3.4.3. Add '-m= 64 -L/NOLOGO' to =C2=A0the 'DFLAGS' variable.</div><div><span c= lass=3D"" style=3D"white-space:pre"> </span>3.4.4. Remove the lines with &= #39;VCINSTALLDIR=3D' and 'WindowsSdkDir=3D'.</div> <div><span class=3D"" style=3D"white-space:pre"> </span>3.4.5. Replace the= like with 'LINKCMD64=3D' with the line 'LINKCMD64=3D"%DEV= _DIR_MSVC%\bin\amd64\link.exe"'</div><div><span class=3D"" style= =3D"white-space:pre"> </span></div> <div>Now "%DEV_DIR_ROOT%\Tools\dmd2\windows\bin\dmd.exe" 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'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
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
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
--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"><<a href=3D"mailto:&= quot;Mariusz Gliwi=C5=84ski\" <alienballance gmail.com>" pu= remagic.com" target=3D"_blank">"Mariusz Gliwi=C5=84ski\" <alie= nballance gmail.com>" puremagic.com</a>></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've realized that this is not a trivial task and lots of peo= ple might<br> have trouble with this, so I'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'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
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
--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'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"><<a href=3D"mailto:r.sagitario gmx.de" target=3D"_bl= ank">r.sagitario gmx.de</a>></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've realized that this is not a<b= r> trivial task and lots of people might have trouble with this, so I'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'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'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 '%DEV_DIR_ROOT%' environment variab= le.<br> 2. Get the Windows SDK.<br> 2.1. Download the Windows SDK.<br> 2.1.1. Navigate to<br> '<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>' in a web browser.<br> 2.1.2. Under section 2 (number '2' in a green circle) click on the = bold<br> blue 'Install Now' link.<br> 2.1.3. In the opened window click in the blue 'Download' button at = the<br> bottom of the page.<br> 2.1.4. Make sure, that the Windows SDK installer ('winsdk_web.exe')= 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> 'Install Locations' screen.<br></div></div> 2..2.4. Store the path under 'Destination Folder for Tools' in the<= div class=3D"im"><br> '%DEV_DIR_MSWINSDK%' (e.g. 'C:\Program Files (x86)\Microsoft<br=
2.3.3. On the 'Installation Options' uncheck everything except '= ;x64<br> Libraries' and 'Visual C++ Compilers' and click 'Next >&= #39;.<br> 2.3.4. Confirm that everything is correct and click 'Next >' 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 '%DEV_DIR_MSVC%' environment variable (e.g. 'C:\Program Fil= es<br> (x86)\Microsoft Visual Studio 10.0\VC').<br> 3. Get the DMD.<br> 3.1. Navigate to '<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> <<a href=3D"http://ftp.digitalmars.com/dmd2beta..zip" target=3D"_blank">= http://ftp.digitalmars.com/<u></u>dmd2beta..zip</a>>' in a web brows= er.<div class=3D"im"><br> 3.2. Make sure, that the DMD compiler archive ('dmd2beta.zip') is<b= r> downloaded.<br> 3.3. Unzip the archive into '%DEV_DIR_ROOT%\Tools', so that the = 9;dmd2'<br> folder in the archive will end up in '%DEV_DIR_ROOT%\Tools\dmd2'.<b= r> 3.4. Adapt the compiler configuration to the development environment.<br> 3.4.1. Open the file '%DEV_DIR_ROOT%\Tools\dmd2\<u></u>windows\bin\sc.i= ni' in a<br> text editor.<br> 3.4.2. Replace the line with 'LIB=3D' with the line<br> 'LIB=3D"%DEV_DIR_WINSDK%\Lib\<u></u>x64";"%DEV_DIR_MSVC%= \lib\<u></u>amd64";"% P%\..\lib"'.<br> 3.4.3. Add '-m64 -L/NOLOGO' to =C2=A0the 'DFLAGS' variable.= <br> 3.4.4. Remove the lines with 'VCINSTALLDIR=3D' and 'WindowsSdkD= ir=3D'.<br> 3.4.5. Replace the like with 'LINKCMD64=3D' with the line<br> 'LINKCMD64=3D"%DEV_DIR_MSVC%\<u></u>bin\amd64\link.exe"'<= br> Now "%DEV_DIR_ROOT%\Tools\dmd2\<u></u>windows\bin\dmd.exe" 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'd love to have this HOWTO at that time.<br> </div></blockquote> <br> Thanks for doing this. A few notes:<br> <br> - 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 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. 'PATH=3D%DEV_DIR_MSVC%\bin\<u>= </u>amd64;%PATH%'<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









Walter Bright <newshound2 digitalmars.com> 