[Llvm-bgq-discuss] -std=c++11

Hal Finkel hfinkel at anl.gov
Sat Dec 22 18:11:28 CST 2012


Michael, et al.,

I have C++11 support working now using LLVM's libc++ implementation of the C++ standard library. Using the GNU implementation of the C++ standard library, which Clang does by default, won't work in C++11 mode. In order to tell Clang to use libc++ you'll need -stdlib=libc++ in addition to -std=c++11. For example:

/home/projects/llvm/bin/bgclang++ -std=c++11 -stdlib=libc++ -o /tmp/t -O3 /tmp/t.cxx

Please be aware that, in general, libc++ and libstdc++ objects are incompatible, and so if you'd like to use C++11 with your project, you should recompile and relink all C++ library dependencies using -std=c++11 -stdlib=libc++.

For those of you with your own builds, I've attached an updated Clang patch, bgclang wrapper script, and the script that I used to build libc++.

Happy holidays!

 -Hal

----- Original Message -----
> From: "Hal Finkel" <hfinkel at anl.gov>
> To: "Michael Blocksome" <blocksom at us.ibm.com>
> Cc: llvm-bgq-discuss at lists.alcf.anl.gov
> Sent: Friday, December 21, 2012 3:27:33 PM
> Subject: Re: [Llvm-bgq-discuss] -std=c++11
> 
> I think that the gcc libstdc++ 4.4.6 headers are too old for C++11
> support to really work well. I am planning to investigate providing
> an alternative, based either on libstdc++ 4.6.x or based on LLVM's
> libc++ project.
> 
>  -Hal
> 
> ----- Original Message -----
> > From: "Michael Blocksome" <blocksom at us.ibm.com>
> > To: llvm-bgq-discuss at lists.alcf.anl.gov
> > Sent: Friday, December 21, 2012 2:12:12 PM
> > Subject: [Llvm-bgq-discuss] -std=c++11
> > 
> > 
> > Has anyone had any luck compiling with '-std=c++11' ?
> > 
> > I get the following error with a simple testcase. This particular
> > error goes away if I remove the '-std=c++11' option.
> > 
> > .../test> cat vector_test.cc
> > 
> > #include <vector>
> > 
> > int main ()
> > {
> > std::vector<unsigned> foo;
> > 
> > return 0;
> > };
> > 
> > .../test> /bghome/blocksom/development/llvm/bgclang -v -std=c++11
> > vector_test.cc -o vector_test.cnk
> > clang version 3.3 (trunk 170436)
> > Target: powerpc64-bgq-linux
> > Thread model: posix
> > "/bghome/blocksom/development/llvm/install/bin/clang" -cc1 -triple
> > powerpc64-bgq-linux -S -disable-free -main-file-name vector_test.cc
> > -static-define -mrelocation-model static -mdisable-fp-elim
> > -fmath-errno -ffp-contract=fast -mconstructor-aliases -target-cpu
> > a2q -target-linker-version 2.20.51.0.2 -momit-leaf-frame-pointer -v
> > -resource-dir
> > /bghome/blocksom/development/llvm/install/bin/../lib/clang/3.3
> > -fmodule-cache-path /var/tmp/clang-module-cache -internal-isystem
> > /bgsys/drivers/ppcfloor/gnu-linux/lib/gcc/powerpc64-bgq-linux/4.4.6/../../../../powerpc64-bgq-linux/include/c++/4.4.6
> > -internal-isystem
> > /bgsys/drivers/ppcfloor/gnu-linux/lib/gcc/powerpc64-bgq-linux/4.4.6/../../../../powerpc64-bgq-linux/include/c++/4.4.6/powerpc64-bgq-linux
> > -internal-isystem
> > /bgsys/drivers/ppcfloor/gnu-linux/lib/gcc/powerpc64-bgq-linux/4.4.6/../../../../powerpc64-bgq-linux/include/c++/4.4.6/backward
> > -internal-isystem /usr/local/include -internal-isystem
> > /bghome/blocksom/development/llvm/install/bin/../lib/clang/3.3/include
> > -internal-externc-isystem /include -internal-externc-isystem
> > /usr/include -std=c++11 -fdeprecated-macro -fno-dwarf-directory-asm
> > -fdebug-compilation-dir
> > /bghome/blocksom/development/boost-pami/next/test -ferror-limit 19
> > -fmessage-length 231 -mstackrealign -fno-signed-char
> > -fobjc-runtime=gcc -fcxx-exceptions -fexceptions
> > -fdiagnostics-show-option -fcolor-diagnostics -isystem
> > /bgsys/drivers/ppcfloor/gnu-linux/powerpc64-bgq-linux/sys-include
> > -mllvm -enable-misched -mllvm -enable-aa-sched-mi -o
> > /tmp/vector_test-mdmziM.s -x c++ vector_test.cc
> > clang -cc1 version 3.3 based upon LLVM 3.3svn default target
> > powerpc64-unknown-linux-gnu
> > ignoring nonexistent directory "/include"
> > #include "..." search starts here:
> > #include <...> search starts here:
> > /bgsys/drivers/ppcfloor/gnu-linux/powerpc64-bgq-linux/sys-include
> > /bgsys/drivers/ppcfloor/gnu-linux/lib/gcc/powerpc64-bgq-linux/4.4.6/../../../../powerpc64-bgq-linux/include/c++/4.4.6
> > /bgsys/drivers/ppcfloor/gnu-linux/lib/gcc/powerpc64-bgq-linux/4.4.6/../../../../powerpc64-bgq-linux/include/c++/4.4.6/powerpc64-bgq-linux
> > /bgsys/drivers/ppcfloor/gnu-linux/lib/gcc/powerpc64-bgq-linux/4.4.6/../../../../powerpc64-bgq-linux/include/c++/4.4.6/backward
> > /usr/local/include
> > /bghome/blocksom/development/llvm/install/bin/../lib/clang/3.3/include
> > /usr/include
> > End of search list.
> > In file included from vector_test.cc:4:
> > In file included from
> > /bgsys/drivers/ppcfloor/gnu-linux/lib/gcc/powerpc64-bgq-linux/4.4.6/../../../../powerpc64-bgq-linux/include/c++/4.4.6/vector:61:
> > In file included from
> > /bgsys/drivers/ppcfloor/gnu-linux/lib/gcc/powerpc64-bgq-linux/4.4.6/../../../../powerpc64-bgq-linux/include/c++/4.4.6/bits/allocator.h:48:
> > In file included from
> > /bgsys/drivers/ppcfloor/gnu-linux/lib/gcc/powerpc64-bgq-linux/4.4.6/../../../../powerpc64-bgq-linux/include/c++/4.4.6/powerpc64-bgq-linux/bits/c++allocator.h:34:
> > In file included from
> > /bgsys/drivers/ppcfloor/gnu-linux/lib/gcc/powerpc64-bgq-linux/4.4.6/../../../../powerpc64-bgq-linux/include/c++/4.4.6/ext/new_allocator.h:33:
> > In file included from
> > /bgsys/drivers/ppcfloor/gnu-linux/lib/gcc/powerpc64-bgq-linux/4.4.6/../../../../powerpc64-bgq-linux/include/c++/4.4.6/new:40:
> > In file included from
> > /bgsys/drivers/ppcfloor/gnu-linux/lib/gcc/powerpc64-bgq-linux/4.4.6/../../../../powerpc64-bgq-linux/include/c++/4.4.6/exception:148:
> > /bgsys/drivers/ppcfloor/gnu-linux/lib/gcc/powerpc64-bgq-linux/4.4.6/../../../../powerpc64-bgq-linux/include/c++/4.4.6/exception_ptr.h:143:13:
> > error: unknown type name 'type_info'
> > const type_info*
> > ^
> > 1 error generated.
> > 
> > 
> > ====
> > 
> > Thanks,
> > 
> > Michael Blocksome
> > Blue Gene Messaging
> > blocksom at us.ibm.com
> > 
> > _______________________________________________
> > llvm-bgq-discuss mailing list
> > llvm-bgq-discuss at lists.alcf.anl.gov
> > https://lists.alcf.anl.gov/mailman/listinfo/llvm-bgq-discuss
> > 
> 
> --
> Hal Finkel
> Postdoctoral Appointee
> Leadership Computing Facility
> Argonne National Laboratory
> _______________________________________________
> llvm-bgq-discuss mailing list
> llvm-bgq-discuss at lists.alcf.anl.gov
> https://lists.alcf.anl.gov/mailman/listinfo/llvm-bgq-discuss
> 

-- 
Hal Finkel
Postdoctoral Appointee
Leadership Computing Facility
Argonne National Laboratory
-------------- next part --------------
A non-text attachment was scrubbed...
Name: clang-bgq-r170456-20121221-2.patch
Type: text/x-patch
Size: 73620 bytes
Desc: not available
URL: <http://lists.alcf.anl.gov/pipermail/llvm-bgq-discuss/attachments/20121222/fa8b008d/attachment-0003.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: bgclang-r170456-20121221-2
Type: application/x-shellscript
Size: 3251 bytes
Desc: not available
URL: <http://lists.alcf.anl.gov/pipermail/llvm-bgq-discuss/attachments/20121222/fa8b008d/attachment-0004.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: libcxx-trunk-build.sh
Type: application/x-shellscript
Size: 808 bytes
Desc: not available
URL: <http://lists.alcf.anl.gov/pipermail/llvm-bgq-discuss/attachments/20121222/fa8b008d/attachment-0005.bin>


More information about the llvm-bgq-discuss mailing list