<html><head><meta http-equiv="Content-Type" content="text/html charset=windows-1252"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">Hi Dan,<div><br></div><div>Thank you for you response. As you suspect,  I am struggling with the building of LLVM/Clang. </div><div><br></div><div>I thought building LLVM/Clang was required in order to build the tutorial and eventually modify for testing/learning. From what you are saying, it sounds like I am mistaken?</div><div><br></div><div>In reference to what you mentioned about installing/building and —prefix and my misuse of my build directory:</div><div><br></div><div>I am following instruction from the getting started page:</div><div><a href="http://llvm.org/docs/GettingStarted.html#getting-started-quickly-a-summary">http://llvm.org/docs/GettingStarted.html#getting-started-quickly-a-summary</a></div><div><ul style="list-style-type: circle"><ul style="list-style-type: square">
</ul>
</ul></div><div>Here are exactly the steps I follow to download/build LLVM/Clang:</div><div><div>1. #llvm</div><div>cd /Users/josephmorgan </div><div>svn co <a href="http://llvm.org/svn/llvm-project/llvm/trunk">http://llvm.org/svn/llvm-project/llvm/trunk</a> llvm</div><div><br></div><div>2. #clang</div><div>cd llvm/tools</div><div>svn co <a href="http://llvm.org/svn/llvm-project/cfe/trunk">http://llvm.org/svn/llvm-project/cfe/trunk</a> clang</div><div><br></div><div>3. #compiler rt</div><div>cd llvm/projects</div><div>svn co <a href="http://llvm.org/svn/llvm-project/compiler-rt/trunk">http://llvm.org/svn/llvm-project/compiler-rt/trunk</a> compiler-rt</div><div><br></div><div>4. #Change Directory to build but not sure why I’m doing this (Make is building everything in here)</div><div>cd /Users/josephmorgan/build </div><div><br></div><div>5. #configure (I am still not clear on what is purpose of prefix here)</div><div>/Users/josephmorgan/llvm/configure --prefix=/Users/josephmorgan/build --enable-targets=x86,x86_64</div><div><br></div><div>6. #make/build </div><div>make</div></div><div><br></div><div><br></div><div>Attempts to build the following: </div><div>clang++ -g -O3 toy.cpp `llvm-config --cppflags --ldflags --libs core` -o toy</div><div><br></div><div>Yields the following errors:</div><div><div style="margin: 0px; font-size: 11px; font-family: Menlo;">llvm-config: command not found</div></div><div> <b style="font-family: Menlo; font-size: 11px;">toy.cpp:1:10: </b><span style="font-family: Menlo; font-size: 11px; color: rgb(195, 55, 32);"><b>fatal error: </b></span><b style="font-family: Menlo; font-size: 11px;">'llvm/Analysis/Verifier.h' file not found</b></div><div><div style="margin: 0px; font-size: 11px; font-family: Menlo;"><br></div></div><div style="margin: 0px; font-size: 11px; font-family: Menlo;"><br></div><div style="margin: 0px; font-size: 11px; font-family: Menlo;">Thank you for any advice you can offer.</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;"><br></div><div style="margin: 0px; font-size: 11px; font-family: Menlo;">Joseph</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;"><br></div><div style="margin: 0px; font-size: 11px; font-family: Menlo;"><br></div><div style="margin: 0px; font-size: 11px; font-family: Menlo;"><br></div><div><div><div>On Jun 11, 2014, at 4:58 PM, Dan Liew <<a href="mailto:dan@su-root.co.uk">dan@su-root.co.uk</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite">Hi Joseph,<br><br>It's not entirely clear from your e-mail which part you are struggling<br>with. You say you're having problems building the Kaleidoscope<br>tutorial but your steps look like you're struggling building<br>LLVM/Clang.<br><br>On 11 June 2014 20:44, Joseph Morgan <<a href="mailto:its.jojo.77@gmail.com">its.jojo.77@gmail.com</a>> wrote:<br><blockquote type="cite">I’m new to llvm so I’m hoping someone can shed some light on this. I am<br>trying to use the Kaleidoscope tutorial and cannot get past the 3rd part.<br>All the llvm includes are not in their expected places. Eg…<br>“llvm/IR/Verifier.h” is actually in “llvm/include/llvm/IR”. I am running mac<br>osx 10.9.<br></blockquote><br>Are you trying to build this [1]? I.e. When you do<br><br>```<br>$ clang++ -g -O3 toy.cpp `llvm-config --cppflags --ldflags --libs core` -o toy<br>```<br><br>If so you should make sure that the llvm-config command being executed<br>here is the one you built (assuming that's what you want) rather than<br>you system's one. Take a look at what llvm-config actually outputs.<br>E.g. on my system I get<br><br>```<br>$ llvm-config --cppflags --ldflags --libs core<br>-I/home/dan/dev/llvm/src/include -I/home/dan/dev/llvm/bin/include<br>-D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS<br>-D__STDC_LIMIT_MACROS<br>-L/home/dan/dev/llvm/bin/lib<br>-lLLVMCore -lLLVMSupport<br>```<br><br>What you've described below sounds like you're struggling to build<br>LLVM/Clang which is not what you said you were trying to do earlier<br>(build the Kaleidoscope tutorial). Please clarify.<br><br>Assuming this is an attempt to build LLVM/Clang I can see a few mistakes here.<br><br><blockquote type="cite">Here’s what I’ve tried:<br>1. checkout the svn of llvm, clang & compiler rt<br>2. created a “build” directory & cd build<br>3. …/llvm/configure --prefix=/HomeDir/build --enable-targets=x86,x86_64<br></blockquote><br>I assume you mean ``..`` not ``...``<br><br>--prefix= is used to instruct the build system where to install<br>LLVM/Clang. I might be misreading this because you have not said where<br>you created the ``build`` directory but it looks like you've set<br>--prefix to where you are building LLVM. I highly recommend you do not<br>do that (it will make a mess if you ever run ``make install``). In<br>your case if you are trying to build the Kaleidoscope tutorial you<br>shouldn't even need to install LLVM/Clang.<br><br><blockquote type="cite">4. make -I/HomeDir/llvm/include <—- I thought this would fix my problem but<br></blockquote><br>I can see what you're trying to do but that's not how you pass flags<br>to the C++ compiler for LLVM's build system (or for any other make<br>file based build system for that matter).<br><br>It would be<br><br>$ make CXXFLAGS=" -I/HomeDir/llvm/include"<br><br>Even this not quite right because it will overwrite CXXFLAGS and does<br>not append so it is likely this will break the build in some way. So I<br>don't recommend doing this.<br><br></blockquote><div><br></div><div>It sounds like I was going in the wrong direction with CXXFLAGS in this case and it’s not needed.</div><br><blockquote type="cite"><br>[1] <a href="http://llvm.org/docs/tutorial/LangImpl3.html#full-code-listing">http://llvm.org/docs/tutorial/LangImpl3.html#full-code-listing</a><br><br>-- <br>Dan Liew<br>PhD Student - Imperial College London<br></blockquote></div><br></div></body></html>