public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* _GLIBCPP_USE_WCHAR_T undefined in FreeBSD's c++config.h?
@ 2003-02-19 18:07 Craig Rodrigues
  2003-02-19 18:23 ` Benjamin Kosnik
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Craig Rodrigues @ 2003-02-19 18:07 UTC (permalink / raw)
  To: gcc; +Cc: libstdc++

Hi,

I am not sure if this issue falls under the jurisdiction of
the gcc@ or libstdc++@ mailing lists so I am posting to both.

I am running FreeBSD:
uname -a
FreeBSD 5.0-CURRENT #15



If I bootstrap gcc 3.3 branch, I notice that
include/c++/3.3/i386-unknown-freebsd5.0/bits/c++config.h
does not define _GLIBCPP_USE_WCHAR_T as it does under Linux.

This makes it impossible to compile the following snippet of
code:

#include <string>

using namespace std;

int main(int argc, char *argv[])
{
  std::wstring a;
  return 0;
}


a.cc: In function `int main(int, char**)':
a.cc:7: error: `wstring' undeclared in namespace `std'
a.cc:7: error: parse error before `;' token


The reason for this is because in include/c++/3.3/bits/stringfwd.h, 
we have:


#ifdef _GLIBCPP_USE_WCHAR_T
  template<> struct char_traits<wchar_t>;

  typedef basic_string<wchar_t> wstring;
#endif


What is the solution for this?

Thanks.
-- 
Craig Rodrigues        
http://home.attbi.com/~rodrigc
rodrigc@attbi.com

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: _GLIBCPP_USE_WCHAR_T undefined in FreeBSD's c++config.h?
  2003-02-19 18:07 _GLIBCPP_USE_WCHAR_T undefined in FreeBSD's c++config.h? Craig Rodrigues
@ 2003-02-19 18:23 ` Benjamin Kosnik
  2003-02-19 18:25 ` Alexander Kabaev
  2003-02-19 19:11 ` Karel Gardas
  2 siblings, 0 replies; 7+ messages in thread
From: Benjamin Kosnik @ 2003-02-19 18:23 UTC (permalink / raw)
  To: Craig Rodrigues; +Cc: gcc, libstdc++


>If I bootstrap gcc 3.3 branch, I notice that
>include/c++/3.3/i386-unknown-freebsd5.0/bits/c++config.h
>does not define _GLIBCPP_USE_WCHAR_T as it does under Linux.

Probably because, during the configure process, support for correctly
implementing this was found not to exist.

A look at how Irix 6.5.18 fixed this, recently, will prove to be
enlightening. Take a look at the libstdc++ list in the past couple of
weeks, when the archive comes back up, for posts by D. Billinghurst, and
K. Gazhi.

Perhaps Loren can provide you with more info WRT the BSD port's current
status. I know there was a off-the-cuff statement made that 5.0 would
actually have more support for wchar_t, but I am not familiar with this
platform.

>This makes it impossible to compile the following snippet of
>code:
>
>#include <string>
>
>using namespace std;
>
>int main(int argc, char *argv[])
>{
>  std::wstring a;
>  return 0;
>}

If support for wchar_t is found lacking, as I see it, there are two
options that are acceptable.

1) compile failure

2) link failure

The current approach is #1.

