Last update March 7, 2012

D Tutorial / Starting With D / Compiler /
DMD



Difference (last change) (no other diffs, normal page display)

Changed: 132,243c132
* Development with D
jam tangan
jam tangan murah
jam tangan kw
hostgator coupon
kata mutiara
Jasa SEO
EZido
RDAnet
pioneer deh-1300mp
asus a53e-xa2
asus tf101-b1
asus tf101-a1
asus n53sv-eh72
asus republic of gamers g74sx
asus acer a5250
acer chromebook ac700
asus asus 53u
lg infinia 55lw5600
Sonicview 360 premier
asus 7 cu ft freezer
asus 30 single wall oven
brother cs6000i sewing machine
brother 1034d serger
brother sewing machines
Yokohama Geolandar H/T-S
crib tent tots in mind
kidco peapod plus
foscam fi8910w
samsung pl120 review
gopro helmet cam
Canon SX130IS
powershot s100
ContourHD 1080p
canon vixia hf r21
digital picture frame
canon ef 50mm f1.4
canon ef 70-300mm review
wide angle lenses
moving comfort sports bra
moving comfort bra
womens argyle sweater
bebe dresses
ViewSonic VX2250WM
Le Pan TC 970
Apple MacBook Air MC965LL
Sennheiser CX 880
plantronics cs540
ultrasonic jewelry cleaner
Sennheiser RS120
bose quietcomfort 15 acoustic noise cancelling headphones
logitech harmony one remote
logitech harmony 900
sony mhc-ec69i
sony mhcec909ip
bose wave music system
sony htss380
logitech squeezebox touch
sony dvp-fx970
onkyo tx-nr509
onkyo tx - nr609
onkyo ht-s3400
energy 5.1 take classic home theater system
polk audio psw505
onkyo ht-s5400
onkyo tx-nr709
belkin pf60
onkyo ht-rc360
denon avr-1912
Yamaha YHT-S400BL
fujitsu scansnap s1500
brother hl-2270dw
epson workforce 545
hp laserjet p2055dn
bushnell 8mp trophy cam
toshiba 32c110u
panasonic viera tc-p60s30
VIZIO E220VA
hauppauge wintv dcr-2650
Acer AM3970-U5022
Acer AspireRevo AR3700-U3002
Dell Inspiron i570
Dell GX620
Gateway FX6860-UR20P
Western Digital My Passport Essential SE 1 TB USB 3.0
Fujitsu ScanSnap S1300
Epson Perfection V300
Fujitsu SCANSNAP S1100
NeatDesk Desktop Scanner and Digital Filing System
Epson WorkForce Pro GT-S50
Kodak P811BK
Epson Perfection V330
Viewsonic VX2453MH
Asus VE228H
ViewSonic VA2431WM
Samsung B2230
HP 2711x
ASUS ML228H
Epson PowerLite Home Cinema 8350
Optoma PK301
Epson EX7210
Epson EX5210
ViewSonic PJD5133
Acer X1161P
FAVI RioHD-LED-2
Epson EX3210
ViewSonic PJD6531w
Trinity 360 Breville 800JEXL
Skil 3320-02
Delta 46-460
Grizzly G0555
Delta 18-900L
* 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.

Table of contents of this page
Installation   
1-Click Installers   
Universal Install   
Windows   
Linux   
System Install   
Using Bash Script   
AMD64   
Ubuntu   
Arch Linux   
Mac OS X   
Compiling Programs   
Related   

Installation    

1-Click Installers    

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.)

Universal Install    

This older method works across all platforms with only slight differences because of how the PATH is handle across platforms.

  1. Download the zip file and extract it to your location of choice.
  2. You're done. You can now compile programs from the terminal.
To improve on this situation you can just create a script that is located somewhere included in your PATH. Or set your path to include: /path/to/bin

Windows dmd.bat:

 

Linux dmd.sh:

#!/bin/bash
/lib/ld-linux.so.2 /path/to/bin/dmd $*

Windows    

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.
You will also want to make sure that you do not have Microsoft's "Link.exe" in any directory listed in your %PATH%. It will conflict with DM's "Link.exe". Otherwise you'll receive the error "OPTLINK Error: 118: Filename Expected" when you try to add symbolic debug info (e.g. "dmd -g hello.d").

Linux    

System Install    

You can use the DEB/RPM packages or follow these manual instructions.

D2.x
The base directory for D2.x is in dmd2/ not dmd/

  1. Download and unzip, like above (you can do this from any directory)
  2. 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
  3. 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
  4. Install the library to /usr/local/lib:
    install -p -m 0644 dmd/lib/libphobos.a /usr/local/lib
  5. 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)
Sample /etc/dmd.conf:
 [Environment]

DFLAGS=-I/usr/local/src/phobos -L-L/usr/local/lib

Using Bash Script    

You can also choose to use a bash script created to handle installation and updating of DMD.

install-d
Install DMD
install-tango
Install Tango, expects DMD to have been installed with install-d
dmd-switch
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

AMD64    

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:

Ubuntu    

sudo aptitude install gcc-multilib libc6-i386 lib6-dev-i386

Also you may need the 32bit libraries to run your compiled program.

sudo aptitude install ia32-libs

Arch Linux    

If you have gcc-multilib installed, you should remove it before starting:

$ sudo pacman -Rd gcc-multilib

You can then use:

$ yaourt -S cross32-gcc

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:

 CC=/usr/bin/i686-unknown-linux-gnu-gcc

Your dmd.conf should now look something like:

  [Environment]

  DFLAGS=-I%@P%/../../src/phobos -L-L%@P%/../lib 
  CC=/usr/bin/i686-unknown-linux-gnu-gcc

Mac OS X    

Compiling Programs    

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.

Windows:

dmd.exe prog.d

Linux/Mac OS X:

dmd prog.d

If it worked the result is cryptic, but pretty boring.

Output on Windows:

d:\dmd\bin\..\..\dm\bin\link.exe nothing,,,user32+kernel32/noi;

Output on Linux:

gcc nothing.o -o nothing -lphobos -lpthread -lm

Output on Mac OS X: (i.e. nothing at all, nice and quiet)

Related    


FrontPage | News | TestPage | MessageBoard | Search | Contributors | Folders | Index | Help | Preferences | Edit

Edit text of this page (date of last change: March 7, 2012 20:21 (diff))