This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ 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]

GCC 4.x Solaris locale support...


Hello,

I have searched the web, mailing lists, and http://gcc.gnu.org/bugzilla.
From what I can tell GCC was changed in version 3.4 to set the locale
support for libstdc++, for non-glibc OSs, to generic.  Here are articles
I found to that effect:

http://gcc.gnu.org/ml/libstdc++/2003-02/msg00345.html
http://gcc.gnu.org/ml/libstdc++/2003-09/msg00153.html

I have successfully built GCC 4.4.1, with binutils 2.17, on Solaris 8.
Here is my configuration information:

sunhost> gcc -v

Using built-in specs.
Target: sparc-sun-solaris2.8
Configured with: ../gcc-4.4.1/configure
--prefix=/my/dev/gcc/4.4.1-sunos58
--with-local-prefix=/my/sdk/gcc441-sunos58 --with-gnu-as --with-gnu-ld
--with-gnu-ar --with-gnu-nm --with-as=/my/bin/gas --with-ar=/my/bin/gar
--with-ld=/my/bin/gld --with-nm=/my/bin/gnm --enable-long-long
--enable-threads=posix --enable-bootstrap
Thread model: posix
gcc version 4.4.1 (GCC)

sunhost> uname -a
SunOS sunhost 5.8 Generic_117350-25 sun4u sparc SUNW,Ultra-80

The following simple program demonstrates the problem I'm experiencing
on Solaris with GCC:
 
#include <iostream>
#include <locale>

int main(int argc, char* argv[])
{
  try
  {
     std::ios::sync_with_stdio(false);
     std::locale loc(argc > 1 ? argv[1] : "");
     std::cout << loc.name() << std::endl;
  }
  catch (const std::exception& e)
  {
     std::cerr << e.what() << std::endl;
  }
}

If the above code is compiled with GCC 4.4.1 and run on Solaris 8 or
newer, with locale environment variables set to anything other than C,
or POSIX, the program throws the following exception:

locale::facet::_S_create_c_locale name not valid

According to the post mentioned at the beginning of this email this is
expected behavior.  But my environment needs the locale environment
variables set to something other than C, or POSIX.  Is there any way for
GCC 4.4.1 on Solaris 8 or newer to support locales other than C, or
POSIX?  This same program built with GCC 3.3.1, binutils 2.13.1, does
not throw an exception when locale environment variables other than C,
or POSIX are set, and lists the current locale environment variables as
expected.  I need a fix or workaround for this issue.  Any suggestions?

Thanks...

Todd


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