-benjamin

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: _GLIBCPP_USE_WCHAR_T undefined in FreeBSD's c++config.h?
  2003-02-19 18:07 _GLIBCPP_USE_WCHAR_T undefined in FreeBSD's c++config.h? Craig Rodrigues
  2003-02-19 18:23 ` Benjamin Kosnik
@ 2003-02-19 18:25 ` Alexander Kabaev
  2003-02-19 20:07   ` Benjamin Kosnik
  2003-02-20 13:57   ` Craig Rodrigues
  2003-02-19 19:11 ` Karel Gardas
  2 siblings, 2 replies; 7+ messages in thread
From: Alexander Kabaev @ 2003-02-19 18:25 UTC (permalink / raw)
  To: Craig Rodrigues; +Cc: gcc, libstdc++

On Wed, 19 Feb 2003 12:45:38 -0500
Craig Rodrigues <rodrigc@attbi.com> wrote:

> 
> If I bootstrap gcc 3.3 branch, I notice that
> include/c++/3.3/i386-unknown-freebsd5.0/bits/c++config.h
> does not define _GLIBCPP_USE_WCHAR_T as it does under Linux.

FreeBSD does not implement iconv family functions in the base system, it
has a WCHAR_MIN/WCHAR_MAX constants defined in a wrong header and wcstof
function is not committed yet. These three prevent libstdc++ configure
from enabling wchar_t instantiations.

If you really, really want to enable wchar_t support, you might do it by
trivially hacking up our base system compiler build:

1) Deffine _GLIBCPP_USE_WCHAR_T as 1 in
/usr/src/gnu/lib/libstdc++/c++config.h file.

2) Comment out all references to wcstof in
/usr/src/contrib/libstdc++/include/c_std/std_cwchar.h file.

3) Define WCHAR_MIN/WCHAR_MAX in /usr/src/include/wchar.h.

4) make buildworld/installworld.

I for one would not mind getting a tester running with wchar_t-enabled
libstdc++ library on his system. Feel free to submit any errors you'll
encounter.

-- 
Alexander Kabaev

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: _GLIBCPP_USE_WCHAR_T undefined in FreeBSD's c++config.h?
  2003-02-19 18:07 _GLIBCPP_USE_WCHAR_T undefined in FreeBSD's c++config.h? Craig Rodrigues
  2003-02-19 18:23 ` Benjamin Kosnik
  2003-02-19 18:25 ` Alexander Kabaev
@ 2003-02-19 19:11 ` Karel Gardas
  2 siblings, 0 replies; 7+ messages in thread
From: Karel Gardas @ 2003-02-19 19:11 UTC (permalink / raw)
  To: Craig Rodrigues; +Cc: gcc, libstdc++

On Wed, 19 Feb 2003, Craig Rodrigues wrote:

> Hi,
>
> I am not sure if this issue falls under the jurisdiction of
> the gcc@ or libstdc++@ mailing lists so I am posting to both.
>
> I am running FreeBSD:
> uname -a
> FreeBSD 5.0-CURRENT #15
>
>
>
> If I bootstrap gcc 3.3 branch, I notice that
> include/c++/3.3/i386-unknown-freebsd5.0/bits/c++config.h
> does not define _GLIBCPP_USE_WCHAR_T as it does under Linux.
>

I've seen a patch correcting wchar_t problem floating on freebsd-current
mailing list 2-4 months ago... I guess it had 'wchar' in subject line.

... and I've found it now again. Please look at:

http://docs.FreeBSD.org/cgi/getmsg.cgi?fetch=809764+0+archive/2002/freebsd-current/20021110.freebsd-current
http://docs.FreeBSD.org/cgi/getmsg.cgi?fetch=943455+0+archive/2002/freebsd-current/20021110.freebsd-current

and index:
http://docs.FreeBSD.org/mail/archive/2002/freebsd-current/20021110.freebsd-current.html

Cheers,

Karel
--
Karel Gardas                  kgardas@objectsecurity.com
ObjectSecurity Ltd.           http://www.objectsecurity.com


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: _GLIBCPP_USE_WCHAR_T undefined in FreeBSD's c++config.h?
  2003-02-19 18:25 ` Alexander Kabaev
@ 2003-02-19 20:07   ` Benjamin Kosnik
  2003-02-20 18:11     ` Phil Edwards
  2003-02-20 13:57   ` Craig Rodrigues
  1 sibling, 1 reply; 7+ messages in thread
From: Benjamin Kosnik @ 2003-02-19 20:07 UTC (permalink / raw)
  To: Alexander Kabaev; +Cc: rodrigc, gcc, libstdc++


>FreeBSD does not implement iconv family functions in the base system, it
>has a WCHAR_MIN/WCHAR_MAX constants defined in a wrong header and wcstof
>function is not committed yet. These three prevent libstdc++ configure
>from enabling wchar_t instantiations.

Thanks, this was very informative. It's great news that this is so close
to working on FreeBSD.

-benjamin

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: _GLIBCPP_USE_WCHAR_T undefined in FreeBSD's c++config.h?
  2003-02-19 18:25 ` Alexander Kabaev
  2003-02-19 20:07   ` Benjamin Kosnik
