Opened 11 years ago

Closed 11 years ago

#12013 closed build error (fixed)

Fatal error C1189 #error: "SIZEOF_WCHAR_T must be defined, but isn't."

Reported by: m.miozzi Owned by:
Priority: blocker Milestone: 3.0.0
Component: wxPython Version: stable-latest
Keywords: Cc:
Blocked By: Blocking:
Patch: yes

Description

The error appens during build of the 2.9.0 SVN copy of the library, updated in 2010-05-03T08:02:02.312184Z, on a Win32 OS (XP SP2).

The full message is:
\wxWidgets-2.9.0\include\wx/defs.h(925): Fatal error C1189 #error: "SIZEOF_WCHAR_T must be defined, but isn't."

The build was run from the wxPython-2.9.0 subfolder, with the build-wxpython.py module.

The following defines have been set:
#define wxUSE_STL 1
#define wxUSE_STD_STRING 1
#define wxUSE_STD_IOSTREAM 1

PATCH:
At line 829 of defs.h it is assumed that:

/* Assume that if SIZEOF_INT is defined that all the other ones except
SIZEOF_SIZE_T, are too. See next #if below. */

but this assumption seems to be wrong.
As a naive attempt, moving the definition

#define SIZEOF_WCHAR_T 2

before the logic condition:

#ifndef SIZEOF_INT

seems to solve the problem (I hope, it compiles for me).

Attachments (3)

patch.txt download (485 bytes) - added by m.miozzi 11 years ago.
Patch
defs_h.patch download (1.4 KB) - added by jmsalli 11 years ago.
wx-12013.diff download (2.8 KB) - added by vadz 11 years ago.
Always define SIZEOF_WCHAR_T if it's not defined under Windows.

Download all attachments as: .zip

Change History (10)

Changed 11 years ago by m.miozzi

Patch

comment:1 Changed 11 years ago by vadz

  • Component changed from build to wxPython

I don't know how does wxPython build wx but normally SIZEOF_INT should only be defined when using configure -- and in this case SIZEOF_WCHAR_T should be defined too. Please check where does the definition of SIZEOF_INT come from...

P.S. Please use unified diff format for patches as explained in HowToSubmitPatches, TIA!

comment:2 Changed 11 years ago by jmsalli

  • Status changed from new to confirmed

I also get this error, with Python 2.6.5 and wxWidgets/wxPython SVN trunk. Looks like Python include file pyconfig.h defines SIZEOF_INT, but not SIZEOF_WCHAR_T.

Attached is a candidate patch.

Changed 11 years ago by jmsalli

comment:3 Changed 11 years ago by vadz

I see, thanks for debugging this.

I wonder why do we duplicate SIZEOF_SIZE_T definition inside and outside of #ifndef SIZEOF_INT though. Looks like we could (should?) always do it outside of this test. And the same for SIZEOF_WCHAR_T and SIZEOF_VOID_P. I.e. let SIZEOF_INT only affect itself and SIZEOF_LONG but not the others.

comment:4 Changed 11 years ago by jmsalli

I'd guess the code duplication is not intentional. That is, what you suggest seems like an obvious thing to do.

Changed 11 years ago by vadz

Always define SIZEOF_WCHAR_T if it's not defined under Windows.

comment:5 Changed 11 years ago by vadz

  • Milestone set to 3.0

Could you please test if the patch above fixes the problem?

Thanks!

comment:6 Changed 11 years ago by jmsalli

It seems to work just fine.

comment:7 Changed 11 years ago by VZ

  • Resolution set to fixed
  • Status changed from confirmed to closed

(In [64373]) Always define SIZEOF_WCHAR_T if it's not defined under Windows.

The assumption that SIZEOF_EVERYTHING_ELSE is defined when SIZEOF_INT is is
wrong. While wxWidgets configure does define all SIZEOF_XXX at once,
SIZEOF_INT could also be defined in some third party headers (e.g. Python.h)
and we still need to define the other ones.

In particular, doing this fixes the problem with SIZEOF_WCHAR_T not being
defined during wxPython build.

Closes #12013.

Note: See TracTickets for help on using tickets.