wxWidgets / Phoenix

wxPython's Project Phoenix. A new implementation of wxPython, better, stronger, faster than he was before.
http://wxpython.org/
2.23k stars 510 forks source link

Fix building with SIP 4.19.14 #1189

Closed swt2c closed 5 years ago

swt2c commented 5 years ago

This commit fixes building Phoenix with SIP 4.19.14. One of the main changes in this release was to add SIP_OVERRIDE, which adds the C++ override keyword to method declarations that are intended to override the C++ class that SIP is wrapping. Unfortunately, this exposed a few bugs which caused compile errors. Most of the fixes are to the interface headers. The two trickier fixes were to wxFileConfig and wxRendererNative.

For wxFileConfig, the Save method's second parameter, 'conv', had been ignored. This caused the override check to fail. This was resolved by ignoring the auto-generated Save() and adding a manually generated one without the second parameter.

For wxRendererNative, the DrawTitleBarBitmap method is actually pure virtual in the subclass, so the fix was to ignore it there. In the subclass wxDelegateRendererNative, it is concrete, but only on certain platforms. This was fixed in a similar way by adding a manually generated method that will do the right thing on the platforms that support it.

There is one other fix required for SIP 4.19.14: SIP has now added its own wrapper for size_t, so it required removing the one in wacky_ints. This change was omitted for now because it should probably wait until Phoenix officially moves to 4.19.14.

swt2c commented 5 years ago

Fixed for Python 2 (hopefully).

swt2c commented 5 years ago

@RobinD42 can you take a look at this as soon as you can? Debian and Fedora have already moved to SIP 4.19.14, so I need to make some updates there ASAP, especially Debian.

david-geiger commented 5 years ago

Same here for Mageia, we have moved to sip 4.19.15.

LocutusOfBorg commented 5 years ago

Interestingly, I get another error with this patch... https://launchpadlibrarian.net/417623497/buildlog_ubuntu-disco-ppc64el.wxpython4.0_4.0.4+dfsg-2_BUILDING.txt.gz

[ 90/856] Compiling sip/cpp/sip_corewxVarHVScrollHelper.cpp
[ 91/856] Compiling sip/cpp/sip_corewxLinuxDistributionInfo.cpp
../../../../sip/cpp/sip_corewxVarHVScrollHelper.cpp: In function ‘void* cast_wxVarHVScrollHelper(void*, const sipTypeDef*)’:
../../../../sip/cpp/sip_corewxVarHVScrollHelper.cpp:1332:62: error: ‘wxVarScrollHelperBase’ is an ambiguous base of ‘wxVarHVScrollHelper’
         return static_cast< ::wxVarScrollHelperBase *>(sipCpp);
                                                              ^

