www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - how to build LDC2 on linux x86_64

--0016e6567fb6f4a28e049df91a49
Content-Type: text/plain; charset=ISO-8859-1

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.

Thanks.

- Jason

On Tue, Mar 8, 2011 at 2:15 AM, Jens Mueller <jens.k.mueller gmx.de> wrote,
on the old thread titled "LLVM 3.0 type system changes"

 Can you talk me through the building process? I tried it a week ago but
 with no success. Can you post the necessary steps on this list or to me
 in private?

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. I'll start a new thread with a new title to make this easy to find, and more on topic. I. Acknowledgements Heavy credit for this is due to mrmonday on #ldc who guided me and graciously offered assistance. Errors and typos are mine alone. II. Protocol: Building LDC2 on Linux x86_64 Version: 07 March 2011 Prereqs: cmake, git, hg, llvm2.8 from source already installed (package installs of llvm2.8 might work too, I don't know). # 1) Check out ldc2, druntime, and phobos2: $ hg clone https://bitbucket.org/prokhin_alexey/ldc2 $ cd ldc2 $ git clone https://github.com/AlexeyProkhin/druntime $ git clone https://github.com/AlexeyProkhin/phobos # 2) Configure (apparently you can also use ccmake with gui, but I didn't)$ cmake . # 3) Fix up the CMakeCache.txt file: # 3 a) edit CMakeCache.txt by hand, and set D_VERSION to 2, as on these two lines: ... //D language version - will originally be set to 1, change it to 2 like this: D_VERSION:STRING=2 ... # 3 b) check on the variables mentioned in 3 d). I don't think that they will be present yet, but if they aren't, it can't hurt to fix them now as well. # 3 c) make (this should hopefully build bin/ldc2 now ) $ make # there will be some const warnings, but the build finishes for me. # 3 d) edit CMakeCache.txt again (it will have changed/had appendixes now I think) and fix these two variables: ... //runtime source dir RUNTIME_DIR:PATH=/home/jaten/pkg/ldc2/ldc2/druntime ... //phobos2 source dir PHOBOS2_DIR:PATH=/home/jaten/pkg/ldc2/ldc2/phobos ... # 4) modify your your .bashrc to set PATH to include ./bin in front of everything else echo "export PATH=`pwd`/bin:\$PATH" >> ~/.bashrc . ~/.bashrc which ldc2 # should show the one in ./bin now # 5) build druntime and phobos with the command: make phobos2 $ make phobos2 # 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. jaten dfw:~$ cat ldc2.conf // This configuration file uses libconfig. // See http://www.hyperrealm.com/libconfig/ for syntax details. // The default group is required default: { // 'switches' holds array of string that are appends to the command line // arguments before they are parsed. switches = [ "-I/home/jaten/pkg/llvm+lldb+ldc/prokhin_alexeys_ldc2/ldc2/druntime/import", "-I/home/jaten/pkg/llvm+lldb+ldc/prokhin_alexeys_ldc2/ldc2/druntime/src", "-I/home/jaten/pkg/llvm+lldb+ldc/prokhin_alexeys_ldc2/ldc2/phobos/", "-L-L/home/jaten/pkg/llvm+lldb+ldc/prokhin_alexeys_ldc2/ldc2/runtime/../lib", "-defaultlib=phobos2", "-debuglib=phobos2" ]; }; jaten dfw:~$ # 7) Finished. Test and note variances from the protocol above. III. Appendix: Troubleshooting notes 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. A) When you edit the CMakeCache.txt, be sure to check that PHOBOS2_DIR gets set to ./phobos and not ../druntime # example that works: jaten dfw:~$ cat CMakeCache.txt.afarm_works_ldc2 | grep PHOBOS2_DIR PHOBOS2_DIR:PATH=/home/jaten/pkg/llvm+lldb+ldc/prokhin_alexeys_ldc2/ldc2/phobos # example that DOES NOT work: jaten dfw:~$ cat CMakeCache.txt.dfw_notwork_ldc2 | grep PHOBOS2_DIR PHOBOS2_DIR:PATH=/home/jaten/pkg/ldc2/ldc2/../druntime B) Be sure in CMakeCache.txt you have these three variables set correctly, with obvious edits for your paths, not mine: ... //D language version D_VERSION:STRING=2 ... //runtime source dir RUNTIME_DIR:PATH=/home/jaten/pkg/ldc2/ldc2/druntime ... //phobos2 source dir PHOBOS2_DIR:PATH=/home/jaten/pkg/ldc2/ldc2/phobos Good luck! --0016e6567fb6f4a28e049df91a49 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Let&#39;s add any comments to this protocol on this, it&#39;s own thread, r= ather 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<b= r> <br><div class=3D"gmail_quote">On Tue, Mar 8, 2011 at 2:15 AM, Jens Mueller= <span dir=3D"ltr">&lt;<a href=3D"mailto:jens.k.mueller gmx.de" target=3D"_= blank">jens.k.mueller gmx.de</a>&gt;</span> wrote, on the old thread titled= &quot;LLVM 3.0 type system changes&quot;<br> <div class=3D"gmail_quote"><div class=3D"im"> <blockquote class=3D"gmail_quote" style=3D"margin: 0pt 0pt 0pt 0.8ex; borde= r-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;"><div><div></div>C= an 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 importan= t aspects, but obviously this protocol hasn&#39;t been tested very widely, = so feel free to post back any refinements.=A0 Even better if you want to pa= tch the repositories.=A0 Some of these may be out of order, especially the = CMakeCache.txt edits, so if anything goes wrong, check the variables mentio= ned below in CMakeCache.txt, and that your ldc2.conf is correct. Those are = the most important two control files.<br> <br>I&#39;ll start a new thread with a new title to make this easy to find,= and more on topic.<br><br><font face=3D"&#39;courier new&#39;, monospace">= I. Acknowledgements<br> </font><br>Heavy credit for this is due to mrmonday on #ldc who guided me a= nd graciously offered assistance.=A0 Errors and typos are mine alone.<br><b= r><br><font face=3D"&#39;courier new&#39;, monospace">II. Protocol: Buildin= g LDC2 on Linux x86_64<br> =A0=A0=A0 Version: 07 March 2011<br> </font><br><br>Prereqs: cmake, git, hg, llvm2.8 from source already install= ed (package installs of llvm2.8 might work too, I don&#39;t know).<br><br><= font face=3D"&#39;courier new&#39;, monospace"><span style=3D"color: rgb(68= , 68, 68); font-family: Helvetica,Arial,sans-serif; font-size: 14px; line-h= eight: 21px;"><pre style=3D"margin: 0px; padding: 0px; border-width: 0px; f= ont-weight: inherit; font-style: inherit; font-size: 14px; font-family: mon= ospace ! important; vertical-align: baseline; line-height: 1.4em ! importan= t; white-space: pre ! important;"> <span style=3D"margin: 0px; padding: 0px; border-width: 0px; font-weight: i= nherit; 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=3D"12e95c357b6a9c22_cl-2" style=3D"margin: 0px; padding: 0px 3px; b= order-width: 0px; font-weight: inherit; font-style: inherit; font-size: 14p= x; font-family: inherit; vertical-align: baseline; text-decoration: none; c= olor: inherit; display: block;"></a><span style=3D"margin: 0px; padding: 0p= x; border-width: 0px; font-weight: inherit; font-style: inherit; font-size:= 14px; font-family: inherit; vertical-align: baseline; color: rgb(0, 128, 1= 28);">$ </span>hg clone <a href=3D"https://bitbucket.org/prokhin_alexey/ldc= 2" target=3D"_blank">https://bitbucket.org/prokhin_alexey/ldc2</a><br> <a name=3D"12e95c357b6a9c22_cl-3" style=3D"margin: 0px; padding: 0px 3px; b= order-width: 0px; font-weight: inherit; font-style: inherit; font-size: 14p= x; font-family: inherit; vertical-align: baseline; text-decoration: none; c= olor: inherit; display: block;"></a><span style=3D"margin: 0px; padding: 0p= x; border-width: 0px; font-weight: inherit; font-style: inherit; font-size:= 14px; font-family: inherit; vertical-align: baseline; color: rgb(0, 128, 1= 28);">$ </span><span style=3D"margin: 0px; padding: 0px; border-width: 0px;= font-weight: inherit; font-style: inherit; font-size: 14px; font-family: i= nherit; vertical-align: baseline; color: rgb(153, 153, 153);">cd </span>ldc= 2<br> <a name=3D"12e95c357b6a9c22_cl-4" style=3D"margin: 0px; padding: 0px 3px; b= order-width: 0px; font-weight: inherit; font-style: inherit; font-size: 14p= x; font-family: inherit; vertical-align: baseline; text-decoration: none; c= olor: inherit; display: block;"></a><span style=3D"margin: 0px; padding: 0p= x; border-width: 0px; font-weight: inherit; font-style: inherit; font-size:= 14px; font-family: inherit; vertical-align: baseline; color: rgb(0, 128, 1= 28);">$ </span>git clone <a href=3D"https://github.com/AlexeyProkhin/drunti= me" target=3D"_blank">https://github.com/AlexeyProkhin/druntime</a><br> <a name=3D"12e95c357b6a9c22_cl-5" style=3D"margin: 0px; padding: 0px 3px; b= order-width: 0px; font-weight: inherit; font-style: inherit; font-size: 14p= x; font-family: inherit; vertical-align: baseline; text-decoration: none; c= olor: inherit; display: block;"></a><span style=3D"margin: 0px; padding: 0p= x; border-width: 0px; font-weight: inherit; font-style: inherit; font-size:= 14px; font-family: inherit; vertical-align: baseline; color: rgb(0, 128, 1= 28);">$ </span>git clone <a href=3D"https://github.com/AlexeyProkhin/phobos= " target=3D"_blank">https://github.com/AlexeyProkhin/phobos</a><br> <a name=3D"12e95c357b6a9c22_cl-6" style=3D"margin: 0px; padding: 0px 3px; b= order-width: 0px; font-weight: inherit; font-style: inherit; font-size: 14p= x; font-family: inherit; vertical-align: baseline; text-decoration: none; c= olor: inherit; display: block;"></a><span style=3D"margin: 0px; padding: 0p= x; 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&#39= ;t)</span><a name=3D"12e95c357b6a9c22_cl-7" style=3D"margin: 0px; padding: = 0px 3px; border-width: 0px; font-weight: inherit; font-style: inherit; font= -size: 14px; font-family: inherit; vertical-align: baseline; text-decoratio= n: none; color: inherit; display: block;"></a><span style=3D"margin: 0px; p= adding: 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=3D"margin: 0px; padding: 0px; border-width: 0px; font-weight: in= herit; font-style: inherit; font-size: 14px; font-family: monospace ! impor= tant; 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=3D"margin:= 0px; padding: 0px; border-width: 0px; font-weight: inherit; font-style: in= herit; 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=3D"margin: 0px; padding: 0px; border-wid= th: 0px; font-weight: inherit; font-style: inherit; font-size: 14px; font-f= amily: 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 thi= s:<br>D_VERSION:STRING=3D2</pre><pre style=3D"margin: 0px; padding: 0px; bo= rder-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&#39;t thi= nk that they will be present yet, but<br>if they aren&#39;t, it can&#39;t h= urt to fix them now as well.<br><br># 3 c) make (this should hopefully buil= d bin/ldc2 now )<br> $ make<br><br># there will be some const warnings, but the build finishes f= or me.<br><br># 3 d) edit CMakeCache.txt again (it will have changed/had ap= pendixes now I think) and fix these two variables:<br></pre></span></font><= br> ...<br><div><div>//runtime source dir</div><div>RUNTIME_DIR:PATH=3D/home/ja= ten/pkg/ldc2/ldc2/druntime</div><div>...</div><div><div>//phobos2 source di= r</div><div>PHOBOS2_DIR:PATH=3D/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 &quot;export PATH=3D`pwd`/bin:\$PATH&quot; &gt;= &gt; ~/.bashrc<br>.=A0 ~/.bashrc<br>which ldc2 # should show the one in ./b= in now<br> <br><br># 5) build druntime and phobos with the command: make phobos2<br><b= r><br></div></div></div>$ make phobos2<br><br><br># 6) edit=A0=A0 ./bin/ldc= 2.conf so that it points to the right places.=A0 Here is a copy of mine tha= t seems to work. The point of the editing is to make sure that paths are co= rrect, 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=3D"&#39;courier new&#39;, monospace">jaten dfw:~$ = cat ldc2.conf</font></div><div><font face=3D"&#39;courier new&#39;, monospa= ce">// This configuration file uses libconfig.</font></div><div><font face= =3D"&#39;courier new&#39;, monospace">// See <a href=3D"http://www.hyperrea= lm.com/libconfig/" target=3D"_blank">http://www.hyperrealm.com/libconfig/</= a> for syntax details.</font></div> <div><font face=3D"&#39;courier new&#39;, monospace"><br></font></div><div>= <font face=3D"&#39;courier new&#39;, monospace">// The default group is req= uired</font></div><div><font face=3D"&#39;courier new&#39;, monospace">defa= ult:</font></div> <div><font face=3D"&#39;courier new&#39;, monospace">{ =A0=A0</font></div><= div><font face=3D"&#39;courier new&#39;, monospace">=A0=A0 =A0// &#39;switc= hes&#39; holds array of string that are appends to the command line</font><= /div><div> <font face=3D"&#39;courier new&#39;, monospace">=A0=A0 =A0// arguments befo= re they are parsed.</font></div><div><font face=3D"&#39;courier new&#39;, m= onospace">=A0=A0 =A0switches =3D [</font></div><div><font face=3D"&#39;cour= ier new&#39;, monospace">=A0=A0 =A0 =A0 =A0&quot;-I/home/jaten/pkg/llvm+lld= b+ldc/prokhin_alexeys_ldc2/ldc2/druntime/import&quot;,</font></div> <div><font face=3D"&#39;courier new&#39;, monospace">=A0=A0 =A0 =A0 =A0&quo= t;-I/home/jaten/pkg/llvm+lldb+ldc/prokhin_alexeys_ldc2/ldc2/druntime/src&qu= ot;,</font></div><div><font face=3D"&#39;courier new&#39;, monospace">=A0= =A0 =A0 =A0 =A0&quot;-I/home/jaten/pkg/llvm+lldb+ldc/prokhin_alexeys_ldc2/l= dc2/phobos/&quot;,</font></div> <div><font face=3D"&#39;courier new&#39;, monospace">=A0=A0 =A0 =A0 =A0&quo= t;-L-L/home/jaten/pkg/llvm+lldb+ldc/prokhin_alexeys_ldc2/ldc2/runtime/../li= b&quot;,</font></div><div><font face=3D"&#39;courier new&#39;, monospace">= =A0=A0 =A0 =A0 =A0&quot;-defaultlib=3Dphobos2&quot;,</font></div> <div><font face=3D"&#39;courier new&#39;, monospace">=A0=A0 =A0 =A0 =A0&quo= t;-debuglib=3Dphobos2&quot;</font></div><div><font face=3D"&#39;courier new= &#39;, monospace">=A0=A0 =A0];</font></div><div><font face=3D"&#39;courier = new&#39;, monospace">};</font></div> <div><font face=3D"&#39;courier new&#39;, monospace">jaten dfw:~$=A0</font>= </div><div><font face=3D"&#39;courier new&#39;, monospace"><br># 7) Finishe= d.=A0 Test and note variances from the protocol above.<br></font></div><div=
<font face=3D"&#39;courier new&#39;, 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=A0 Those are the two places I would look at first when troubl= eshooting.<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.afa= rm_works_ldc2 | grep PHOBOS2_DIR</div> <div>PHOBOS2_DIR:PATH=3D/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:P= ATH=3D/home/jaten/pkg/ldc2/ldc2/../druntime</div> <div><br></div><br><div>B) Be sure in CMakeCache.txt you have these three v= ariables=20 set correctly, with obvious edits for your paths, not mine:<br><br></div><d= iv><div>...<br></div><div>//D language version</div><div>D_VERSION:STRING= =3D2</div><div>...</div></div><div><div>//runtime source dir</div><div>RUNT= IME_DIR:PATH=3D/home/jaten/pkg/ldc2/ldc2/druntime</div> <div>...</div><div><div>//phobos2 source dir</div><div>PHOBOS2_DIR:PATH=3D/= home/jaten/pkg/ldc2/ldc2/phobos</div><div><br></div></div></div><br>Good lu= ck!<br><br> </div></div></div> --0016e6567fb6f4a28e049df91a49--
Mar 08 2011