D Tutorial / Starting With D / Compiler /
Difference (last change) (no other diffs, normal page display)
* Development with D|
This page is here to instruct you in the installation and use of the Digital Mars D compiler (DMD). There is more than one way to install programs: the simplest is the 1-click method, but there is a more detailed 'universal' method.
The download page now has 1-click installers for Win32, Ubuntu, and Linux rpm. (For example, the Windows version takes you through a wizard, downloads and installs the software, and sets the PATH.)
This older method works across all platforms with only slight differences because of how the PATH is handle across platforms.
- Download the zip file and extract it to your location of choice.
- You're done. You can now compile programs from the terminal.
Follow the Universal directions above. Then to set the path:
- On Windows 2000 and newer, use the System or My Computer Properties/Advanced tab/Environment Variables button, and add the paths to the end of the system path for allusers. Separate paths using a semicolon.
- The added path should look something like: C:/dmd/windows/bin
- (See the tech tip " Running DMD From The Command Prompt" for more information.)
- Download and unzip, like above (you can do this from any directory)
- Install the linux executables to /usr/local/bin (and make them executable too)
install -p -m 0755 dmd/linux/bin/dmd dmd/linux/bin/obj2asm dmd/linux/bin/dumpobj /usr/local/bin
- Install the manpages to /usr/local/man (under the man1 subdirectory)
install -p -m 0644 dmd/man/man1/dmd.1 dmd/man/man1/obj2asm.1 dmd/man/man1/dumpobj.1 /usr/local/man/man1
- Install the library to /usr/local/lib:
install -p -m 0644 dmd/lib/libphobos.a /usr/local/lib
- You can install all the Phobos import modules to a directory like /usr/local/src/phobos
mkdir -p /usr/local/src/phobos (cd dmd/src/phobos; find -name '*.d' | xargs tar c) | (cd /usr/local/src/phobos; tar xv)
You can also choose to use a bash script created to handle installation and updating of DMD.
- Install DMD
- Install Tango, expects DMD to have been installed with install-d
- If you have installed two of the following DMD 1.x, 2.x, or Tango with the above scripts, this allows you to choose what will be used when calling $ dmd
Since DMD is not yet 64bit after you do the installation you will need a few more packages. The packages are similar on all distributions, below are some distro specific instructions:
Also you may need the 32bit libraries to run your compiled program.
If you have gcc-multilib installed, you should remove it before starting:
You can then use:
To install cross32-gcc from AUR. See http://wiki.archlinux.org/index.php/Yaourt for how to install yaourt. You should now edit your dmd.conf and make sure it uses the 32bit gcc for linking, by adding the following in the [Environment] section:
Your dmd.conf should now look something like:
Compiling just requires calling dmd and listing your source files. As a project grows this can be troublesome so there have been many build tools created to automate this.
Linux/Mac OS X:
If it worked the result is cryptic, but pretty boring.
Output on Windows:
Output on Linux:
Output on Mac OS X: (i.e. nothing at all, nice and quiet)
- D Compilers
- Learning D as a first language
- Learning D as a second language
- Language Specification
- Development with D