From owner-freebsd-stable@FreeBSD.ORG Sun Apr 27 09:56:34 2008 Return-Path: Delivered-To: freebsd-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4CCA71065672 for ; Sun, 27 Apr 2008 09:56:34 +0000 (UTC) (envelope-from sashi@gmx.de) Received: from mail.gmx.net (mail.gmx.net [213.165.64.20]) by mx1.freebsd.org (Postfix) with SMTP id B32258FC14 for ; Sun, 27 Apr 2008 09:56:33 +0000 (UTC) (envelope-from sashi@gmx.de) Received: (qmail invoked by alias); 27 Apr 2008 09:29:51 -0000 Received: from e180219142.adsl.alicedsl.de (EHLO [49.1.1.104]) [85.180.219.142] by mail.gmx.net (mp021) with SMTP; 27 Apr 2008 11:29:51 +0200 X-Authenticated: #546547 X-Provags-ID: V01U2FsdGVkX1+63qZg+sO68l6sW2jx3QJF6cyaXgyD7z0UNsl9qx 8mJXSI+S3HDFb9 Message-ID: <48144854.1070705@gmx.de> Date: Sun, 27 Apr 2008 11:33:08 +0200 From: Marian Asokarajan User-Agent: Thunderbird 2.0.0.9 (X11/20080213) MIME-Version: 1.0 To: freebsd-stable@freebsd.org Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Y-GMX-Trusted: 0 Subject: libstdc++ localization aborts with an exception X-BeenThere: freebsd-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Production branch of FreeBSD source code List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 27 Apr 2008 09:56:34 -0000 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