The following code compiles and run find using my system's g++-4.1.3 but when compiled with g++-4.2.1 from SVN, I get terminate called after throwing an instance of 'std::runtime_error' what(): locale::facet::_S_create_c_locale name not valid Aborted //----------------- #include <clocale> #include <sstream> int main () { std::wostringstream os; os.imbue(std::locale("")); return 0; } //-----------------
The only possible explanation is that, at build time, the configury didn't find the required localedata (at least "de_DE") or other tests failed, and the generic (instead of gnu) locale model has been selected. In that case the runtime_error is expected. Can you check that?
umm... I don't know how to check for that. But I ran configure with --enable-clocale=gnu. I posted my build log at http://mathpost.asu.edu/~thanate/build.log I'll keep the build dir for a while in case you need some more log files.
See this line in the Log: > checking for C locale to use... generic That means the configure-time tests for the gnu locale model are not ok and the generic locale model is selected instead, as a fallback. Can you investigate whether the 'de_DE' localedata is installed on your system? It's necessary for those checks. In order to do that you can, for example, run a small C program that does 'setlocale(LC_ALL, "de_DE")': it must return a non-NULL pointer. On linux, you can invoke 'localedef --list-archive'. (note that on 4.2.1 vs earlier releases, even if you pass --enable-clocale=gnu explicitely, the system is checked for actual support of the locale model, it cannot be forced: that may explain the unexpected behavior on your side).
localedef --list-archive gave me only one line: en_US.utf8 I think that's how I set up my system, with only one locale. Now I'm not sure why should I have to have de_DE installed for locale("") to work. But if you want, I can install de_DE and try again and report back.
Ok, that is it. That locale must be installed because old glibcs had a bug which showed up clearly with "de_DE" and we must check against it. The docs explain that, anyway: http://gcc.gnu.org/onlinedocs/libstdc++/install.html
*** Bug 37673 has been marked as a duplicate of this bug. ***