Let's add any comments to this protocol on this, it's own thread, rather than on the old thread, to encapsulate and localize -- so as to make it easier to find and replicate installion.<br><br>Thanks.<br><br>- Jason<br>
<br><div class="gmail_quote">On Tue, Mar 8, 2011 at 2:15 AM, Jens Mueller <span dir="ltr"><<a href="mailto:jens.k.mueller@gmx.de" target="_blank">jens.k.mueller@gmx.de</a>></span> wrote, on the old thread titled "LLVM 3.0 type system changes"<br>
<div class="gmail_quote"><div class="im">
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;"><div><div></div>Can you talk me through the building process? I tried it a week ago but<br>
</div>

with no success. Can you post the necessary steps on this list or to me<br>
in private?<br></blockquote></div><div><br>I can try to sketch the important aspects, but obviously this protocol hasn't been tested very widely, so feel free to post back any refinements.  Even better if you want to patch the repositories.  Some of these may be out of order, especially the CMakeCache.txt edits, so if anything goes wrong, check the variables mentioned below in CMakeCache.txt, and that your ldc2.conf is correct. Those are the most important two control files.<br>

<br>I'll start a new thread with a new title to make this easy to find, and more on topic.<br><br><font face="'courier new', monospace">I. Acknowledgements<br>
</font><br>Heavy credit for this is due to mrmonday on #ldc who guided me and graciously offered assistance.  Errors and typos are mine alone.<br><br><br><font face="'courier new', monospace">II. Protocol: Building LDC2 on Linux x86_64<br>
    Version: 07 March 2011<br>
