This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
GCC with Solaris -- using std::locale crashes
- From: JonathonS <thejunkjon at gmail dot com>
- To: gcc at gcc dot gnu dot org
- Date: Sat, 25 Aug 2012 16:29:03 -0700
- Subject: GCC with Solaris -- using std::locale crashes
Hi,
I am currently using GCC 4.4.4 on my Solaris machine and I am having a
difficult time getting it to compile with "locale-support".
For example, if I build the simple file:
#include <iostream>
int main()
{
std::cout.imbue(std::locale("en_US.UTF-8"));
return 0;
}
and run it, it will throw a runtime exception -- "std::runtime_error:
locale::facet::_S_create_c_locale name not valid"
I've stepped through the GCC code and I notice that there is code in
c++locale.cc (libstdc++v3 folder) that looks something like this:
If (locale being used is NOT “C” and NOT “POSIX”)
{
throw std::runtime_error(“locale::facet::_S_create name not valid”);
}
So, I am guessing that the problem here, is that GCC is not build with
"locale-support" and therefore, I am only allowed to use "C" and
"POSIX" locales. Is this correct? Also, I am guessing if that if I
rebuild GCC to support locales, that I can use locales other than "C"
or "POSIX" on Solaris.
I tried rebuilding GCC 4.4.4 with the flag "--enable-clocale=gnu" and
it still crashed in the same location. I also tried building GCC with
the flag "--enable-clocale=ieee_1003.1-2001", and this time, it didn't
even build.
So, I was wondering if there is something that I haven't tried that
someone can suggest? I'd like to build GCC so that I can use UTF-8
locales.
Thanks,
J