Difference between revisions of "Installing DMD on 64-bit Windows 7 (COFF-compatible)"

From D Wiki
Jump to: navigation, search
m (fmt)
(Prepare your development folder)
 
(9 intermediate revisions by 5 users not shown)
Line 1: Line 1:
[http://forum.dlang.org/thread/mailman.2800.1355837582.5162.digitalmars-d@puremagic.com original source] by [[Author::Gor Gyolchanyan]]
+
[http://forum.dlang.org/post/mailman.2800.1355837582.5162.digitalmars-d@puremagic.com original source] by [[Author::Gor Gyolchanyan]]
  
 
Good day, fellow D developers.
 
Good day, fellow D developers.
Line 19: Line 19:
 
And here's how this could be arranged:
 
And here's how this could be arranged:
  
# Prepare your development folder.
+
== Prepare your development folder ==
## Create a folder with no spaces in its full path.
+
 
## Store its full path in the '%DEV_DIR_ROOT%' environment variable.
+
# Create a folder with no spaces in its full path.
# Get the Windows SDK.
+
# Store its full path in the <code>%DEV_DIR_ROOT%</code> environment variable.
## Download the Windows SDK.
+
 
### Navigate to http://msdn.microsoft.com/en-US/windows//bb980924.aspx in a web browser.
+
== Get the Windows SDK.==
### Under section 2 (number '2' in a green circle) click on the bold blue 'Install Now' link.
+
=== Download the Windows SDK ===
### In the opened window click in the blue 'Download' button at the bottom of the page.
+
# Navigate to [http://msdn.microsoft.com/en-US/windows//bb980924.aspx Microsoft Windows SDK for Windows 7] in a web browser.
### Make sure, that the Windows SDK installer ('winsdk_web.exe') is downloaded.
+
# In the opened window click '''''Download''''' button.
## Install the downloaded Windows SDK.
+
# Make sure, that the Windows SDK installer ('''winsdk_web.exe''') is downloaded.
### Navigate to the folder, where the Windows SDK installer was downloaded in a file browser.
+
 
### Double-click on the installer and agree to security warnings to launch it.
+
=== Install the downloaded Windows SDK ===
### Click next, read and agree to the license until you reach the 'Install Locations' screen.
+
# Navigate to the folder, where the Windows SDK installer was downloaded in a file browser.
### 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 >'.
+
# Double-click on the installer and agree to security warnings to launch it.
### On the 'Installation Options' uncheck everything except 'x64 Libraries' and 'Visual C++ Compilers' and click 'Next >'.
+
# Click next, read and agree to the license until you reach the 'Install Locations' screen.
### Confirm that everything is correct and click 'Next >' to start installing.
+
# Store the path under ''Destination Folder for Tools'' in the <code>%DEV_DIR_WINSDK%</code> (e.g. ''C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A'') and click ''Next >''.
### Make sure, tata the installation is completed succesfully.
+
# On the ''Installation Options'' uncheck everything except ''x64 Libraries'' and ''Visual C++ Compilers'' and click ''Next >''.
### 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').
+
# Confirm that everything is correct and click ''Next >'' to start installing.
# Get the DMD.
+
# Make sure, that the installation is completed succesfully.
## Navigate to http://ftp.digitalmars.com/dmd2beta.zip in a web browser.
+
# Store the path to the installed Visual Studio C++ compiler into the <code>%DEV_DIR_MSVC%</code> environment variable (e.g. ''C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC'').
## Make sure, that the DMD compiler archive ('dmd2beta.zip') is downloaded.
+
 
## 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'.
+
== Get the DMD ==
## Adapt the compiler configuration to the development environment.
+
# Navigate to [http://ftp.digitalmars.com/dmd2beta.zip dmd2beta] in a web browser.
### Open the file '%DEV_DIR_ROOT%\Tools\dmd2\windows\bin\sc.ini' in a text editor.
+
# Make sure, that the DMD compiler archive (''dmd2beta.zip'') is downloaded.
### Replace the line with 'LIB=' with the line 'LIB="%DEV_DIR_WINSDK%\Lib\x64";"%DEV_DIR_MSVC%\lib\amd64";"%@P%\..\lib"'.
+
# Unzip the archive into <code>%DEV_DIR_ROOT%\Tools</code>, so that the 'dmd2' folder in the archive will end up in '%DEV_DIR_ROOT%\Tools\dmd2'.
### Add '-m64 -L/NOLOGO' to  the 'DFLAGS' variable.
+
 
### Remove the lines with 'VCINSTALLDIR=' and 'WindowsSdkDir='.
+
== Adapt the compiler configuration to the development environment ==
### 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.
+
# Open the file <code>%DEV_DIR_ROOT%\Tools\dmd2\windows\bin\sc.ini</code> in a text editor.
 +
# Replace the line <pre>LIB=</pre> with the line <pre>LIB="%DEV_DIR_WINSDK%\Lib\x64";"%DEV_DIR_MSVC%\lib\amd64";"%@P%\..\lib"</pre>
 +
# Add '''-m64''' to  the 'DFLAGS' variable.
 +
# Remove the lines <pre>VCINSTALLDIR=</pre> and <pre>WindowsSdkDir=</pre>
 +
# Replace the line <pre>LINKCMD64=</pre> with the line <pre>LINKCMD64="%DEV_DIR_MSVC%\bin\amd64\link.exe"</pre>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
 
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
 
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.
 
here and I'd love to have this HOWTO at that time.
 +
 +
---
 +
 +
Keywords added to make article searchable: Win64, Win-64, Win 64, 64bit guide
 +
 +
[[Category:Windows]]
 +
[[Category:HowTo]]

Latest revision as of 08:38, 13 November 2014

original source by Gor Gyolchanyan

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:

Prepare your development folder

  1. Create a folder with no spaces in its full path.
  2. Store its full path in the %DEV_DIR_ROOT% environment variable.

Get the Windows SDK.

Download the Windows SDK

  1. Navigate to Microsoft Windows SDK for Windows 7 in a web browser.
  2. In the opened window click Download button.
  3. Make sure, that the Windows SDK installer (winsdk_web.exe) is downloaded.

Install the downloaded Windows SDK

  1. Navigate to the folder, where the Windows SDK installer was downloaded in a file browser.
  2. Double-click on the installer and agree to security warnings to launch it.
  3. Click next, read and agree to the license until you reach the 'Install Locations' screen.
  4. Store the path under Destination Folder for Tools in the %DEV_DIR_WINSDK% (e.g. C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A) and click Next >.
  5. On the Installation Options uncheck everything except x64 Libraries and Visual C++ Compilers and click Next >.
  6. Confirm that everything is correct and click Next > to start installing.
  7. Make sure, that the installation is completed succesfully.
  8. 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).

Get the DMD

  1. Navigate to dmd2beta in a web browser.
  2. Make sure, that the DMD compiler archive (dmd2beta.zip) is downloaded.
  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'.

Adapt the compiler configuration to the development environment

  1. Open the file %DEV_DIR_ROOT%\Tools\dmd2\windows\bin\sc.ini in a text editor.
  2. Replace the line
    LIB=
    with the line
    LIB="%DEV_DIR_WINSDK%\Lib\x64";"%DEV_DIR_MSVC%\lib\amd64";"%@P%\..\lib"
  3. Add -m64 to the 'DFLAGS' variable.
  4. Remove the lines
    VCINSTALLDIR=
    and
    WindowsSdkDir=
  5. Replace the line
    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.

---

Keywords added to make article searchable: Win64, Win-64, Win 64, 64bit guide