Waf: Leaving directory `/<<BUILDDIR>>/wxpython4.0-4.0.4+dfsg/build/waf/2.7/gtk3'
Build failed
 -> task in '_core' failed with exit status 1 (run with -v to display more information)
Command '"/usr/bin/python2.7" /<<BUILDDIR>>/wxpython4.0-4.0.4+dfsg/bin/waf-2.0.8 --wx_config=wx-config --gtk3 --python="/usr/bin/python2.7" --out=build/waf/2.7/gtk3 configure build ' failed with exit code 1.
Finished command: build_py (1m11.315s)
E: pybuild pybuild:341: build: plugin custom failed with: exit code=1: python2.7 -u build.py dox touch etg --nodoc sip build_py --use_syswx --gtk3 bdist_egg
swt2c commented 5 years ago

That ambiguous base error sounds familiar. I'll have a look at this later. Does Ubuntu have a different (newer?) version of gcc than Debian?

LocutusOfBorg commented 5 years ago

@swt2c Hello, yes, as you can see it is partially using gcc-8 and gcc-9... I suspect using gcc-defaults from debian experimental will trigger the same issue

LocutusOfBorg commented 5 years ago

Yes, I confirm with debian experimental

[ 81/856] Compiling sip/cpp/sip_corewxVScrolledWindow.cpp
../../../../sip/cpp/sip_corewxVarHVScrollHelper.cpp: In function 'void* cast_wxVarHVScrollHelper(void*, const sipTypeDef*)':
../../../../sip/cpp/sip_corewxVarHVScrollHelper.cpp:1332:62: error: 'wxVarScrollHelperBase' is an ambiguous base of 'wxVarHVScrollHelper'
 1332 |         return static_cast< ::wxVarScrollHelperBase *>(sipCpp);
      |                                                              ^

../../../../sip/cpp/sip_corewxVScrolledWindow.cpp: In function 'long unsigned int _wxVScrolledWindow_GetFirstVisibleLine(wxVScrolledWindow*)':
../../../../sip/cpp/sip_corewxVScrolledWindow.cpp:48:42: warning: 'size_t wxVarVScrollLegacyAdaptor::GetFirstVisibleLine() const' is deprecated [-Wdeprecated-declarations]
   48 |         return self->GetFirstVisibleLine();
      |                                          ^
In file included from /usr/include/wx-3.0/wx/wx.h:14,
                 from ../../../../wx/include/wxPython/wxpy_api.h:41,
                 from ../../../../sip/cpp/sipAPI_core.h:19835,
                 from ../../../../sip/cpp/sip_corewxVScrolledWindow.cpp:10:
/usr/include/wx-3.0/wx/vscroll.h:574:26: note: declared here
  574 |     wxDEPRECATED( size_t GetFirstVisibleLine() const );
      |                          ^~~~~~~~~~~~~~~~~~~
/usr/include/wx-3.0/wx/defs.h:654:43: note: in definition of macro 'wxDEPRECATED'
  654 | #define wxDEPRECATED(x) wxDEPRECATED_DECL x
      |                                           ^
../../../../sip/cpp/sip_corewxVScrolledWindow.cpp: In function 'long unsigned int _wxVScrolledWindow_GetLastVisibleLine(wxVScrolledWindow*)':
../../../../sip/cpp/sip_corewxVScrolledWindow.cpp:52:41: warning: 'size_t wxVarVScrollLegacyAdaptor::GetLastVisibleLine() const' is deprecated [-Wdeprecated-declarations]
   52 |         return self->GetLastVisibleLine();
      |                                         ^
In file included from /usr/include/wx-3.0/wx/wx.h:14,
                 from ../../../../wx/include/wxPython/wxpy_api.h:41,
                 from ../../../../sip/cpp/sipAPI_core.h:19835,
                 from ../../../../sip/cpp/sip_corewxVScrolledWindow.cpp:10:
/usr/include/wx-3.0/wx/vscroll.h:581:26: note: declared here
  581 |     wxDEPRECATED( size_t GetLastVisibleLine() const );
      |                          ^~~~~~~~~~~~~~~~~~
/usr/include/wx-3.0/wx/defs.h:654:43: note: in definition of macro 'wxDEPRECATED'
  654 | #define wxDEPRECATED(x) wxDEPRECATED_DECL x
      |                                           ^
../../../../sip/cpp/sip_corewxVScrolledWindow.cpp: In function 'long unsigned int _wxVScrolledWindow_GetLineCount(wxVScrolledWindow*)':
../../../../sip/cpp/sip_corewxVScrolledWindow.cpp:56:35: warning: 'size_t wxVarVScrollLegacyAdaptor::GetLineCount() const' is deprecated [-Wdeprecated-declarations]
   56 |         return self->GetLineCount();
      |                                   ^
In file included from /usr/include/wx-3.0/wx/wx.h:14,
                 from ../../../../wx/include/wxPython/wxpy_api.h:41,
                 from ../../../../sip/cpp/sipAPI_core.h:19835,
                 from ../../../../sip/cpp/sip_corewxVScrolledWindow.cpp:10:
/usr/include/wx-3.0/wx/vscroll.h:587:26: note: declared here
  587 |     wxDEPRECATED( size_t GetLineCount() const );
      |                          ^~~~~~~~~~~~
/usr/include/wx-3.0/wx/defs.h:654:43: note: in definition of macro 'wxDEPRECATED'
  654 | #define wxDEPRECATED(x) wxDEPRECATED_DECL x
      |                                           ^
../../../../sip/cpp/sip_corewxVScrolledWindow.cpp: In function 'void _wxVScrolledWindow_SetLineCount(wxVScrolledWindow*, long unsigned int)':
../../../../sip/cpp/sip_corewxVScrolledWindow.cpp:60:33: warning: 'void wxVarVScrollLegacyAdaptor::SetLineCount(size_t)' is deprecated [-Wdeprecated-declarations]
   60 |         self->SetLineCount(count);
      |                                 ^
In file included from /usr/include/wx-3.0/wx/wx.h:14,
                 from ../../../../wx/include/wxPython/wxpy_api.h:41,
                 from ../../../../sip/cpp/sipAPI_core.h:19835,
                 from ../../../../sip/cpp/sip_corewxVScrolledWindow.cpp:10:
/usr/include/wx-3.0/wx/vscroll.h:592:24: note: declared here
  592 |     wxDEPRECATED( void SetLineCount(size_t count) );
      |                        ^~~~~~~~~~~~
/usr/include/wx-3.0/wx/defs.h:654:43: note: in definition of macro 'wxDEPRECATED'
  654 | #define wxDEPRECATED(x) wxDEPRECATED_DECL x
      |                                           ^
../../../../sip/cpp/sip_corewxVScrolledWindow.cpp: In function 'void _wxVScrolledWindow_RefreshLine(wxVScrolledWindow*, long unsigned int)':
../../../../sip/cpp/sip_corewxVScrolledWindow.cpp:64:31: warning: 'virtual void wxVarVScrollLegacyAdaptor::RefreshLine(size_t)' is deprecated [-Wdeprecated-declarations]
   64 |         self->RefreshLine(line);
      |                               ^
In file included from /usr/include/wx-3.0/wx/wx.h:14,
                 from ../../../../wx/include/wxPython/wxpy_api.h:41,
                 from ../../../../sip/cpp/sipAPI_core.h:19835,
                 from ../../../../sip/cpp/sip_corewxVScrolledWindow.cpp:10:
/usr/include/wx-3.0/wx/vscroll.h:595:32: note: declared here
  595 |     wxDEPRECATED( virtual void RefreshLine(size_t line) );
      |                                ^~~~~~~~~~~
/usr/include/wx-3.0/wx/defs.h:654:43: note: in definition of macro 'wxDEPRECATED'
  654 | #define wxDEPRECATED(x) wxDEPRECATED_DECL x
      |                                           ^
../../../../sip/cpp/sip_corewxVScrolledWindow.cpp: In function 'void _wxVScrolledWindow_RefreshLines(wxVScrolledWindow*, long unsigned int, long unsigned int)':
../../../../sip/cpp/sip_corewxVScrolledWindow.cpp:68:38: warning: 'virtual void wxVarVScrollLegacyAdaptor::RefreshLines(size_t, size_t)' is deprecated [-Wdeprecated-declarations]
   68 |         self->RefreshLines(from_, to_);
      |                                      ^
In file included from /usr/include/wx-3.0/wx/wx.h:14,
                 from ../../../../wx/include/wxPython/wxpy_api.h:41,
                 from ../../../../sip/cpp/sipAPI_core.h:19835,
                 from ../../../../sip/cpp/sip_corewxVScrolledWindow.cpp:10:
/usr/include/wx-3.0/wx/vscroll.h:598:32: note: declared here
  598 |     wxDEPRECATED( virtual void RefreshLines(size_t from, size_t to) );
      |                                ^~~~~~~~~~~~
/usr/include/wx-3.0/wx/defs.h:654:43: note: in definition of macro 'wxDEPRECATED'
  654 | #define wxDEPRECATED(x) wxDEPRECATED_DECL x
      |                                           ^
../../../../sip/cpp/sip_corewxVScrolledWindow.cpp: In function 'bool _wxVScrolledWindow_ScrollToLine(wxVScrolledWindow*, long unsigned int)':
../../../../sip/cpp/sip_corewxVScrolledWindow.cpp:72:39: warning: 'bool wxVarVScrollLegacyAdaptor::ScrollToLine(size_t)' is deprecated [-Wdeprecated-declarations]
   72 |         return self->ScrollToLine(line);
      |                                       ^
In file included from /usr/include/wx-3.0/wx/wx.h:14,
                 from ../../../../wx/include/wxPython/wxpy_api.h:41,
                 from ../../../../sip/cpp/sipAPI_core.h:19835,
                 from ../../../../sip/cpp/sip_corewxVScrolledWindow.cpp:10:
/usr/include/wx-3.0/wx/vscroll.h:604:24: note: declared here
  604 |     wxDEPRECATED( bool ScrollToLine(size_t line) );
      |                        ^~~~~~~~~~~~
/usr/include/wx-3.0/wx/defs.h:654:43: note: in definition of macro 'wxDEPRECATED'
  654 | #define wxDEPRECATED(x) wxDEPRECATED_DECL x
      |                                           ^
../../../../sip/cpp/sip_corewxVScrolledWindow.cpp: In function 'bool _wxVScrolledWindow_ScrollLines(wxVScrolledWindow*, int)':
../../../../sip/cpp/sip_corewxVScrolledWindow.cpp:76:66: warning: 'virtual bool wxVarVScrollLegacyAdaptor::ScrollLines(int)' is deprecated [-Wdeprecated-declarations]
   76 |         return self->wxVarVScrollLegacyAdaptor::ScrollLines(lines);
      |                                                                  ^
In file included from /usr/include/wx-3.0/wx/wx.h:14,
                 from ../../../../wx/include/wxPython/wxpy_api.h:41,
                 from ../../../../sip/cpp/sipAPI_core.h:19835,
                 from ../../../../sip/cpp/sip_corewxVScrolledWindow.cpp:10:
/usr/include/wx-3.0/wx/vscroll.h:607:32: note: declared here
  607 |     wxDEPRECATED( virtual bool ScrollLines(int lines) );
      |                                ^~~~~~~~~~~
/usr/include/wx-3.0/wx/defs.h:654:43: note: in definition of macro 'wxDEPRECATED'
  654 | #define wxDEPRECATED(x) wxDEPRECATED_DECL x
      |                                           ^
../../../../sip/cpp/sip_corewxVScrolledWindow.cpp: In function 'bool _wxVScrolledWindow_ScrollPages(wxVScrolledWindow*, int)':
../../../../sip/cpp/sip_corewxVScrolledWindow.cpp:80:66: warning: 'virtual bool wxVarVScrollLegacyAdaptor::ScrollPages(int)' is deprecated [-Wdeprecated-declarations]
   80 |         return self->wxVarVScrollLegacyAdaptor::ScrollPages(pages);
      |                                                                  ^
In file included from /usr/include/wx-3.0/wx/wx.h:14,
                 from ../../../../wx/include/wxPython/wxpy_api.h:41,
                 from ../../../../sip/cpp/sipAPI_core.h:19835,
                 from ../../../../sip/cpp/sip_corewxVScrolledWindow.cpp:10:
/usr/include/wx-3.0/wx/vscroll.h:608:32: note: declared here
  608 |     wxDEPRECATED( virtual bool ScrollPages(int pages) );
      |                                ^~~~~~~~~~~
/usr/include/wx-3.0/wx/defs.h:654:43: note: in definition of macro 'wxDEPRECATED'
  654 | #define wxDEPRECATED(x) wxDEPRECATED_DECL x
      |                                           ^

Waf: Leaving directory `/wxpython4.0-4.0.4+dfsg/build/waf/2.7/gtk3'
Build failed
 -> task in '_core' failed with exit status 1 (run with -v to display more information)
