Thursday, May 13, 2010

Installing the DMD compiler on Unbuntu Netbook Edition 10.04

Here's the procedure I used to install the Digital Mars D compiler on Ubuntu Netbook Edition 10.04. I can't imagine that it would be incredibly different for similar distros. For the most part it's a personalized version of the steps found here: http://www.digitalmars.com/d/1.0/dmd-linux.html#installation

  1. Installed gcc
  2. Downloaded the latest version for D1 (1.060 at the time of this post) from http://ftp.digitalmars.com/dmd.1.060.zip
  3. Extracted the directory to ~/Downloads/
  4. Created directory /opt/dmd with permissions 755 and owner root/root
  5. Created directory /opt/dmd/bin with permissions 755 and owner root/root
  6. Copied /home/mike/Downloads/dmd/linux/bin/dmd.conf to /opt/dmd/bin
  7. Copied dmd, dumpobj, obj2asm, and rdmd from /home/mike/Downloads/dmd/linux/bin/ to /opt/dmd/bin
  8. Changed the permissions of dmd, dumpobj, obj2asm, and rdmd in /opt/dmd/bin to 555
  9. Made sure dmd, dumpobj, obj2asm, and rdmd in /opt/dmd/bin had owner root/root
  10. Created directory /opt/dmd/lib with permissions 755 and owner root/root
  11. Copied /home/mike/Downloads/dmd/linux/lib/libphobos.a to /opt/dmd/lib/
  12. Added /opt/dmd/bin to the path in /etc/environment
  13. Copied /home/mike/dmd/src to /opt/dmd/src
  14. Changed the DFLAGS line in /opt/dmd/bin/dmd.conf to:
    DFLAGS=-I/opt/dmd/src/phobos -L-L/opt/dmd/lib
  15. Tested it with a simple hello world program
Some of the steps could be wrong, since I recorded them out of order and logged out once in the process...

So in summary, you just need the key things to check for are
  • That the dmd can find a dmd.conf file
  • That the dmd.conf file knows where to look for includes and libraries
  • That libphobos is accessible as well as its source
Digital Mars had a .deb file, but I haven't played with it.

No comments:

Post a Comment