This is the mail archive of the gcc-help@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]

Fwd: Locale problem / debugging libstdc++


Hi All,

I recently updated gcc to the newest version in debian unstable and
suddenly all c++ locale stopped working but the old-fashion c-api
still works.

OK
==
p = setlocale(LC_ALL, "en_US");
lc = localeconv();
std::cout << lc->decimal_point << std::endl;

NOT OK (throws runtime_error)
=======================
std::locale loc("en_US");
output: [[
  terminate called after throwing an instance of 'std::runtime_error'
    what():  locale::facet::_S_create_c_locale name not valid
  Aborted
]]

What am I doing wrong with my locales?

OBS: std::locale loc("C") is also ok.

System info
=========
The output of "locale -a" includes "en_US", it has been generated
using locale-gen, the gcc-4.1-locales, and gcc-4.2-locales packages
are both installed.

I have tried:
ii  g++-4.1                         4.1.2-12
The GNU C++ compiler
ii  g++-4.2                        4.2-20070609-1
The GNU C++ compiler
(for an output of g++ -v see (3) below)

They both give the same problem. For an output of "ldd" see (1) below.

The source code of my test application h1.cpp can be seen below (2).

Debugging libstdc++
===============
I have tried to debug the libstdc++ library, but gdb doesn't allow me
to step inside the libstdc++ library functions (ex. std::locale
constructor), im using:
       g++ -D_GLIBCXX_DEBUG -g -Wall h1.cpp -o h1
to compile my program.

The debug library has been installed.
ii  libstdc++6-4.1-dbg             4.1.2-12
The GNU Standard C++ Library v3 (debugging f

What is the correct way to compile my program to be able to debug
"inside" libstdc++, that is, not only the headers (then -g is enough)?

Thanks in advance!


Best regards, Jens

==========================================

---- (1) ----

ldd -v ./h1
       linux-gate.so.1 =>  (0xffffe000)
       libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0xb7e94000)
       libm.so.6 => /lib/libm.so.6 (0xb7e6d000)
       libgcc_s.so.1 => /lib/libgcc_s.so.1 (0xb7e62000)
       libc.so.6 => /lib/libc.so.6 (0xb7d1f000)
       /lib/ld-linux.so.2 (0xb7f88000)

       Version information:
       ./h1:
               libgcc_s.so.1 (GCC_3.0) => /lib/libgcc_s.so.1
                 libstdc++.so.6 (CXXABI_1.3) => /usr/lib/libstdc++.so.6
               libstdc++.so.6 (GLIBCXX_3.4) => /usr/lib/libstdc++.so.6
               libc.so.6 (GLIBC_2.0) => /lib/libc.so.6
                libc.so.6 (GLIBC_2.1.3) => /lib/libc.so.6
               libc.so.6 (GLIBC_2.2) => /lib/libc.so.6
       /usr/lib/libstdc++.so.6:
               ld-linux.so.2 (GLIBC_2.3) => /lib/ld-linux.so.2
               libgcc_s.so.1 (GLIBC_2.0) => /lib/libgcc_s.so.1
               libgcc_s.so.1 (GCC_3.3) => /lib/libgcc_s.so.1
               libgcc_s.so.1 (GCC_3.0) => /lib/libgcc_s.so.1
               libc.so.6 (GLIBC_2.3) => /lib/libc.so.6
               libc.so.6   (GLIBC_2.1) => /lib/libc.so.6
               libc.so.6 (GLIBC_2.1.3) => /lib/libc.so.6
               libc.so.6 (GLIBC_2.2) => /lib/libc.so.6
               libc.so.6 (GLIBC_2.0) => /lib/libc.so.6
       /lib/libm.so.6:
               ld-linux.so.2 (GLIBC_PRIVATE) => /lib/ld-linux.so.2
               libc.so.6 (GLIBC_2.1.3) => /lib/libc.so.6
               libc.so.6 (GLIBC_2.0) => /lib/libc.so.6
       /lib/libgcc_s.so.1:
               libc.so.6 (GLIBC_2.1.3) => /lib/libc.so.6
               libc.so.6 (GLIBC_2.2.4) => /lib/libc.so.6
               libc.so.6 (GLIBC_2.0) => /lib/libc.so.6
       /lib/libc.so.6:
               ld-linux.so.2 (GLIBC_PRIVATE) => /lib/ld-linux.so.2
               ld-linux.so.2 (GLIBC_2.3) => /lib/ld-linux.so.2
               ld-linux.so.2 (GLIBC_2.1) => /lib/ld- linux.so.2



---- (2) ----

#include <locale.h>
#include <locale>
#include <iostream>
int main(int argv, char **argc)
{

       char *p;
       lconv *lc;

// std::locale loc("en_US"); // fails

       p = setlocale(LC_ALL, "en_US");
       lc = localeconv();
       std::cout << lc->decimal_point << std::endl;

         return 0;
}


---- (3) ----- g++ -v Using built-in specs. Target: i486-linux-gnu Configured with: ../src/configure -v --enable-languages=c,c++,fortran,objc,obj-c++,treelang --prefix=/usr --enable-shared --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --enable-nls --with-gxx-include-dir=/usr/include/c++/4.1.3 --program-suffix=- 4.1 --enable-__cxa_atexit --enable-clocale=gnu --enable-libstdcxx-debug --enable-mpfr --with-tune=i686 --enable-checking=release i486-linux-gnu Thread model: posix gcc version 4.1.3 20070601 (prerelease) (Debian 4.1.2-12 )


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