Command '"/usr/bin/python2.7" /wxpython4.0-4.0.4+dfsg/bin/waf-2.0.8 --wx_config=wx-config --gtk3 --python="/usr/bin/python2.7" --out=build/waf/2.7/gtk3 configure build ' failed with exit code 1.
Finished command: build_py (56.15s)
E: pybuild pybuild:341: build: plugin custom failed with: exit code=1: python2.7 -u build.py dox touch etg --nodoc sip build_py --use_syswx --gtk3 bdist_egg
dh_auto_build: pybuild --build --test-pytest -i python{version} -p 2.7 returned exit code 13
make: *** [debian/rules:22: build] Error 25
LocutusOfBorg commented 5 years ago

ok, its the src:sip from experimental

ii  python-sip                           4.19.15+dfsg-1       amd64        Python/C++ bindings generator runtime library
ii  python-sip-dev                       4.19.15+dfsg-1       amd64        Python/C++ bindings generator development files
ii  python3-sip                          4.19.15+dfsg-1       amd64        Python 3/C++ bindings generator runtime library
ii  python3-sip-dev                      4.19.15+dfsg-1       amd64        Python 3/C++ bindings generator development files
ii  sip-dev                              4.19.15+dfsg-1       amd64        Python/C++ bindings generator code generator application
LocutusOfBorg commented 5 years ago

