Table of Contents
Installation Guide for Tango used with DMD on Windows
This page details two ways of installing Tango for DMD on Windows. The first is recommended unless you want to hack Tango itself.
For some, it may make more sense to use DSSS for installation, or use a tool like build/bud or rebuild, the alternatives are suggested at further down on the page.
Note: These installation instructions assume a default DMD installation and that the archive has been extracted into C:\, creating C:\dmd as the home of the DMD compiler. The basic goal of this process is to replace Phobos with Tango by placing the Tango object.d and root directories at the head of the DMD include path, and replacing the Phobos libphobos.a with its Tango equivalent of the same name. Note that if your first download of DMD is from the Tango pages, there will be no Phobos to replace.
Install Binary Bundle
- Download Tango, one of the .zip options will suffice
- Extract the Tango archive into a new directory named C:\dmd\import. If you chose another path, consider avoiding names that contain spaces or parenthesis as these cause problems with some windows command line tools.
- Open C:\dmd\bin\sc.ini in a text editor. The contents should look like this:
[Environment] LIB="%@P%\..\lib";\dm\lib DFLAGS="-I%@P%\..\src\phobos" LINKCMD=%@P%\..\..\dm\bin\link.exe
As all .ini files in Windows, any line beginning with a semicolon ';' will be considered a comment and will therefore be ignored by DMD. To ensure removal of Tango is as painless as possible, it is a good idea to leave the original lines in the file as comments with the edited line below.
Now, on to the editing:
3.1. Replace the reference to the Phobos include directory in the DFLAGS line with a reference to the Tango root directory. This will ensure that the Tango import modules will be used in place of those in Phobos, and replacing the reference reduces the risk of hard to diagnose compile errors. Either a relative or absolute path may be used, as appropriate:
Relative: "%@P%\..\import" Absolute: "C:\dmd\import"e.g. DFLAGS="-I%@P%\..\import"
3.2. Append "-version=Tango" to the DFLAGS line modified above. This version flag is useful for determining whether Tango is the current default library:
e.g. DFLAGS="-I%@P%\..\import" -version=Tango
3.3. Since version 1.023 DMD has a flag to set the name of the runtime library that should be linked in. (It was formerly hardcoded to "phobos.lib" and "libphobos.a") This basically means, you have to append another switch in order to make Tango the standard runtime in your sc.ini:
-defaultlib=tango-base-dmd -debuglib=tango-base-dmd Note: -debuglib is necessary, as of now DMD would fall back to Phobos when compiling with -g.
After making these changes, sc.ini should look like this:
[Environment] ; LIB="%@P%\..\lib";\dm\lib LIB="%@P%\..\import\lib;%@P%\..\lib;%@P%\..\..\dm\lib" ; DFLAGS="-I%@P%\..\src\phobos" DFLAGS="-I%@P%\..\import" -version=Tango -defaultlib=tango-base-dmd -debuglib=tango-base-dmd LINKCMD=%@P%\..\..\dm\bin\link.exe
- Please note that while tango-base-dmd.lib and tango-win32-dmd.lib will be automatically linked, tango-user-dmd.lib will not. This is to allow for configurations where tango-user-dmd.lib does not exist (such as when using Bud or Rebuild). To ensure that tango-user-dmd.lib is linked to an application, either of the following two methods should work.
- a. Add -L+tango-user-dmd.lib to the end of the DFLAGS line in sc.ini.
- b. Add the following to files being compiled.
pragma(lib, "tango-user-dmd.lib");
- c. Include tango-user-dmd.lib in the list of files to be compiled when using dmd.exe.
Manual Build and Install
- Download or check out Tango sources.
- In what follows we assume you've checked out tango into C:\dmd\import. If you chose another path, consider avoiding names that contain spaces or parenthesis as these cause problems with some windows command line tools.
- Edit C:\dmd\bin\sc.ini as in point 3 of previous section.
- Build tango-base-dmd.lib by running build-dmd.bat in the lib folder. This requires the Digital Mars C compiler and the Digital Mars make utility located in /dm/bin which must be the first 'make' executable encountered in the search path. These tools are both provided by the dmc.zip package linked off the DMD download page: http://www.digitalmars.com/d/dcompiler.html
- In the same folder, also run build-win32.bat to create the tango-win32-dmd.lib.
- In the same folder, finish building Tango by running build-tango.bat to create the tango-user-dmd.lib.
- If you have tango-base-dmd.lib already in your dmd/lib (or where your DMD looks for libraries) directory, it is recommended to back this up (or any other former runtime .lib files that might be replaced).
- Place the tango-base-dmd.lib tango-user-dmd.lib and tango-win32-dmd.lib libraries into dmd/lib for the D compiler.
- Please note that while tango-base-dmd.lib and tango-win32-dmd.lib will be automatically linked, tango-user-dmd.lib will not. This is to allow for configurations where tango-user-dmd.lib does not exist (such as when using Bud or Rebuild). To ensure that tango-user-dmd.lib is linked to an application, either of the following two methods should work.
- a. Add -L+tango-user-dmd.lib to the end of the DFLAGS line in sc.ini.
- b. Add the following to files being compiled:
pragma(lib, "tango-user-dmd.lib");
- c. Include tango-user-dmd.lib in the list of files to be compiled when using dmd.exe.
Trouble Shooting
Problems you may encounter with the DM toolchain
Using DSSS
DSSS can be used to install Tango, either just the user targeted API, or all of it. All of Tango, including the runtime, can be installed using DSSS' net install feature. Also, if you have installed the runtime, the user API can be installed for use with DSSS by doing
> dsss build > dsss install
in the Tango root directory.
Using Rebuild / Bud (build)
This is similar to using DSSS (rebuild is indeed a part of DSSS), but where you instead of installing libraries, give the build tools the path to Tango, having the objects rebuilt when needed by the built application.
User Comments