</font><br><br>Prereqs: cmake, git, hg, llvm2.8 from source already installed (package installs of llvm2.8 might work too, I don't know).<br><br><font face="'courier new', monospace"><span style="color: rgb(68, 68, 68); font-family: Helvetica,Arial,sans-serif; font-size: 14px; line-height: 21px;"><pre style="margin: 0px; padding: 0px; border-width: 0px; font-weight: inherit; font-style: inherit; font-size: 14px; font-family: monospace ! important; vertical-align: baseline; line-height: 1.4em ! important; white-space: pre ! important;">
<span style="margin: 0px; padding: 0px; border-width: 0px; font-weight: inherit; font-style: italic; font-size: 14px; font-family: inherit; vertical-align: baseline; color: rgb(153, 153, 136);"># 1) Check out ldc2, druntime, and phobos2</span>:<br>

<a name="12e95c357b6a9c22_cl-2" style="margin: 0px; padding: 0px 3px; border-width: 0px; font-weight: inherit; font-style: inherit; font-size: 14px; font-family: inherit; vertical-align: baseline; text-decoration: none; color: inherit; display: block;"></a><span style="margin: 0px; padding: 0px; border-width: 0px; font-weight: inherit; font-style: inherit; font-size: 14px; font-family: inherit; vertical-align: baseline; color: rgb(0, 128, 128);">$ </span>hg clone <a href="https://bitbucket.org/prokhin_alexey/ldc2" target="_blank">https://bitbucket.org/prokhin_alexey/ldc2</a><br>

<a name="12e95c357b6a9c22_cl-3" style="margin: 0px; padding: 0px 3px; border-width: 0px; font-weight: inherit; font-style: inherit; font-size: 14px; font-family: inherit; vertical-align: baseline; text-decoration: none; color: inherit; display: block;"></a><span style="margin: 0px; padding: 0px; border-width: 0px; font-weight: inherit; font-style: inherit; font-size: 14px; font-family: inherit; vertical-align: baseline; color: rgb(0, 128, 128);">$ </span><span style="margin: 0px; padding: 0px; border-width: 0px; font-weight: inherit; font-style: inherit; font-size: 14px; font-family: inherit; vertical-align: baseline; color: rgb(153, 153, 153);">cd </span>ldc2<br>

<a name="12e95c357b6a9c22_cl-4" style="margin: 0px; padding: 0px 3px; border-width: 0px; font-weight: inherit; font-style: inherit; font-size: 14px; font-family: inherit; vertical-align: baseline; text-decoration: none; color: inherit; display: block;"></a><span style="margin: 0px; padding: 0px; border-width: 0px; font-weight: inherit; font-style: inherit; font-size: 14px; font-family: inherit; vertical-align: baseline; color: rgb(0, 128, 128);">$ </span>git clone <a href="https://github.com/AlexeyProkhin/druntime" target="_blank">https://github.com/AlexeyProkhin/druntime</a><br>

<a name="12e95c357b6a9c22_cl-5" style="margin: 0px; padding: 0px 3px; border-width: 0px; font-weight: inherit; font-style: inherit; font-size: 14px; font-family: inherit; vertical-align: baseline; text-decoration: none; color: inherit; display: block;"></a><span style="margin: 0px; padding: 0px; border-width: 0px; font-weight: inherit; font-style: inherit; font-size: 14px; font-family: inherit; vertical-align: baseline; color: rgb(0, 128, 128);">$ </span>git clone <a href="https://github.com/AlexeyProkhin/phobos" target="_blank">https://github.com/AlexeyProkhin/phobos</a><br>

<a name="12e95c357b6a9c22_cl-6" style="margin: 0px; padding: 0px 3px; border-width: 0px; font-weight: inherit; font-style: inherit; font-size: 14px; font-family: inherit; vertical-align: baseline; text-decoration: none; color: inherit; display: block;"></a><span style="margin: 0px; padding: 0px; border-width: 0px; font-weight: inherit; font-style: italic; font-size: 14px; font-family: inherit; vertical-align: baseline; color: rgb(153, 153, 136);"><br>

# 2) Configure (apparently you can also use ccmake with gui, but I didn't)</span><a name="12e95c357b6a9c22_cl-7" style="margin: 0px; padding: 0px 3px; border-width: 0px; font-weight: inherit; font-style: inherit; font-size: 14px; font-family: inherit; vertical-align: baseline; text-decoration: none; color: inherit; display: block;"></a><span style="margin: 0px; padding: 0px; border-width: 0px; font-weight: inherit; font-style: inherit; font-size: 14px; font-family: inherit; vertical-align: baseline; color: rgb(0, 128, 128);">$ </span>cmake .</pre>

<pre style="margin: 0px; padding: 0px; border-width: 0px; font-weight: inherit; font-style: inherit; font-size: 14px; font-family: monospace ! important; vertical-align: baseline; line-height: 1.4em ! important; white-space: pre ! important;">
<br># 3) Fix up the CMakeCache.txt file:<br><br></pre><pre style="margin: 0px; padding: 0px; border-width: 0px; font-weight: inherit; font-style: inherit; font-size: 14px; font-family: monospace ! important; vertical-align: baseline; line-height: 1.4em ! important; white-space: pre ! important;">
# 3 a) edit CMakeCache.txt by hand, and set D_VERSION to 2, as on these two lines:<br>...<br></pre><pre style="margin: 0px; padding: 0px; border-width: 0px; font-weight: inherit; font-style: inherit; font-size: 14px; font-family: monospace ! important; vertical-align: baseline; line-height: 1.4em ! important; white-space: pre ! important;">
//D language version - will originally be set to 1, change it to 2 like this:<br>D_VERSION:STRING=2</pre><pre style="margin: 0px; padding: 0px; border-width: 0px; font-weight: inherit; font-style: inherit; font-size: 14px; font-family: monospace ! important; vertical-align: baseline; line-height: 1.4em ! important; white-space: pre ! important;">
...<br><br># 3 b) check on the variables mentioned in 3 d). I don't think that they will be present yet, but<br>if they aren't, it can't hurt to fix them now as well.<br><br># 3 c) make (this should hopefully build bin/ldc2 now )<br>

$ make<br><br># there will be some const warnings, but the build finishes for me.<br><br># 3 d) edit CMakeCache.txt again (it will have changed/had appendixes now I think) and fix these two variables:<br></pre></span></font><br>

...<br><div><div>//runtime source dir</div><div>RUNTIME_DIR:PATH=/home/jaten/pkg/ldc2/ldc2/druntime</div><div>...</div><div><div>//phobos2 source dir</div><div>PHOBOS2_DIR:PATH=/home/jaten/pkg/ldc2/ldc2/phobos</div><div>
...<br>
<br># 4) modify your your .bashrc to set PATH to include ./bin in front of everything else<br><br>echo "export PATH=`pwd`/bin:\$PATH" >> ~/.bashrc<br>.  ~/.bashrc<br>which ldc2 # should show the one in ./bin now<br>

<br><br># 5) build druntime and phobos with the command: make phobos2<br><br><br></div></div></div>$ make phobos2<br><br><br># 6) edit   ./bin/ldc2.conf so that it points to the right places.  Here is a copy of mine that seems to work. The point of the editing is to make sure that paths are correct, especially the third -I (Include line), which was often wrong out of the box when I was working with it.<br>

<br><div><div><font face="'courier new', monospace">jaten@dfw:~$ cat ldc2.conf</font></div><div><font face="'courier new', monospace">// This configuration file uses libconfig.</font></div><div><font face="'courier new', monospace">// See <a href="http://www.hyperrealm.com/libconfig/" target="_blank">http://www.hyperrealm.com/libconfig/</a> for syntax details.</font></div>

<div><font face="'courier new', monospace"><br></font></div><div><font face="'courier new', monospace">// The default group is required</font></div><div><font face="'courier new', monospace">default:</font></div>

<div><font face="'courier new', monospace">{   </font></div><div><font face="'courier new', monospace">    // 'switches' holds array of string that are appends to the command line</font></div><div>

<font face="'courier new', monospace">    // arguments before they are parsed.</font></div><div><font face="'courier new', monospace">    switches = [</font></div><div><font face="'courier new', monospace">        "-I/home/jaten/pkg/llvm+lldb+ldc/prokhin_alexeys_ldc2/ldc2/druntime/import",</font></div>

<div><font face="'courier new', monospace">        "-I/home/jaten/pkg/llvm+lldb+ldc/prokhin_alexeys_ldc2/ldc2/druntime/src",</font></div><div><font face="'courier new', monospace">        "-I/home/jaten/pkg/llvm+lldb+ldc/prokhin_alexeys_ldc2/ldc2/phobos/",</font></div>

<div><font face="'courier new', monospace">        "-L-L/home/jaten/pkg/llvm+lldb+ldc/prokhin_alexeys_ldc2/ldc2/runtime/../lib",</font></div><div><font face="'courier new', monospace">        "-defaultlib=phobos2",</font></div>

<div><font face="'courier new', monospace">        "-debuglib=phobos2"</font></div><div><font face="'courier new', monospace">    ];</font></div><div><font face="'courier new', monospace">};</font></div>

