std::locale on Freebsd 9.1

Sam Varshavchik mrsam@courier-mta.com
Wed Jul 17 01:31:00 GMT 2013


Jonathan Wakely writes:

> On 17 July 2013 00:09, Sam Varshavchik wrote:
> > Constructing a std::locale("en_US.UTF-8") throws a std::runtime error on
> > FreeBSD 9.1, with g++ 4.9
> >
> > I thought that locale support was not available in 9.0 and earlier because
> > it lacked xlocale. But, from what I can see, FreeBSD 9.1 has xlocale.h
> >
> > Is something else is still missing, or is there something wrong with the  
> gcc
> > 4.9 port, on FreeBSD?
>
> Does the libstdc++ configure script show something like this?
> Checking for C locale to use... darwin or freebsd
>
> If not xlocale.h won't be used.

Yup. That's what comes out.

> Even if it's used I'm not sure how well named locales work with the
> darwin model, I think they fail even on Mac OS X for anything except
> "C" and "POSIX", so maybe the same is true of FreeBSD. The closest
> thing I have to a reference for that is Bug ID# 13969869 for
> http://bugreport.apple.com but I can't see that report myself.

Looking around FreeBSD's man pages, all the moving pieces seem to be in  
order. There's a locale_t. There's uselocale, duplocale, freelocale,  
newlocale. There's an xlocale(3) man page.

I haven't banged on xlocale support in FreeBSD 9.1, have no idea how solid  
it is. It's entirely possible that it's missing chunks of functionality, but  
a casual observation suggests that the API, itself, is complete.

Looking at configure, the locale setting is mapped straight from the  
platform, rather than heuristically probed, but there appears to be an -- 
enable-clocale that, from the looks of it, can be used to force a particular  
locale implementation. So, I'll play with --enable-clocale=gnu, see how far  
I get.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/libstdc++/attachments/20130717/4a6f80d0/attachment.sig>


More information about the Libstdc++ mailing list