@ 2003-02-20 13:57   ` Craig Rodrigues
  1 sibling, 0 replies; 7+ messages in thread
From: Craig Rodrigues @ 2003-02-20 13:57 UTC (permalink / raw)
  To: Alexander Kabaev; +Cc: gcc, libstdc++

On Wed, Feb 19, 2003 at 01:23:28PM -0500, Alexander Kabaev wrote:
> 1) Deffine _GLIBCPP_USE_WCHAR_T as 1 in
> /usr/src/gnu/lib/libstdc++/c++config.h file.
> 
> 2) Comment out all references to wcstof in
> /usr/src/contrib/libstdc++/include/c_std/std_cwchar.h file.
> 
> 3) Define WCHAR_MIN/WCHAR_MAX in /usr/src/include/wchar.h.
> 
> 4) make buildworld/installworld.

I followed these instructions and modified the FreeBSD system
compiler, and now it looks like I can successfully compile
code with std::wstring.

When the problems that you mentioned are fixed in the FreeBSD
header files, then GCC should be able to successfully detect
wchar support on FreeBSD.

Thanks!
-- 
Craig Rodrigues        
http://home.attbi.com/~rodrigc
rodrigc@attbi.com

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: _GLIBCPP_USE_WCHAR_T undefined in FreeBSD's c++config.h?
  2003-02-19 20:07   ` Benjamin Kosnik
@ 2003-02-20 18:11     ` Phil Edwards
  0 siblings, 0 replies; 7+ messages in thread
From: Phil Edwards @ 2003-02-20 18:11 UTC (permalink / raw)
  To: Benjamin Kosnik; +Cc: Alexander Kabaev, rodrigc, gcc, libstdc++

On Wed, Feb 19, 2003 at 01:45:44PM -0600, Benjamin Kosnik wrote:
> 
> >FreeBSD does not implement iconv family functions in the base system, it
> >has a WCHAR_MIN/WCHAR_MAX constants defined in a wrong header and wcstof
> >function is not committed yet. These three prevent libstdc++ configure
> >from enabling wchar_t instantiations.
> 
> Thanks, this was very informative. It's great news that this is so close
> to working on FreeBSD.

And in the meantime...


2003-02-20  Phil Edwards  <pme@gcc.gnu.org>

	* docs/html/faq/index.html (3.9):  New note, wchar_t on FreeBSD.
	* docs/html/faq/index.txt:  Regenerate.


Index: docs/html/faq/index.html
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/docs/html/faq/index.html,v
retrieving revision 1.51
diff -u -3 -p -r1.51 index.html
--- docs/html/faq/index.html	3 Feb 2003 16:47:44 -0000	1.51
+++ docs/html/faq/index.html	20 Feb 2003 17:55:43 -0000
@@ -73,6 +73,7 @@
          <li><a href="#3_6">OS X ctype.h is broken!  How can I hack it?</a></li>
          <li><a href="#3_7">Threading is broken on i386</a></li>
          <li><a href="#3_8">Recent GNU/Linux glibc required?</a></li>
+         <li><a href="#3_9">Can't use wchar_t/wstring on FreeBSD</a></li>
       </ol>
    </li>
 
@@ -520,7 +521,23 @@ which is no longer available, thanks dej
          glibc version 2.3.x available now.
       </p>
       <p>The guideline is simple:  the more recent the C++ library, the
-         more recent the C library.
+         more recent the C library.  (This is also documented in the main
+         GCC installation instructions.)
+      </p>
+
+<hr />
+   <h2><a name="3_9">3.9 Can't use wchar_t/wstring on FreeBSD</a></h2>
+      <p>At the moment there are a few problems in FreeBSD's support for
+         wide character functions, and as a result the libstdc++ configury
+         decides that wchar_t support should be disabled.  Once the underlying
+         problems are fixed in FreeBSD (soon), the library support will
+         automatically enable itself.
+      </p>
+      <p>You can fix the problems yourself, and learn more about the situation,
+         by reading
+         <a href="http://gcc.gnu.org/ml/libstdc++/2003-02/subjects.html#00286">
+         this short thread</a> (&quot;_GLIBCPP_USE_WCHAR_T undefined in
+         FreeBSD's c++config.h?&quot;).
       </p>
 
 <hr />

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2003-02-20 17:57 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-02-19 18:07 _GLIBCPP_USE_WCHAR_T undefined in FreeBSD's c++config.h? Craig Rodrigues
2003-02-19 18:23 ` Benjamin Kosnik
2003-02-19 18:25 ` Alexander Kabaev
2003-02-19 20:07   ` Benjamin Kosnik
2003-02-20 18:11     ` Phil Edwards
2003-02-20 13:57   ` Craig Rodrigues
2003-02-19 19:11 ` Karel Gardas

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).