#15805 closed defect (fixed)

Build broken by wxUSE_UNICODE/UNICODE changes of r75520

Reported by: Hanmac Owned by: vadz
Priority: high Milestone:
Component: GUI-all Version: dev-latest
Keywords: Cc:
Blocked By: Blocking:
Patch: no

Description

wxwidgets cant be build with following configuration, rev:75520 might be the cause

./configure --enable-ipv6 --with-sdl --enable-std_containers --enable-std_iostreams --enable-stdpaths --enable-std_string --enable-stl --with-gnomevfs --with-gtk=3 --enable-utf8

make:


In file included from ./src/regex/regcustom.h:40:0,

from ./src/regex/regguts.h:38,
from ./src/regex/regcomp.c:33:

./include/wx/chartype.h:202:0: warning: "wxUSE_UNICODE_UTF8" redefined [enabled by default]

#define wxUSE_UNICODE_UTF8 0


In file included from ./include/wx/platform.h:221:0,

from ./include/wx/defs.h:27,
from ./src/regex/regcustom.h:39,
from ./src/regex/regguts.h:38,
from ./src/regex/regcomp.c:33:

wxWidgets/lib/wx/include/gtk3-unicode-3.1/wx/setup.h:639:0: note: this is the location of the previous definition

#define wxUSE_UNICODE_UTF8 1


In file included from src/gtk/textentry.cpp:34:0:
src/gtk/textentry.cpp: In member function ‘virtual bool wxTextEntry::SetHint(const wxString&)’:
./include/wx/gtk/private.h:83:48: error: ‘m_font’ was not declared in this scope

#define wxGTK_CONV(s) wxGTK_CONV_FONT((s), m_font)


./include/wx/gtk/private.h:85:59: note: in definition of macro ‘wxGTK_CONV_FONT’

#define wxGTK_CONV_FONT(s, font) wxConvertToGTK((s), (font))


src/gtk/textentry.cpp:526:47: note: in expansion of macro ‘wxGTK_CONV’

gtk_entry_set_placeholder_text(entry, wxGTK_CONV(hint));


src/gtk/textentry.cpp: In member function ‘virtual wxString wxTextEntry::GetHint() const’:
./include/wx/gtk/private.h:88:54: error: ‘m_font’ was not declared in this scope

#define wxGTK_CONV_BACK(s) wxConvertFromGTK((s), m_font)


src/gtk/textentry.cpp:538:16: note: in expansion of macro ‘wxGTK_CONV_BACK’

return wxGTK_CONV_BACK(gtk_entry_get_placeholder_text(entry));


Change History (7)

comment:1 Changed 12 months ago by vadz

  • Owner set to vadz
  • Status changed from new to accepted
  • Summary changed from wxUSE_UNICODE breaks GTKTextEntry building to Build broken by wxUSE_UNICODE/UNICODE changes of r75520

Oops, of course r75520 doesn't work as wxUSE_UNICODE is now defined as 0 before wx/setup.h can define it as 1... I guess we could continue to play games with the header order but it seems simpler to just define it on the command line, so I'm going to just do this.

Thanks for reporting!

comment:2 Changed 12 months ago by VZ

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

(In [75536]) Define wxUSE_UNICODE on compiler command line in Unix builds too.

Under Windows we already define _UNICODE which gets picked up and translated
to wxUSE_UNICODE by wx/platform.h, but under Unix we didn't do it until now.
Do it both for consistency and to fix the build breakage since r75520 which
moved the tests for wxUSE_UNICODE being defined before wx/setup.h.

This seems like the simplest solution because otherwise there doesn't seem to
be any single header order which would work under both Windows and Unix: under
Windows we need to include wx/compiler.h, and hence _mingw.h included from it,
before wx/setup.h, which implies that wxUSE_UNICODE must be set before doing
it, but under Unix wxUSE_UNICODE was only defined in wx/setup.h and so
couldn't be tested before including wx/compiler.h.

And just the explanation above should convincingly show that defining
wxUSE_UNICODE in CPPFLAGS makes things simpler.

Closes #15805.

comment:3 Changed 12 months ago by Hanmac

  • Component changed from wxGTK to GUI-all
  • Priority changed from blocker to high
  • Resolution fixed deleted
  • Status changed from closed to reopened
  • Type changed from build error to defect

compiler warning still exist when i use wx in my binding like that:

/usr/local/include/wx-3.1/wx/chartype.h:203:0: warning: "wxUSE_UNICODE_UTF8" redefined [enabled by default]

#define wxUSE_UNICODE_UTF8 0


In file included from /usr/local/include/wx-3.1/wx/platform.h:221:0,

from /usr/local/include/wx-3.1/wx/defs.h:20,
from /usr/local/include/wx-3.1/wx/wx.h:14

/usr/local/lib/wx/include/gtk3-unicode-3.1/wx/setup.h:639:0: note: this is the location of the previous definition

#define wxUSE_UNICODE_UTF8 1

comment:4 Changed 12 months ago by vadz

  • Status changed from reopened to accepted

Ugh, yes, of course, why did I decide that the problem only appeared when building wx itself, this is clearly not true. I'll have to find some other solution but I still have no idea how to organize things in some half sane way and still satisfy all the requirements...

comment:5 Changed 12 months ago by VZ

(In [75553]) Revert "Define wxUSE_UNICODE on compiler command line in Unix builds too."

This fix only helps with building wxWidgets itself but doesn't help when
building user code using it, so revert it as we need another solution to this
problem anyhow.

This reverts r75536, see #15805.

comment:6 Changed 12 months ago by VZ

(In [75554]) Revert "Move UNICODE section of wx/platform.h before wx/compiler.h inclusion."

Unfortunately this fix for MinGW broke compilation under Unix, see #15805.

This reverts r75520.

comment:7 Changed 12 months ago by VZ

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

(In [75555]) Move wxCHECK_MINGW32_VERSION() declaration to wx/msw/gccpriv.h.

Unfortunately we can't keep it in wx/compiler.h which is included too early,
before UNICODE macro is defined, and we can't define it before including
wx/setup.h which itself must be included after wx/compiler.h.

So move it to wx/msw/gccpriv.h which is not a great solution, as the best
would be to get rid of this gcc-specific file completely, but at least should
make everything build again and ensure that _mingw.h is included after UNICODE
definition.

Closes #15805.

Note: See TracTickets for help on using tickets.