so, 4.9.15 broke something else!

swt2c commented 5 years ago

so, 4.9.15 broke something else!

Yep. I've looked at it and the ambiguous base error appears to be a SIP bug. I've reported it upstream - we'll see what they say.

swt2c commented 5 years ago

Upstream SIP has made a couple of fixes for the ambiguous base stuff. He should be putting out a new SIP release soon with the fixes.

RobinD42 commented 5 years ago

Sorry to take so long guys. Have been real busy between the day job and life. I'm looking at this now.

swt2c commented 5 years ago

Sorry to take so long guys. Have been real busy between the day job and life. I'm looking at this now.

No worries. As a final FYI, SIP 4.19.16 is out with fixes for the diamond inheritance regressions in 4.19.15. So, don't use 4.19.15. :-)

RobinD42 commented 5 years ago

Yep, I went straight to .16

RobinD42 commented 5 years ago

One problem I see with the DrawTitleBarBitmap change is that sip no longer knows it's virtual, so if anybody ever wanted to reimplement their own renderer the overridden version won't be called from the C++ side. I doubt anybody has ever done that however, so it probably isn't too big of a deal for now.

RobinD42 commented 5 years ago

Ok, I've taken most of what was here and created a new PR (#1199) with this and also the rest of what's needed for an update to sip 4.19.16. I haven't run into any issues so far, but I don't have the newest compilers on any of my distros yet. Please give it a try and let me know how it goes.

LocutusOfBorg commented 5 years ago

@RobinD42 as soon as the downloading website goes live again, I'll download and test :)

RobinD42 commented 5 years ago

Which "downloading website"?

LocutusOfBorg commented 5 years ago

@RobinD42 yesterday the sever hosting https://www.riverbankcomputing.com/software/sip/download was up, but the webserver was not responding. it started working after some hours, and I can now confirm it works!

RobinD42 commented 5 years ago

Superseded by #1199

swt2c commented 5 years ago

One problem I see with the DrawTitleBarBitmap change is that sip no longer knows it's virtual, so if anybody ever wanted to reimplement their own renderer the overridden version won't be called from the C++ side. I doubt anybody has ever done that however, so it probably isn't too big of a deal for now.

Yes, that is probably true. Do you have any ideas about how to fix this?

RobinD42 commented 5 years ago

Not sure but I expect that it would require a change in wxWidgets. Perhaps just ensuring that there is a concrete implementation for all platforms even if they don't do anything.

I'll let it stew for a while to see if I get any other ideas.