[cfe-dev] Using C++11 in clang-tools-extra Round 2
Vane, Edwin
edwin.vane at intel.com
Tue Jan 8 05:21:37 PST 2013
It occurred to me that the clang I was building with was not itself c++11 enabled. So I did a full build of llvm/clang from trunk using these commands:
configure --enable-cpp11
make install -j4
Then I built the simple test case you had. Still no error. From looking around I see other people get the error with gcc 4.7 (http://stackoverflow.com/questions/10308167/when-enabling-c11-with-stdlibc-4-7-clang-error-out-while-gcc-compiles-fine) so maybe that's the problem here.
In any case, would it be a problem to build llvm/clang with c++11 enabled just for the libraries to link into the tools of tools-extra but do the actual build with a clang not built with -std=c++11?
-----Original Message-----
From: thakis at google.com [mailto:thakis at google.com] On Behalf Of Nico Weber
Sent: Monday, January 07, 2013 7:13 PM
To: Vane, Edwin
Subject: Re: [cfe-dev] Using C++11 in clang-tools-extra Round 2
On Mon, Jan 7, 2013 at 12:34 PM, Vane, Edwin <edwin.vane at intel.com> wrote:
> Nico wrote:
> libstdc++ is not part of tools-extra. But if you want to build C++11
> code with clang on linux, you need to use libc++ because clang can't
> parse libstd++ (the default c++ library) in c++11 mode. And if you use
> libc++, users now have to have libc++ to run the tools-extra binaries.
>
> [Edwin] I checked with coworkers here and they have built llvm/clang with c++11 support with libstd++ before. To qualify that, they use configure, specify --enable-cxx11, and build llvm/clang.
Sure, you can build clang itself, but building programs that use c++11 don't Just Work as far as I can tell:
thakis at yearofthelinuxdesktop:/usr/local/google/chrome/src$ cat test.cc #include <iostream>
int main() {}
thakis at yearofthelinuxdesktop:/usr/local/google/chrome/src$
third_party/llvm-build/Release+Asserts/bin/clang++ test.cc thakis at yearofthelinuxdesktop:/usr/local/google/chrome/src$
third_party/llvm-build/Release+Asserts/bin/clang++ test.cc -std=c++11 In file included from test.cc:1:
In file included from
/usr/lib/gcc/x86_64-linux-gnu/4.4/../../../../include/c++/4.4/iostream:39:
In file included from
/usr/lib/gcc/x86_64-linux-gnu/4.4/../../../../include/c++/4.4/ostream:39:
In file included from
/usr/lib/gcc/x86_64-linux-gnu/4.4/../../../../include/c++/4.4/ios:39:
In file included from
/usr/lib/gcc/x86_64-linux-gnu/4.4/../../../../include/c++/4.4/exception:148:
/usr/lib/gcc/x86_64-linux-gnu/4.4/../../../../include/c++/4.4/exception_ptr.h:143:13:
error: unknown type name
'type_info'
const type_info*
^
1 error generated.
> If libc++ really is necessary that can be an extra requirement. It's easy enough to check out and build oneself.
libc++ is probably a system-level shared library if it's installed
through a package manager. A self-built libc++ would probably clash with that. It's also not that easy to build, as it depends on a libcppsup and an unwind library, which too might clash with system libraries.
>
>>
>>>
>>> --
>>> Edwin Vane
>>> Software Developer
>>> Intel of Canada, Inc.
>>>
>>>
>>> _______________________________________________
>>> cfe-dev mailing list
>>> cfe-dev at cs.uiuc.edu
>>> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
More information about the cfe-dev
mailing list