www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Tutorial on how to build DMD/druntime/phobos and docs from source?

reply Chad Joan <chadjoan gmail.com> writes:
I remember there being a tutorial on how to build DMD and such from 
source.  I've been searching for a while and can't find it.  It won't 
show up on google searches.  Does anyone have a link?

Right now I'm most interested in a tutorial on how to build the docs.

Thanks.
Jan 27 2013
next sibling parent reply "H. S. Teoh" <hsteoh quickfur.ath.cx> writes:
On Sun, Jan 27, 2013 at 04:13:08PM -0500, Chad Joan wrote:
 I remember there being a tutorial on how to build DMD and such from
 source.  I've been searching for a while and can't find it.  It
 won't show up on google searches.  Does anyone have a link?
http://wiki.dlang.org/Building_DMD
 Right now I'm most interested in a tutorial on how to build the docs.
[...] For docs, checkout "d-programming-language.org" from github, and run make on it to generate the HTML, CSS, etc.. Then checkout phobos and run 'make html'. I forget the exact commands but there should be analogous commands for druntime (and maybe dmd). You may need to tweak the directory structure a bit to get everything to be installed in the right places; I don't remember the details off-hand (I'm usually just interested in a single .html file so I just copy that to the web server's directory). T -- Meat: euphemism for dead animal. -- Flora
Jan 27 2013
parent Chad Joan <chadjoan gmail.com> writes:
On 01/27/2013 04:34 PM, H. S. Teoh wrote:
 On Sun, Jan 27, 2013 at 04:13:08PM -0500, Chad Joan wrote:
 I remember there being a tutorial on how to build DMD and such from
 source.  I've been searching for a while and can't find it.  It
 won't show up on google searches.  Does anyone have a link?
http://wiki.dlang.org/Building_DMD
Exactly what I was thinking of.
 Right now I'm most interested in a tutorial on how to build the docs.
[...] For docs, checkout "d-programming-language.org" from github, and run make on it to generate the HTML, CSS, etc.. Then checkout phobos and run 'make html'. I forget the exact commands but there should be analogous commands for druntime (and maybe dmd). You may need to tweak the directory structure a bit to get everything to be installed in the right places; I don't remember the details off-hand (I'm usually just interested in a single .html file so I just copy that to the web server's directory). T
Cool, thank you!
Jan 27 2013
prev sibling next sibling parent Joseph Rushton Wakeling <joseph.wakeling webdrake.net> writes:
On 01/27/2013 10:13 PM, Chad Joan wrote:
 I remember there being a tutorial on how to build DMD and such from source.
 I've been searching for a while and can't find it.  It won't show up on google
 searches.  Does anyone have a link?
Besides the wiki, see: https://xtzgzorex.wordpress.com/2011/07/31/d-building-dmd-and-phobos-on-linux/
Jan 28 2013
prev sibling next sibling parent "H. S. Teoh" <hsteoh quickfur.ath.cx> writes:
On Mon, Jan 28, 2013 at 03:20:32PM +0100, Joseph Rushton Wakeling wrote:
 On 01/27/2013 10:13 PM, Chad Joan wrote:
I remember there being a tutorial on how to build DMD and such from
source.  I've been searching for a while and can't find it.  It won't
show up on google searches.  Does anyone have a link?
Besides the wiki, see: https://xtzgzorex.wordpress.com/2011/07/31/d-building-dmd-and-phobos-on-linux/
Would you kindly add this info to the wiki? :-) T -- Recently, our IT department hired a bug-fix engineer. He used to work for Volkswagen.
Jan 28 2013
prev sibling next sibling parent Philippe Sigaud <philippe.sigaud gmail.com> writes:
 Besides the wiki, see:
 https://xtzgzorex.wordpress.com/2011/07/31/d-building-dmd-and-phobos-on-linux/
