These are my notes on how to install a D Programming Language compiler along with it’s package management tool Dub and how to set-up a first “Hello World” project on a Raspberry PI running Raspbian.
I’ve chosen the GDC compiler due to its comprehensive architecture support (https://wiki.dlang.org/Compilers#Comparison), and ease of install:
sudo apt-get install -y gdc
DUB is a D Programming Language package manager similar to NodeJS npm and PHP Composer. Installing DUB on Raspbian can be done by downloading the latest release:
wget https://code.dlang.org/files/dub-0.9.24-linux-arm.tar.gz && tar -zxvf dub-0.9.24-linux-arm.tar.gz
Optionally, the ‘dub’ binary can be copied to /usr/local/bin/:
cp dub /usr/local/bin
Once installed, you can create a project using:
dub init helloworld
This command will generate the directory structure for your application. Your code can be found in:
./helloworld/source/app.d
Compiling and running it can be done by issuing the following in ./helloworld:
dub