[LLVMdev] include's are not being located

Joseph its.jojo.77 at gmail.com
Wed Jun 11 16:01:03 PDT 2014


Hi Dan,

Thank you for you response. As you suspect,  I am struggling with the building of LLVM/Clang. 

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?

In reference to what you mentioned about installing/building and —prefix and my misuse of my build directory:

I am following instruction from the getting started page:
http://llvm.org/docs/GettingStarted.html#getting-started-quickly-a-summary
Here are exactly the steps I follow to download/build LLVM/Clang:
1. #llvm
cd /Users/josephmorgan 
svn co http://llvm.org/svn/llvm-project/llvm/trunk llvm

2. #clang
cd llvm/tools
svn co http://llvm.org/svn/llvm-project/cfe/trunk clang

3. #compiler rt
cd llvm/projects
svn co http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt

4. #Change Directory to build but not sure why I’m doing this (Make is building everything in here)
cd /Users/josephmorgan/build 

5. #configure (I am still not clear on what is purpose of prefix here)
/Users/josephmorgan/llvm/configure --prefix=/Users/josephmorgan/build --enable-targets=x86,x86_64

6. #make/build 
make


Attempts to build the following: 
clang++ -g -O3 toy.cpp `llvm-config --cppflags --ldflags --libs core` -o toy

Yields the following errors:
llvm-config: command not found
 toy.cpp:1:10: fatal error: 'llvm/Analysis/Verifier.h' file not found


Thank you for any advice you can offer.

Joseph



On Jun 11, 2014, at 4:58 PM, Dan Liew <dan at su-root.co.uk> wrote:

> Hi Joseph,
> 
> It's not entirely clear from your e-mail which part you are struggling
> with. You say you're having problems building the Kaleidoscope
> tutorial but your steps look like you're struggling building
> LLVM/Clang.
> 
> On 11 June 2014 20:44, Joseph Morgan <its.jojo.77 at gmail.com> wrote:
>> I’m new to llvm so I’m hoping someone can shed some light on this. I am
>> trying to use the Kaleidoscope tutorial and cannot get past the 3rd part.
>> All the llvm includes are not in their expected places. Eg…
>> “llvm/IR/Verifier.h” is actually in “llvm/include/llvm/IR”. I am running mac
>> osx 10.9.
> 
> Are you trying to build this [1]? I.e. When you do
> 
> ```
> $ clang++ -g -O3 toy.cpp `llvm-config --cppflags --ldflags --libs core` -o toy
> ```
> 
> If so you should make sure that the llvm-config command being executed
> here is the one you built (assuming that's what you want) rather than
> you system's one. Take a look at what llvm-config actually outputs.
> E.g. on my system I get
> 
> ```
> $ llvm-config --cppflags --ldflags --libs core
> -I/home/dan/dev/llvm/src/include -I/home/dan/dev/llvm/bin/include
> -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS
> -D__STDC_LIMIT_MACROS
> -L/home/dan/dev/llvm/bin/lib
> -lLLVMCore -lLLVMSupport
> ```
> 
> What you've described below sounds like you're struggling to build
> LLVM/Clang which is not what you said you were trying to do earlier
> (build the Kaleidoscope tutorial). Please clarify.
> 
> Assuming this is an attempt to build LLVM/Clang I can see a few mistakes here.
> 
>> Here’s what I’ve tried:
>> 1. checkout the svn of llvm, clang & compiler rt
>> 2. created a “build” directory & cd build
>> 3. …/llvm/configure --prefix=/HomeDir/build --enable-targets=x86,x86_64
> 
> I assume you mean ``..`` not ``...``
> 
> --prefix= is used to instruct the build system where to install
> LLVM/Clang. I might be misreading this because you have not said where
> you created the ``build`` directory but it looks like you've set
> --prefix to where you are building LLVM. I highly recommend you do not
> do that (it will make a mess if you ever run ``make install``). In
> your case if you are trying to build the Kaleidoscope tutorial you
> shouldn't even need to install LLVM/Clang.
> 
>> 4. make -I/HomeDir/llvm/include <—- I thought this would fix my problem but
> 
> I can see what you're trying to do but that's not how you pass flags
> to the C++ compiler for LLVM's build system (or for any other make
> file based build system for that matter).
> 
> It would be
> 
> $ make CXXFLAGS=" -I/HomeDir/llvm/include"
> 
> Even this not quite right because it will overwrite CXXFLAGS and does
> not append so it is likely this will break the build in some way. So I
> don't recommend doing this.
> 

It sounds like I was going in the wrong direction with CXXFLAGS in this case and it’s not needed.

> 
> [1] http://llvm.org/docs/tutorial/LangImpl3.html#full-code-listing
> 
> -- 
> Dan Liew
> PhD Student - Imperial College London

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20140611/0c72c972/attachment.html>


More information about the llvm-dev mailing list