missing some c++11 support for clang in FreeBSD

Matthias Andree mandree at FreeBSD.org
Tue May 14 07:01:31 UTC 2013


Am 14.05.2013 02:35, schrieb Alexander K. Beros:
> 
> I have just started using clang (on FreeBSD 9.1 AMD64) and encountered a
> couple problems.  I have worked around these points, but in case they
> represent something unintentional (as opposed to some error on my part while
> building from the port) I would like to mention them.  I am using
> 
> FreeBSD clang version 3.1 (branches/release_31 156863) 20120523
> Target: x86_64-unknown-freebsd9.0
> Thread model: posix

Alexander,

This version 3.1 of clang did not claim full C++11 support, neither does
FreeBSD 9.X at this point.

Full C++11 support is targeted at FreeBSD 10 according to the site below.

> A key element in solving both problems was the installation of gcc47.  That
> was unexpected since I initially installed clang under the assumption that
> FBSD is moving from gcc to clang and since gcc42 doesn't support c++11.

GCC 4.7 is not GCC 4.2, and GCC 4.7 or 4.8 do not claim full C++11
compliance either; additionally, GCC 4.7 and 4.8 label their C++11
support "experimental".

> 1.. 
> Symptom:
> 
> 	%>  clang++ -std=c++11 -stdlib=libstdc++ refparms.c++
> 	initListTest.cpp:43:10: fatal error: 'initializer_list' file not
> found
> 	#include <initializer_list>

You are mixing clang with the GNU libstdc++.

libc++ ships with initializer_list, but on my
upgraded-through-many-releases 9.1 amd64, this header does not get
installed.

See <https://wiki.freebsd.org/NewC%2B%2BStack>, apparently, you need to
make system configuration changes and recompile parts of it.

David, is the wiki page up to date WRT FreeBSD 9.1?

> 2.
> Symptom:
> 	/usr/lib/libstdc++.so.6: version GLIBCXX_3.4.14 required by
> /usr/home/../binaries/a.out  not found
> 
> Solution:
> 	I added the following line to /etc/libmap.conf
> 	libstdc++.so.6  gcc47/libstdc++.so.6

Again, this is using GNU's libstdc++, not clang's. See above.

HTH



More information about the freebsd-toolchain mailing list