Re: libstdc++ localization aborts with an exception
Marian Asokarajan wrote: And probably the "darwin" (or "generic") model is used, instead of "gnu" (s.a. line 5801 in file /usr/src/contrib/libstdc++/configure). If it is so, why doesn't the "gnu" model apply to FreeBSD ? I posted the same question to the libstdc++ mailing list and benjamin kindly answered my question and he suggested the following: BK> It looks like it has something to do with ctype, and nothing to do with BK> named locales. BK> Named locales only work on GNU systems, or with systems that implement BK> the new POSIX locale model (newlocale/duplocale/strcoll_l, etc). From BK> what I understand, neither FreeBSD 7 nor Darwin meet these requirements. So, is his suggestion right ? -- Sashi Asokarajan ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "[EMAIL PROTECTED]"
libstdc++ localization aborts with an exception
Hello, if I try to instantiate the standard C++ class std::locale for locales other than "C", it aborts with an exception in FreeBSD 7-R. I suppose it has something to do with, how libstdc++ is build under fBSD. There is an option for libstdc++ called --enable-clocale[=MODEL] use MODEL for target locale package [default=auto] these MODELs are located in the base system source directory /usr/src/contrib/libstdc++/config/locale/ And probably the "darwin" (or "generic") model is used, instead of "gnu" (s.a. line 5801 in file /usr/src/contrib/libstdc++/configure). If it is so, why doesn't the "gnu" model apply to FreeBSD ? gcc -v reports: Using built-in specs. Target: i386-undermydesk-freebsd Configured with: FreeBSD/i386 system compiler Thread model: posix gcc version 4.2.1 20070719 [FreeBSD] on my FreeBSD 7.0-RELEASE system. My $LANG is set to de_DE.UTF-8 (via login.conf). locale -a|grep de_DE reports: de_DE.ISO8859-1 de_DE.ISO8859-15 de_DE.UTF-8 Here's a C++ code you may want to try (compile with CC ). It works well with "setenv LANG C", but fails if LANG=de_DE.UTF-8 (or any other) ! //--- #include #include #include int main() { using std::cout; using std::endl; // C L10n const char* const lstr = std::setlocale(LC_ALL, ""); cout << "C setlocale()\nresult="; cout << ( lstr ? lstr : "0" ) << "\n" << endl; // C++ L10n cout << "C++ std::locale" << endl; std::locale loc(""); cout << "std::locale loc=" << loc.name() << endl; } //--- Output (set $LANG to de_DE.UTF-8 and run with ./a.out): --- C setlocale() result=de_DE.UTF-8 C++ std::locale terminate called after throwing an instance of 'std::runtime_error' what(): locale::facet::_S_create_c_locale name not valid Abort (core dumped) --- Thanks in advance for any ideas. Marian ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "[EMAIL PROTECTED]"