[LLVMdev] include's are not being located

Jonathan Roelofs jonathan at codesourcery.com
Mon Jun 16 15:34:07 PDT 2014



On 6/16/14, 4:20 PM, Joseph wrote:
>
>
>
>> On Fri, Jun 13, 2014 at 06:06:24PM -0500, Joseph Morgan wrote:
>>> In other words what does " put '--std=c++11' in the CXXFLAGS” mean?
>>
>> Just for reference, the option is -std=c++11, single hyphen.
>>
>> Joerg
> ^^ As for the build of LLVM/Clang, I rebuilt with single hyphen as follows :
> /Users/josephmorgan/llvm/configure --enable-targets=x86,x86_64 CXX=`which
> clang++` CXXFLAGS="-std=c++11"
This ^ looks good to me.
>
>
>
> And now for the tutorial, somewhere along the line I have used two versions of
> the following when compiling the tutorial file:
>
> clang++ -g -O3 toy.cpp `llvm-config --*cxxflags* --ldflags --libs core` -o toy
> <—this is from http://llvm.org/docs/tutorial/LangImpl3.html see results below:
>
> Undefined symbols for architecture x86_64:
>    "_del_curterm", referenced from:
>        terminalHasColors(int) in libLLVMSupport.a(Process.o)
>    "_set_curterm", referenced from:
>        terminalHasColors(int) in libLLVMSupport.a(Process.o)
>    "_setupterm", referenced from:
>        terminalHasColors(int) in libLLVMSupport.a(Process.o)
>    "_tigetnum", referenced from:
>        terminalHasColors(int) in libLLVMSupport.a(Process.o)
> ld: symbol(s) not found for architecture x86_64
> clang: error: linker command failed with exit code 1 (use -v to see invocation)
>
>
>
> clang++ -g -O3 toy.cpp `llvm-config --*cppflags* --ldflags --libs core` -o toy
> <—not sure where in this thread I picked this up but see results below:

It will help with debugging this to see the output of all of these:

$ echo $PATH
$ pwd
$ find . -name clang++
$ find . -name llvm-config
$ which llvm-config
$ which clang++
$ llvm-config --*cppflags* --ldflags --libs core -v
$ clang++ -g -O3 toy.cpp `llvm-config --cxxflags --ldflags --libs core` -o toy -v

My suspicion is that this is picking the just-built llvm-config and the clang++ 
is the system provided one. I think you need to use full paths to make sure 
you're getting *both* of the just-built ones instead.


Jon
>
> In file included from toy.cpp:2:
> In file included from /usr/local/include/llvm/IR/DerivedTypes.h:21:
> In file included from /usr/local/include/llvm/IR/Type.h:19:
> In file included from /usr/local/include/llvm/ADT/APFloat.h:20:
> In file included from /usr/local/include/llvm/ADT/APInt.h:19:
> In file included from /usr/local/include/llvm/ADT/ArrayRef.h:14:
> */usr/local/include/llvm/ADT/SmallVector.h:232:20: **warning: **rvalue
> references are*
> *      a C++11 extension [-Wc++11-extensions]*
>    void push_back(T &&Elt) {
>
> …….Several other errors/warnings
>
> *fatal error: **too many errors emitted, stopping now [-ferror-limit=]*
> 72 warnings and 20 errors generated.
>
>
>
>
> I appreciate your help!
>
> Joseph Morgan
>
>
> On Jun 16, 2014, at 2:35 PM, Jonathan Roelofs <jonathan at codesourcery.com
> <mailto:jonathan at codesourcery.com>> wrote:
>
>>
>>
>> On 6/16/14, 1:14 PM, Dan Liew wrote:
>>> Hi Joseph,
>>>
>>>> In other words what does " put '--std=c++11' in the CXXFLAGS” mean? Do you
>>>> have an example of what it would look like? or what should I read in order
>>>> to learn this? I’m happy to read up but I don’t know where to start reading
>>>> (besides the getting started page on llvm)   :)
>>>
>>> You're still trying to build the tutorial right? I assume you
>>> successfully built LLVM already. So if you're building the tutorial
>>> you probably just need this.
>>>
>>> clang++ -g -O3 toy.cpp `llvm-config --cxxflags --ldflags --libs core` -o toy
>>>
>>> I see your `llvm-config --cxxflags`` output already has --std=c++11
>>> already in it (your --cppflags does not. I'm not sure why).
>> Dan, the preprocessor shouldn't need to know about '--std=c++11' right?
>>
>> Maybe the confusion here is over which one of '--cppflags' vs '--cxxflags' to
>> use where (the former is for the preprocessor, the latter is for the c++
>> compiler).
>>
>>
>> Also, looking at an example from earlier in the thread:
>>
>> ```
>> clang++ -g -O3 toy.cpp
>> `/Users/josephmorgan/build/Release+Assert/bin/llvm-config --cppflags
>> --ldflags --libs core` -o toy
>> ```
>>
>> This suspiciously looks like you're using the just-built llvm-config to give
>> parameters to the system installed clang++. IOW, this could lead you into
>> trouble if `which clang++` doesn't point you to the one in
>> /Users/josephmorgan/build/Release+Assert/bin/ (this really depends on what's
>> on your PATH).
>>
>>>
>>> I think Jonanthan may have confused you because his suggestion of
>>>
>>> ../llvm/configure CXX=`which clang++` CXXFLAGS="--std=c++11"
>>>
>>> is for configuring and building LLVM/Clang which you've already done.
>> Yes, this suggestion is for configuring/building clang... sorry if that added
>> to the confusion.
>>> So you shouldn't need to do that again.
>>>
>>> Thanks,
>>>
>>
>> Cheers,
>> Jon
>>
>> --
>> Jon Roelofs
>> jonathan at codesourcery.com <mailto:jonathan at codesourcery.com>
>> CodeSourcery / Mentor Embedded
>

-- 
Jon Roelofs
jonathan at codesourcery.com
CodeSourcery / Mentor Embedded



More information about the llvm-dev mailing list