Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 51430 - libstdc++ locales not working because of ebuild options
Summary: libstdc++ locales not working because of ebuild options
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] GCC Porting (show other bugs)
Hardware: All Linux
: High major (vote)
Assignee: Gentoo Toolchain Maintainers
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-05-18 16:00 UTC by Bryan Forbes
Modified: 2004-05-20 02:45 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments
Test case (main.cc,108 bytes, text/plain)
2004-05-18 16:02 UTC, Bryan Forbes
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Bryan Forbes 2004-05-18 16:00:38 UTC
After filing bugs for gcc and glibc (on their respective bugzilla's) and finding out that this is not a problem with either of them, I took a look at what exactly the ebuild is doing that would make std::locale(""); not work.  I found that the ebuild uses --enable-clocale=generic, so I looked in gcc-3.4.0/libstdc++-v3/config/locale/generic/c_locale.cc at line 148 (the method that is throwing the exception) and found this:

  void
  locale::facet::_S_create_c_locale(__c_locale& __cloc, const char* __s, 
				    __c_locale)
  {
    // Currently, the generic model only supports the "C" locale.
    // See http://gcc.gnu.org/ml/libstdc++/2003-02/msg00345.html
    __cloc = NULL;
    if (strcmp(__s, "C"))
      __throw_runtime_error(__N("locale::facet::_S_create_c_locale "
			    "name not valid"));
  }

As you can see, the only locale that is valid in the generic model is the "C" locale.  This is unacceptable since it breaks localization in any C++ code that uses it (most gtkmm/gnomemm programs use it, for example).  I propose that we switch to using --enable-locale=glibc (the glibc code works fine) until we get a use flag for this, since not having locales in c++ code is unacceptable.

Reproducible: Always
Steps to Reproduce:
Comment 1 Bryan Forbes 2004-05-18 16:02:39 UTC
Created attachment 31688 [details]
Test case

This test case compiles fine with gcc-3.4.0 from portage, but when this is run,
it will throw an exception because only "C" is accepted in std::locale()'s
argument list with --enable-clocale=generic in the configure options of gcc.
Comment 2 Travis Tilley (RETIRED) gentoo-dev 2004-05-18 18:17:18 UTC
i think i would rather let configure decide for itself so that it doesnt interfere with the embedded devs using uclibc. does this work for you when you remove --enable-clocale completely?
Comment 3 Bryan Forbes 2004-05-19 10:49:56 UTC
That works just fine.  I now agree that we should allow configure to handle this.
Comment 4 Travis Tilley (RETIRED) gentoo-dev 2004-05-20 02:45:14 UTC
gcc-3.4.0-r4 should be fixed... re-open this bug if it is not