On Jun 12, 2014, at 4:37 PM, Jonathan Roelofs <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. 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? 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 -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20140613/90b83d6b/attachment.html>
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
On Jun 14, 2014, at 11:59 AM, Jonathan Roelofs <jonathan at codesourcery.com> wrote:> > > 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”Thanks Jon for your advice. I am still getting the same errors. When I check the cxxflags here’s the output: Josephs-iMac:~ josephmorgan$ /Users/josephmorgan/build/Debug+Asserts/bin/llvm-config —cxxflags -I/Users/josephmorgan/llvm/include -I/Users/josephmorgan/build/include -D_DEBUG -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -g -std=c++11 -fvisibility-inlines-hidden -fno-exceptions -fno-rtti -fno-common -Woverloaded-virtual -Wcast-qual Josephs-iMac:~ josephmorgan$ /Users/josephmorgan/build/Debug+Asserts/bin/llvm-config --cppflags -I/Users/josephmorgan/llvm/include -I/Users/josephmorgan/build/include -D_DEBUG -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS Josephs-iMac:~ josephmorgan$ /Users/josephmorgan/build/Debug+Asserts/bin/llvm-config --cflags -I/Users/josephmorgan/llvm/include -I/Users/josephmorgan/build/include -D_DEBUG -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -g -fno-common Does that look correct in your opinion? Thanks again! Joseph> > 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-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20140616/9ceeec61/attachment.html>
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). 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. So you shouldn't need to do that again. Thanks, -- Dan Liew PhD Student - Imperial College London
Hi Dan, Thank for your response. I have build llvm/clang successfully (meaning it builds without failing). I keep going back to the build though because I somehow think it’s not properly configured. When I run the following as you suggest: clang++ -g -O3 toy.cpp `llvm-config --cxxflags --ldflags --libs core` -o toy But I continue to get errors as if I am missing C++11:> 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) {On Jun 16, 2014, at 2:14 PM, Dan Liew <dan at su-root.co.uk> 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).^^^ I am wondering if perhaps this is my problem?> > 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. > So you shouldn't need to do that again. > > Thanks, > -- > Dan Liew > PhD Student - Imperial College London
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 CodeSourcery / Mentor Embedded