<div><font face="'courier new', monospace">jaten@dfw:~$ </font></div><div><font face="'courier new', monospace"><br># 7) Finished.  Test and note variances from the protocol above.<br></font></div><div><font face="'courier new', monospace"><br>

<br>III. Appendix: Troubleshooting notes<br><br>If anything goes wrong, in my experience it was due to the settings in either CMakeCache.txt, or in ./bin/ldc2.conf  Those are the two places I would look at first when troubleshooting.<br>

<br></font></div></div><div>A) When you edit the CMakeCache.txt, be sure to check that PHOBOS2_DIR gets set to ./phobos and not ../druntime</div><div><br># example that works:<br></div><div>jaten@dfw:~$ cat CMakeCache.txt.afarm_works_ldc2 | grep PHOBOS2_DIR</div>

<div>PHOBOS2_DIR:PATH=/home/jaten/pkg/llvm+lldb+ldc/prokhin_alexeys_ldc2/ldc2/phobos</div><div><br># example that DOES NOT work:<br>jaten@dfw:~$ cat CMakeCache.txt.dfw_notwork_ldc2 | grep PHOBOS2_DIR</div><div>PHOBOS2_DIR:PATH=/home/jaten/pkg/ldc2/ldc2/../druntime</div>

<div><br></div><br><div>B) Be sure in CMakeCache.txt you have these three variables 
set correctly, with obvious edits for your paths, not mine:<br><br></div><div><div>...<br></div><div>//D language version</div><div>D_VERSION:STRING=2</div><div>...</div></div><div><div>//runtime source dir</div><div>RUNTIME_DIR:PATH=/home/jaten/pkg/ldc2/ldc2/druntime</div>

<div>...</div><div><div>//phobos2 source dir</div><div>PHOBOS2_DIR:PATH=/home/jaten/pkg/ldc2/ldc2/phobos</div><div><br></div></div></div><br>Good luck!<br><br>
</div></div></div>