Would you kindly add this info to the wiki? :-)
Where on the page?
Jan 28 2013
prev sibling next sibling parent "H. S. Teoh" <hsteoh quickfur.ath.cx> writes:
On Mon, Jan 28, 2013 at 09:24:46PM +0100, Philippe Sigaud wrote:
 Besides the wiki, see:
 https://xtzgzorex.wordpress.com/2011/07/31/d-building-dmd-and-phobos-on-linux/
Would you kindly add this info to the wiki? :-)
Where on the page?
Ideally, integrate it into the current page structure. Or reorg the page as you see fit. T -- "Maybe" is a strange word. When mom or dad says it it means "yes", but when my big brothers say it it means "no"! -- PJ jr.
Jan 28 2013
prev sibling parent reply Philippe Sigaud <philippe.sigaud gmail.com> writes:
On Mon, Jan 28, 2013 at 10:14 PM, H. S. Teoh <hsteoh quickfur.ath.cx> wrote:
 On Mon, Jan 28, 2013 at 09:24:46PM +0100, Philippe Sigaud wrote:
 Besides the wiki, see:
 https://xtzgzorex.wordpress.com/2011/07/31/d-building-dmd-and-phobos-on-linux/
Would you kindly add this info to the wiki? :-)
Where on the page?
Ideally, integrate it into the current page structure. Or reorg the page as you see fit.
OK, I integrated some explanations on dmd.conf. I also added /tools.git and explanations at the end.
Jan 29 2013
parent reply timewulf <timewulf network-application.de> writes:
On 29.01.2013 21:25, Philippe Sigaud wrote:
 On Mon, Jan 28, 2013 at 10:14 PM, H. S. Teoh <hsteoh quickfur.ath.cx> wrote:
 On Mon, Jan 28, 2013 at 09:24:46PM +0100, Philippe Sigaud wrote:
 Besides the wiki, see:
 https://xtzgzorex.wordpress.com/2011/07/31/d-building-dmd-and-phobos-on-linux/
Would you kindly add this info to the wiki? :-)
Where on the page?
Ideally, integrate it into the current page structure. Or reorg the page as you see fit.
OK, I integrated some explanations on dmd.conf. I also added /tools.git and explanations at the end.
Hi all, this thread helped me much, but I ran into some trouble during bootstrapping dmd, because of some todos, not mentioned in the wiki. First I will give you a field report, explaining my way, I installed dmd from source (not really a shortstory ;-)) ..) and then, I hope, I will ask some not so silly questions. I use gentoo and installed dmd-2.60, because that's actually the last version in portage (the gentoo packagemanager). All went ok, I tested some little d-examples and then I wanted to get dmd-2.61 to run. Now the trouble begun: First I followed the wiki, tried to use the actual git version: dmd compiles, but the druntime and phobos don't do the same. Much warnings and some errors were shown. Ok, I'll go the same way with the last release: dmd.2.61.zip But mostly the same happened, some other warnings and errors, but the libraries won't compile. 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. Nice: I found it as binary in the linux directory in the root of 'dmd.2.61.zip'. Luck: My PATH-Variable points to /usr/local/bin:/usr/bin:..., The portage version of dmd-2.60 was installed in /usr/bin, so I copied the 2.61-binaries to /usr/local/bin without need to delete the old version before. druntime and phobos now compiled without errors, but even the tools made some trouble again. The phobos- and druntime-sources were not found at the right places. This time there's even a reasonable hint, so I know, where the sources are searched for. After copying to the right path, now even the tools got compiled. Until now I'm not convinced, that the result of my work is a clean dmd v.2.62 (git) compiler environment or a mix out of v.2.60 (the gentoo-package), v.2.61 (out of the zip) and the git-sources and compilations itself. Why? There's a dmd.conf in /etc, which points to the libraries and include-files of version 2.60. There's another one in /usr/local/bin which I copied there together with the binaries I mentioned above and in the wiki is mentioned, to create a dmd.conf in /usr/src/d/dmd/src/ and it seems to me, that dmd looks at some default places to find what it needs. Now my questions / suggestions: At what places and in which order dmd searches for dmd.conf files? 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. An idea: Like in the dmd.2.61.zip, there could be a directory "linux" in the git-repository, with the needed bin-files in it. I would even appreciate, if there would be the whole compiler-environment with bins, libraries, includes and sources all of the same version, so one has a clean environment for bootstrapping dmd2 / druntime / phobos from git-sources. My problem was, that gentoo isn't able, to install .deb- or .rpm-files. That's why I wanted to create it from source, but whithout knowing what I know now, that was a bad task. I hope this report points out, what problems occur for people dealing new with dmd. It's not already a checklist, howto bootstrap dmd, but this report together with your knowledge of dmd, can help improve the wiki and the bootstrapping itself. Sorry, that it got so long, but leaving anything out wouldn't point out, what I wanted to say. Thanks all for your work on dmd. Maybe - and I hope so - I can help a bit in the future and do some of the work myself. Greetings, Timewulf
Jan 30 2013
next sibling parent Joseph Rushton Wakeling <joseph.wakeling webdrake.net> writes:
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. :-)
Jan 31 2013
prev sibling next sibling parent Philippe Sigaud <philippe.sigaud gmail.com> writes:
On Thu, Jan 31, 2013 at 1:05 PM, Joseph Rushton Wakeling
<joseph.wakeling webdrake.net> wrote:
 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.
