On Tue, 2011-06-28 at 00:57 +0100, Jonathan Wakely wrote: > On 28 June 2011 00:31, Jonathan Wakely <jwakely.gcc@xxxxxxxxx> wrote: > > On 28 June 2011 00:04, eric wrote: > >> > >>> You need to configure gcc with --enable-clocale=gnu and reinstall it. > >>> > >>> That should be the default on GNU/Linux but apparently your system is > >>> missing something necessary to support named locales. > >> > >> so I do > >> ./configure --enable-clocale=gnu > > > > (You obviously didn't read the installation docs, you're not supposed > > to run ./configure in the source directory) > > > > Did it actually enable the gnu locale model? You might need to check > > $TARGET/libstdc++-v3/config.log or compare which header files are > > installed. Noone can tell if you have the GNU locale model installed > > successfully. > > > > Or why don't you just install gcc from Ubuntu's package manager? > > Surely GCC 4.5 is available? > > > Actually you probably do have the GNU locale code installed, I missed > that you can get the same error from the GNU model: > > void > locale::facet::_S_create_c_locale(__c_locale& __cloc, const char* __s, > __c_locale __old) > { > __cloc = __newlocale(1 << LC_ALL, __s, __old); > if (!__cloc) > { > // This named locale is not supported by the underlying OS. > __throw_runtime_error(__N("locale::facet::_S_create_c_locale " > "name not valid")); > } > } > > So the problem must be with your glibc setup. > > Is en_US.utf8 listed in /etc/locale.gen? Any other locales? > Uncomment the ones you want to support, then try running > /usr/sbin/locale-gen as root > (I don't know if that's the right way to generate locale data for > Ubuntu, you might want to ask on an Ubuntu forum) > > I've just tried it on a Debian box which only has en_US.utf8 locale > data installed, and Axel's test program worked ok and running "./a.out > en_US.utf8" wrote to the file unicode.txt, so the problem is not with > the code or gcc. ---------------------------- my system don't have /etc/locale.gen but it have /etc/locale.alias --------- root@eric-laptop:/# cat /etc/locale.alias # Locale name alias data base. # Copyright (C) 1996-2001,2003,2007 Free Software Foundation, Inc. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # The format of this file is the same as for the corresponding file of # the X Window System, which normally can be found in # /usr/lib/X11/locale/locale.alias # A single line contains two fields: an alias and a substitution value. # All entries are case independent. # Note: This file is obsolete and is kept around for the time being for # backward compatibility. Nobody should rely on the names defined here. # Locales should always be specified by their full name. bokmal nb_NO.ISO-8859-1 bokm�l nb_NO.ISO-8859-1 catalan ca_ES.ISO-8859-1 croatian hr_HR.ISO-8859-2 czech cs_CZ.ISO-8859-2 danish da_DK.ISO-8859-1 dansk da_DK.ISO-8859-1 deutsch de_DE.ISO-8859-1 dutch nl_NL.ISO-8859-1 eesti et_EE.ISO-8859-1 estonian et_EE.ISO-8859-1 finnish fi_FI.ISO-8859-1 fran�ais fr_FR.ISO-8859-1 french fr_FR.ISO-8859-1 galego gl_ES.ISO-8859-1 galician gl_ES.ISO-8859-1 german de_DE.ISO-8859-1 greek el_GR.ISO-8859-7 hebrew he_IL.ISO-8859-8 hrvatski hr_HR.ISO-8859-2 hungarian hu_HU.ISO-8859-2 icelandic is_IS.ISO-8859-1 italian it_IT.ISO-8859-1 japanese ja_JP.eucJP japanese.euc ja_JP.eucJP ja_JP ja_JP.eucJP ja_JP.ujis ja_JP.eucJP japanese.sjis ja_JP.SJIS korean ko_KR.eucKR korean.euc ko_KR.eucKR ko_KR ko_KR.eucKR lithuanian lt_LT.ISO-8859-13 no_NO nb_NO.ISO-8859-1 no_NO.ISO-8859-1 nb_NO.ISO-8859-1 norwegian nb_NO.ISO-8859-1 nynorsk nn_NO.ISO-8859-1 polish pl_PL.ISO-8859-2 portuguese pt_PT.ISO-8859-1 romanian ro_RO.ISO-8859-2 russian ru_RU.ISO-8859-5 slovak sk_SK.ISO-8859-2 slovene sl_SI.ISO-8859-2 slovenian sl_SI.ISO-8859-2 spanish es_ES.ISO-8859-1 swedish sv_SE.ISO-8859-1 thai th_TH.TIS-620 turkish tr_TR.ISO-8859-9 root@eric-laptop:/# ------------------------------------------- it seem don't have en_US.utf8 need experienced suggestion again and thanks a lot in advance, Eric