[LLVMdev] include's are not being located

Jonathan Roelofs jonathan at codesourcery.com
Sat Jun 14 09:59:22 PDT 2014



On 6/13/14, 5:06 PM, Joseph Morgan wrote:
>
> On Jun 12, 2014, at 4:37 PM, Jonathan Roelofs <jonathan at codesourcery.com
> <mailto:jonathan at codesourcery.com>> wrote:
>
>>
>>
>> On 6/12/14, 3:07 PM, Joseph wrote:
>>> Hi Dan,
>>>
>>>
>>> So now that the includes are being found building the tutorial results in 74
>>> warnings and 20 errors. Heres a couple examples:
>>>
>>> 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) {
>>>                    ^
>>> /usr/local/include/llvm/ADT/SmallVector.h:476:33: warning: rvalue references
>>> are a C++11 extension [-Wc++11-extensions]
>>>   iterator insert(iterator I, T &&Elt) {
>>>
>> You need to build Clang/LLVM with a {CXX, CXXFLAGS} pair (read: a c++ compiler
>> for your host) that supports C++11. That can either be one whose default is
>> c++11, or one that doesn't but lets you put '--std=c++11' in the CXXFLAGS.
>>
>> http://llvm.org/docs/GettingStarted.html suggests GCC >= 4.7.0 for this.
>
> Hello again,
>
> Running gcc —version gets me the following results:
>
> Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr
> --with-gxx-include-dir=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/c++/4.2.1
> Apple LLVM version 5.0 (clang-500.2.79) (based on LLVM 3.3svn)
>
> So it looks like I do not have proper GCC installed, I figured that Xcode would
> have gcc included.
These days, Xcode ships with Clang (which is a drop-in replacement for GCC, 
based on LLVM). This should be fine for building TOT Clang/LLVM from source, as 
long as it is new enough (and I *think* it is).
>
> I can see that I am in over my head because I do not know what CXX, CXXFLAGS are
> and where do you apply them? In make?
These are just canonical names for set of flags you pass to a build system (see: 
http://www.gnu.org/software/make/manual/html_node/Implicit-Variables.html#Implicit-Variables 
for more examples).

The idea is that you would set the ones that you need when configuring (where 
the default doesn't quite make sense for your platform)... so I think in your 
case, you'd want something like this:

../llvm/configure CXX=`which clang++` CXXFLAGS="--std=c++11"


Cheers,

Jon
>
> 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)   :)
>
> Thank you for your suggestions!
> Joseph Morgan
>
>

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



More information about the llvm-dev mailing list