Could you please update the wiki accordingly? (If you don't have an account, it takes 5 secs to get one, I did that a few weks ago)
Jan 31 2013
prev sibling next sibling parent Joseph Rushton Wakeling <joseph.wakeling webdrake.net> writes:
On 01/31/2013 05:58 PM, Philippe Sigaud wrote:
 Could you please update the wiki accordingly?  (If you don't have an
 account, it takes 5 secs to get one, I did that a few weks ago)
Yea, I've been slow about getting active on the Wiki, apologies for that. I've updated the page to include the DMD=../dmd/src/dmd option in the druntime/Phobos build process, and to add a discussion of how to install dmd etc. once it's built. I also added a link to Alex' blog post. :-)
Jan 31 2013
prev sibling parent reply Philippe Sigaud <philippe.sigaud gmail.com> writes:
On Thu, Jan 31, 2013 at 6:47 PM, Joseph Rushton Wakeling
<joseph.wakeling webdrake.net> wrote:
 On 01/31/2013 05:58 PM, Philippe Sigaud wrote:
 Could you please update the wiki accordingly?  (If you don't have an
 account, it takes 5 secs to get one, I did that a few weks ago)
Yea, I've been slow about getting active on the Wiki, apologies for that.
It was just that I had no easy access to a connection :)
 I've updated the page to include the DMD=../dmd/src/dmd option in the
 druntime/Phobos build process, and to add a discussion of how to install dmd
 etc. once it's built.

 I also added a link to Alex' blog post. :-)
In fact, I was a bit leery to add it yesterday, because these kinds of post are very ephemeral. But hey, we can also change the wiki when/if the post does not represent the current situation.
Jan 31 2013
parent reply timewulf <timewulf network-application.de> writes:
On 31.01.2013 19:17, Philippe Sigaud wrote:
 On Thu, Jan 31, 2013 at 6:47 PM, Joseph Rushton Wakeling
 <joseph.wakeling webdrake.net> wrote:
 On 01/31/2013 05:58 PM, Philippe Sigaud wrote:
 Could you please update the wiki accordingly?  (If you don't have an
 account, it takes 5 secs to get one, I did that a few weks ago)
Yea, I've been slow about getting active on the Wiki, apologies for that.
It was just that I had no easy access to a connection :)
 I've updated the page to include the DMD=../dmd/src/dmd option in the
 druntime/Phobos build process, and to add a discussion of how to install dmd
 etc. once it's built.

 I also added a link to Alex' blog post. :-)
