This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: GCC with Solaris -- using std::locale crashes


On 26 August 2012 00:29, JonathonS wrote:
> 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".

Your question is not appropriate for this mailing list, which is about
development of GCC. For help using GCC please use the gcc-help mailing
list, thanks.

> 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

That won't work on Solaris.

> 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.

Please check if it's the same as an existing report in
http://gcc.gnu.org/bugzilla and open a new bug i not.

> 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.

The "gnu" model is the only one that is complete.  The
"ieee_1003.1-2001" model should work on Solaris, but does have some
issues.

If I ever find time I intend to work on the locale code to use the
POSIX 2008 xlocale features, which would provide the same
functionality as the "gnu" model but on more platforms than just
GNU/Linux.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]