boost serialization compilation and WCHAR
Hi all - I'm running into problems building the serialization library with gcc 4.1. I tracked it down to a change in libstdc++ for gcc 4.1 from the gcc 3.x libstdc++. I'm sure there's a bug, but I'm not sure if it is a boost bug, a libstdc++ bug, or a gcc 4.1 bug. boost_1_33_1/boost/config/stdlib/libstdcpp3.hpp says: #if !defined(_GLIBCPP_USE_WCHAR_T) && !defined(_GLIBCXX_USE_WCHAR_T) # define BOOST_NO_CWCHAR # define BOOST_NO_CWCTYPE # define BOOST_NO_STD_WSTRING # define BOOST_NO_STD_WSTREAMBUF #endif and indeed, with the 4.1 compiler, neither define is defined. For 4.1 in file /usr/lib/gcc/i686-pc-linux-gnu/4.1.0/include/g++-v4/i686-pc-linux-gnu/c++config.h I have /* Defined if vfwscanf exists. */ #define _GLIBCXX_HAVE_VFWSCANF 1 /* Defined if vswscanf exists. */ #define _GLIBCXX_HAVE_VSWSCANF 1 /* Defined if vwscanf exists. */ #define _GLIBCXX_HAVE_VWSCANF 1 /* Define to 1 if you have the <wchar.h> header file. */ #define _GLIBCXX_HAVE_WCHAR_H 1 /* Defined if wcstof exists. */ #define _GLIBCXX_HAVE_WCSTOF 1 /* Define to 1 if you have the <wctype.h> header file. */ #define _GLIBCXX_HAVE_WCTYPE_H 1 (no reference to USE_WCHAR_T) and in /usr/lib/gcc/i686-pc-linux-gnu/3.4.5/include/g++-v3/i686-pc-linux-gnu/bits/c++config.h I have // Define if code specialized for wchar_t should be used. #define _GLIBCXX_USE_WCHAR_T 1 my fix would be one of three things: 1) in c++config.h #define _GLIBCXX_USE_WCHAR_T 2) in libstdcpp3.hpp add a test for _GLIBCXX_HAVE_WCHAR_H: #if !defined(_GLIBCPP_USE_WCHAR_T) && !defined(_GLIBCXX_USE_WCHAR_T) && !defined(_GLIBCXX_HAVE_WCHAR_H) # define BOOST_NO_CWCHAR # define BOOST_NO_CWCTYPE # define BOOST_NO_STD_WSTRING # define BOOST_NO_STD_WSTREAMBUF #endif 3) somewhere else #ifdef _GLIBCXX_HAVE_WCHAR_H #define _GLIBCXX_USE_WCHAR_T #endif What do you guys think? Brian
Oops, looks like I spoke too soon. I just tried solution (1) below, and although now boost compiles the serialization library, when I compile something using boost, I can't link against several symbols utilizing wide characters. The real problem, it looks like, is that libstdc++ STILL REFERS to USE_WCHAR_T even though it forgets to define it. Hence, when libstdc++ is building, it doesn't build wchar support into the libraries. So apparently, solution (1) IS the solution, and the libstdc++ guys (or something else in the system that helps libstdc++ detirmine wchar support) will have to fix this. Thanks, and sorry for the noise. Brian On 5/9/06, Brian Budge <brian.budge@gmail.com> wrote:
Hi all -
I'm running into problems building the serialization library with gcc 4.1. I tracked it down to a change in libstdc++ for gcc 4.1 from the gcc 3.x libstdc++.
I'm sure there's a bug, but I'm not sure if it is a boost bug, a libstdc++ bug, or a gcc 4.1 bug.
boost_1_33_1/boost/config/stdlib/libstdcpp3.hpp says:
#if !defined(_GLIBCPP_USE_WCHAR_T) && !defined(_GLIBCXX_USE_WCHAR_T) # define BOOST_NO_CWCHAR # define BOOST_NO_CWCTYPE # define BOOST_NO_STD_WSTRING # define BOOST_NO_STD_WSTREAMBUF #endif
and indeed, with the 4.1 compiler, neither define is defined. For 4.1 in file
/usr/lib/gcc/i686-pc-linux-gnu/4.1.0/include/g++-v4/i686-pc-linux-gnu/c++config.h
I have /* Defined if vfwscanf exists. */ #define _GLIBCXX_HAVE_VFWSCANF 1
/* Defined if vswscanf exists. */ #define _GLIBCXX_HAVE_VSWSCANF 1
/* Defined if vwscanf exists. */ #define _GLIBCXX_HAVE_VWSCANF 1
/* Define to 1 if you have the <wchar.h> header file. */ #define _GLIBCXX_HAVE_WCHAR_H 1
/* Defined if wcstof exists. */ #define _GLIBCXX_HAVE_WCSTOF 1
/* Define to 1 if you have the <wctype.h> header file. */ #define _GLIBCXX_HAVE_WCTYPE_H 1
(no reference to USE_WCHAR_T)
and in
/usr/lib/gcc/i686-pc-linux-gnu/3.4.5/include/g++-v3/i686-pc-linux-gnu/bits/c++config.h
I have // Define if code specialized for wchar_t should be used. #define _GLIBCXX_USE_WCHAR_T 1
my fix would be one of three things:
1) in c++config.h #define _GLIBCXX_USE_WCHAR_T
2) in libstdcpp3.hpp add a test for _GLIBCXX_HAVE_WCHAR_H: #if !defined(_GLIBCPP_USE_WCHAR_T) && !defined(_GLIBCXX_USE_WCHAR_T) && !defined(_GLIBCXX_HAVE_WCHAR_H) # define BOOST_NO_CWCHAR # define BOOST_NO_CWCTYPE # define BOOST_NO_STD_WSTRING # define BOOST_NO_STD_WSTREAMBUF #endif
3) somewhere else #ifdef _GLIBCXX_HAVE_WCHAR_H #define _GLIBCXX_USE_WCHAR_T #endif
What do you guys think?
Brian
participants (1)
-
Brian Budge