In fact, I was a bit leery to add it yesterday, because these kinds of post are very ephemeral. But hey, we can also change the wiki when/if the post does not represent the current situation.
Hi all again, thanks for the changes, I tried out to install only with the wiki, as if I knew nothing more than a week before and I got it working without trouble. During my first approach, there was just one misunderstanding on my side: I didn't realize (I just didn't look for it.) , that the dmd-compiler itself is purely C-code. I thought, I need dmd for compiling the newer version. On the otherhand, I'm a safety-fanatic, first building the new hut before razing down the old one, because I dislike tents ... ;-)) There's a great discussion about "How to get d-Language more popular". I think this part, to make installation more easy and smoothy is one part, to help on this way. Everyone who heard about d and just wants to try-out if he can easily understand some samples, changing some parameters to see if they work as expected, doesn't want to put much time into installation before. Greetings, Timewulf (Berthold Humkamp)
Feb 01 2013
parent reply Joseph Rushton Wakeling <joseph.wakeling webdrake.net> writes:
On 02/01/2013 09:33 AM, timewulf wrote:
 During my first approach, there was just one misunderstanding on my
 side: I didn't realize (I just didn't look for it.) , that the
 dmd-compiler itself is purely C-code. I thought, I need dmd for
 compiling the newer version.
Actually it's C++, it's just that the filenames all end in .c.
 On the otherhand, I'm a safety-fanatic, first building the new hut
 before razing down the old one, because I dislike tents ... ;-))
Me too, but it's readily possible to do this safely. Actually I used to first build dmd and copy it to location _before_ building druntime/Phobos, so even missing off the DMD=../dmd/src/dmd flag I was still always using the correct dmd.
 I think this part, to make installation more easy and smoothy is one
 part, to help on this way. Everyone who heard about d and just wants to
 try-out if he can easily understand some samples, changing some
 parameters to see if they work as expected, doesn't want to put much
 time into installation before.
Have you tried installing LDC? I consider it by far the friendliest install experience of all the D compilers, and if someone was going to have a go at reworking the install scripts for DMD, it'd be worth following this model. http://wiki.dlang.org/Building_LDC_from_source Personally I recommend using the -DCMAKE_INSTALL_PREFIX=/opt/ldc when invoking cmake, as cmake does not by default provide an uninstall option, and this is the simplest way to ensure easy removal of what you install.
Feb 01 2013
parent reply timewulf <timewulf network-application.de> writes:
On 01.02.2013 13:08, Joseph Rushton Wakeling wrote:
 Have you tried installing LDC?  I consider it by far the friendliest
 install experience of all the D compilers, and if someone was going to
 have a go at reworking the install scripts for DMD, it'd be worth
 following this model.
 http://wiki.dlang.org/Building_LDC_from_source
 
 Personally I recommend using the -DCMAKE_INSTALL_PREFIX=/opt/ldc when
 invoking cmake, as cmake does not by default provide an uninstall
 option, and this is the simplest way to ensure easy removal of what you
 install.
One day before I wanted to try out, I found the ebuild for installing it out of portage. Now I've got the newest ldc2 from git and the comfort of my packagemanager. If there is any error in git-sources, portage will find out during compile and won't replace the installed version. With the complete infos to dmd-installation, I'll try to create a new dmd2.ebuild for installation out of git now. I'll post it, when it is ready.
Feb 01 2013
parent "timewulf" <timewulf network-application.de> writes:
On Friday, 1 February 2013 at 15:41:25 UTC, timewulf wrote:

 With the complete infos to dmd-installation, I'll try to create 
 a new
 dmd2.ebuild for installation out of git now. I'll post it, when 
 it is ready.
I've got adapted the ebuild and the patch of v 2.060 to 2.061. May you tell me, whom to send the files, that they will get into the portage overlay for gentoo? There's no supporter mentioned in the old ebuild. It would be no much work, to adept those files to the git-version also, but I looked into the make files of the previous releases of dmd. They changed much, so I think it will be a never ending story, to keep the patches up to date for git. May you tell me, who's working on the make-files, if it's possible, to build those trivialities directly into the posix.mak-files? Without those patches, the ebuild for git would work wonderfully.
Feb 01 2013