Tutorial on how to build DMD/druntime/phobos and docs from source?

Joseph Rushton Wakeling joseph.wakeling at webdrake.net
Thu Jan 31 04:05:03 PST 2013


On 01/30/2013 01:58 PM, timewulf wrote:
> It took me some time to realize, that it was dmd-2.60 that caused the
> errors: To compile the libraries out of 2.61 or git, one needs a recent
> compiler.

More specifically, you should be compiling Phobos and druntime releases (or 
latest up-to-date git source) with the corresponding DMD release/latest dev version.

Funnily enough I never ran into this issue because before building from source I 
scrubbed all previous DMD installs from my system, or -- when updating 
from-source builds -- I would copy the newly-built dmd to the appropriate path 
location before building runtime/Phobos, so conveniently overwriting the old dmd.

Alex' tutorial on his (old) blog is really useful because it emphasizes the 
necessity of using the newly-built DMD rather than the old one.  And it's as 
simple as adding "DMD=../dmd/src/dmd" when invoking make.


> At what places and in which order dmd searches for dmd.conf files?

I think the _first_ location is the same directory as the dmd executable being 
used.  That's where I put it, at any rate (which in my case, is /opt/dmd/bin/).

> What files should be placed in what linux-directories? It can't be
> reasonable, to set the "PATH"-Variable to /usr/src/dmd/src, to get the
> latest dmd-compiler running, even so for Library- and Include-Paths.
> Whith next git-update, there will be a newly generated mix of versions
> again.
>
> So what files do one need to copy to the standard-directories of Linux,
> so that all functionality of dmd will be reachable for daily use?
>
> In the wiki it should be mentioned, that one needs a recent enough
> dmd-compiler, to get this stuff running, where to get it and with what
> steps to install it.

I think you'll find Alex' blog post answers all your questions.  To give the 
link again:
https://xtzgzorex.wordpress.com/2011/07/31/d-building-dmd-and-phobos-on-linux/

I personally find it more convenient to put my from-source dmd installs in 
/opt/dmd, just because then it's easier to scrub it from the system without 
risking touching anything else.  Of course, you then have to do some adding to 
$PATH, but that's easy enough -- I actually include the following script in 
/etc/profile.d:

	for d in /opt/*/bin; do
		PATH="$PATH:$d"
	done

... which is maybe a bit unsubtle but does the job for me. :-)


More information about the Digitalmars-d-learn mailing list