Problems building wxPython-2.7.1.2 with GTK1 on MAC

Hi all,

I tried to upgrade my application to the new version of wxPython but ran into the following problems:

I'm building wxPython version 2.7.1.2 using --with-gtk=1, --with-opengl, --enable-geometry, --enable-display, and --disable-debugreport as options to configure. I am building on Mac OS X 10.4.8 using gcc 4.0.1 (and gtk-1.2 installed via Fink)

While building the wxWidgets part I had to apply the following patches to get things to compile:

···

====================
--- wxPython-src-2.7.1.2-old/src/gtk1/utilsgtk.cpp 2006-08-18 01:28:46.000000000 +0200
+++ wxPython-src-2.7.1.2/src/gtk1/utilsgtk.cpp 2006-10-24 13:15:56.000000000 +0200
@@ -196,3 +196,8 @@

      return wxPORT_GTK;
}
+
+wxString wxGUIAppTraits::GetDesktopEnvironment() const
+{
+ return wxEmptyString;
+}
--- wxPython-src-2.7.1.2-old/src/mac/corefoundation/stdpaths_cf.cpp 2006-07-05 20:37:00.000000000 +0200
+++ wxPython-src-2.7.1.2/src/mac/corefoundation/stdpaths_cf.cpp 2006-10-24 12:06:09.000000000 +0200
@@ -31,7 +31,6 @@ #include "wx/mac/private.h"
#endif #include "wx/mac/corefoundation/cfstring.h"
-#include "wx/mac/private.h"

#if defined(__DARWIN__)
#include <CoreFoundation/CFBundle.h>

After installing wxWidgets I tried to build wxPython using Python 2.4.4 with

     python setup.py WXPORT=gtk WX_CONFIG=$(mywxpythonpath)/bin/wx-config install --prefix=$(mywxpythonpath)

This produced the following error when trying to compile helpers.cpp:

cc1plus: warning: command line option "-Wstrict-prototypes" is valid for C/ObjC but not for C++
src/helpers.cpp:32:28: error: wx/gtk/win_gtk.h: No such file or directory
src/helpers.cpp: In function 'long int wxPyGetWinHandle(wxWindow*)':
src/helpers.cpp:1841: error: 'GTK_PIZZA' was not declared in this scope
error: command 'gcc' failed with exit status 1

It seems that for Gtk 1.2 the directory include/wx/gtk has been renamed to include/wx/gtk1. I did provide a WXPORT=gtk, so I assume it is a bug that wxPython is not looking in include/wx/gtk1 for the win_gtk.h file.

I just made a temporary symbolic link from this gtk1 subdirectory (named include/wx/gtk) and tried to see how much further I could get.
The next problem occurred when trying to compile _core_wrap.o:

cc1plus: warning: command line option "-Wstrict-prototypes" is valid for C/ObjC but not for C++
src/gtk/_core_wrap.cpp: In function 'PyObject* _wrap_GetAccelFromString(PyObject*, PyObject*, PyObject*)':
src/gtk/_core_wrap.cpp:30339: warning: 'wxGetAccelFromString' is deprecated (declared at /Users/sander/Projects/wxpython/include/wx-2.7/wx/utils.h:571)
src/gtk/_core_wrap.cpp:30339: warning: 'wxGetAccelFromString' is deprecated (declared at /Users/sander/Projects/wxpython/include/wx-2.7/wx/utils.h:571)
src/gtk/_core_wrap.cpp: In function 'PyObject* _wrap_Window_SetDoubleBuffered(PyObject*, PyObject*, PyObject*)':
src/gtk/_core_wrap.cpp:34445: error: 'class wxWindow' has no member named 'SetDoubleBuffered'

At this point I am lost. Could someone please help me get this thing build?

Best regards,
Sander Niemeijer

Sander Niemeijer wrote:

Hi all,

I tried to upgrade my application to the new version of wxPython but ran into the following problems:

I'm building wxPython version 2.7.1.2 using --with-gtk=1, --with-opengl, --enable-geometry, --enable-display, and --disable-debugreport as options to configure. I am building on Mac OS X 10.4.8 using gcc 4.0.1 (and gtk-1.2 installed via Fink)

As you can probably tell, development activity, testing and support for gtk1 is dwindling pretty fast. Isn't GTK2 available in fink?

While building the wxWidgets part I had to apply the following patches to get things to compile:

====================
--- wxPython-src-2.7.1.2-old/src/gtk1/utilsgtk.cpp 2006-08-18 01:28:46.000000000 +0200
+++ wxPython-src-2.7.1.2/src/gtk1/utilsgtk.cpp 2006-10-24 13:15:56.000000000 +0200
@@ -196,3 +196,8 @@

     return wxPORT_GTK;
}
+
+wxString wxGUIAppTraits::GetDesktopEnvironment() const
+{
+ return wxEmptyString;
+}

Please submit this patch to the wx patch tracker.

--- wxPython-src-2.7.1.2-old/src/mac/corefoundation/stdpaths_cf.cpp 2006-07-05 20:37:00.000000000 +0200
+++ wxPython-src-2.7.1.2/src/mac/corefoundation/stdpaths_cf.cpp 2006-10-24 12:06:09.000000000 +0200
@@ -31,7 +31,6 @@ #include "wx/mac/private.h"
#endif #include "wx/mac/corefoundation/cfstring.h"
-#include "wx/mac/private.h"

#if defined(__DARWIN__)
#include <CoreFoundation/CFBundle.h>

I wouldn't expect it to try including corefoundation at all on a gtk build and would think that's a bug, but I could be wrong.

After installing wxWidgets I tried to build wxPython using Python 2.4.4 with

    python setup.py WXPORT=gtk WX_CONFIG=$(mywxpythonpath)/bin/wx-config install --prefix=$(mywxpythonpath)

This produced the following error when trying to compile helpers.cpp:

cc1plus: warning: command line option "-Wstrict-prototypes" is valid for C/ObjC but not for C++
src/helpers.cpp:32:28: error: wx/gtk/win_gtk.h: No such file or directory
src/helpers.cpp: In function 'long int wxPyGetWinHandle(wxWindow*)':
src/helpers.cpp:1841: error: 'GTK_PIZZA' was not declared in this scope
error: command 'gcc' failed with exit status 1

It seems that for Gtk 1.2 the directory include/wx/gtk has been renamed to include/wx/gtk1. I did provide a WXPORT=gtk, so I assume it is a bug that wxPython is not looking in include/wx/gtk1 for the win_gtk.h file.

A change in helpers.cpp where it includes the file to make it dependent on whether __WXGTK20__ is defined or not should fix it. If so then send a patch for that too.

I just made a temporary symbolic link from this gtk1 subdirectory (named include/wx/gtk) and tried to see how much further I could get.
The next problem occurred when trying to compile _core_wrap.o:

cc1plus: warning: command line option "-Wstrict-prototypes" is valid for C/ObjC but not for C++
src/gtk/_core_wrap.cpp: In function 'PyObject* _wrap_GetAccelFromString(PyObject*, PyObject*, PyObject*)':
src/gtk/_core_wrap.cpp:30339: warning: 'wxGetAccelFromString' is deprecated (declared at /Users/sander/Projects/wxpython/include/wx-2.7/wx/utils.h:571)
src/gtk/_core_wrap.cpp:30339: warning: 'wxGetAccelFromString' is deprecated (declared at /Users/sander/Projects/wxpython/include/wx-2.7/wx/utils.h:571)
src/gtk/_core_wrap.cpp: In function 'PyObject* _wrap_Window_SetDoubleBuffered(PyObject*, PyObject*, PyObject*)':
src/gtk/_core_wrap.cpp:34445: error: 'class wxWindow' has no member named 'SetDoubleBuffered'

This one can be fixed with a patch to include/wx/gtk1/window.h. Add something like this to the wxWindow declaration:

  void SetDoubleBuffered(bool ) {}

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!

As you can probably tell, development activity, testing and support for gtk1 is dwindling pretty fast. Isn't GTK2 available in fink?

Yes it is. However, the reason why we are still using GTK1 is because GTK2 gave problems with the wxvtk bridge to VTK. Our visualizations showed all kinds of weird z-ordering problems.
It will take some time to fix this issue, so for the time being we just like to stick with GTK1.

While building the wxWidgets part I had to apply the following patches to get things to compile:

--- wxPython-src-2.7.1.2-old/src/gtk1/utilsgtk.cpp 2006-08-18 01:28:46.000000000 +0200
+++ wxPython-src-2.7.1.2/src/gtk1/utilsgtk.cpp 2006-10-24 13:15:56.000000000 +0200
@@ -196,3 +196,8 @@
     return wxPORT_GTK;
}
+
+wxString wxGUIAppTraits::GetDesktopEnvironment() const
+{
+ return wxEmptyString;
+}

Please submit this patch to the wx patch tracker.

done.

--- wxPython-src-2.7.1.2-old/src/mac/corefoundation/stdpaths_cf.cpp 2006-07-05 20:37:00.000000000 +0200
+++ wxPython-src-2.7.1.2/src/mac/corefoundation/stdpaths_cf.cpp 2006-10-24 12:06:09.000000000 +0200
@@ -31,7 +31,6 @@ #include "wx/mac/private.h"
#endif #include "wx/mac/corefoundation/cfstring.h"
-#include "wx/mac/private.h"
#if defined(__DARWIN__)
#include <CoreFoundation/CFBundle.h>

I wouldn't expect it to try including corefoundation at all on a gtk build and would think that's a bug, but I could be wrong.

I'm not sure either. However, I submitted a patch for the incorrect include of wx/mac/private.h

After installing wxWidgets I tried to build wxPython using Python 2.4.4 with
    python setup.py WXPORT=gtk WX_CONFIG=$(mywxpythonpath)/bin/wx-config install --prefix=$(mywxpythonpath)
This produced the following error when trying to compile helpers.cpp:

cc1plus: warning: command line option "-Wstrict-prototypes" is valid for C/ObjC but not for C++
src/helpers.cpp:32:28: error: wx/gtk/win_gtk.h: No such file or directory
src/helpers.cpp: In function 'long int wxPyGetWinHandle(wxWindow*)':
src/helpers.cpp:1841: error: 'GTK_PIZZA' was not declared in this scope
error: command 'gcc' failed with exit status 1

It seems that for Gtk 1.2 the directory include/wx/gtk has been renamed to include/wx/gtk1. I did provide a WXPORT=gtk, so I assume it is a bug that wxPython is not looking in include/wx/gtk1 for the win_gtk.h file.

A change in helpers.cpp where it includes the file to make it dependent on whether __WXGTK20__ is defined or not should fix it. If so then send a patch for that too.

Patch submitted.

I just made a temporary symbolic link from this gtk1 subdirectory (named include/wx/gtk) and tried to see how much further I could get.
The next problem occurred when trying to compile _core_wrap.o:

cc1plus: warning: command line option "-Wstrict-prototypes" is valid for C/ObjC but not for C++
src/gtk/_core_wrap.cpp: In function 'PyObject* _wrap_GetAccelFromString(PyObject*, PyObject*, PyObject*)':
src/gtk/_core_wrap.cpp:30339: warning: 'wxGetAccelFromString' is deprecated (declared at /Users/sander/Projects/wxpython/include/wx-2.7/wx/utils.h:571)
src/gtk/_core_wrap.cpp:30339: warning: 'wxGetAccelFromString' is deprecated (declared at /Users/sander/Projects/wxpython/include/wx-2.7/wx/utils.h:571)
src/gtk/_core_wrap.cpp: In function 'PyObject* _wrap_Window_SetDoubleBuffered(PyObject*, PyObject*, PyObject*)':
src/gtk/_core_wrap.cpp:34445: error: 'class wxWindow' has no member named 'SetDoubleBuffered'

This one can be fixed with a patch to include/wx/gtk1/window.h. Add something like this to the wxWindow declaration:

  void SetDoubleBuffered(bool ) {}

Patch submitted.

Now the next thing that I found was an error when compiling src/gtk/_controls_wrap.cpp (the _controls_ extension):

···

On 25-okt-2006, at 0:15, Robin Dunn wrote:

cc1plus: warning: command line option "-Wstrict-prototypes" is valid for C/ObjC but not for C++
src/gtk/_controls_wrap.cpp: In function 'PyObject* _wrap_TextCtrl_SetModified(PyObject*, PyObject*, PyObject*)':
src/gtk/_controls_wrap.cpp:12742: error: no matching function for call to 'wxTextCtrl::SetModified(bool&)'
/Users/sander/Projects/wxpython/include/wx-2.7/wx/gtk1/textctrl.h:140: note: candidates are: void wxTextCtrl::SetModified()

I don't really understand this error. wxTextCtrl for gtk1 has its own SetModified() without parameters (and this won't work here), however wxTextCtrlBase (the parent class) does have a SetModified() that takes a bool as parameter. Any ideas how to fix this?

Best regards,
Sander Niemeijer

Sander Niemeijer wrote:

I just made a temporary symbolic link from this gtk1 subdirectory (named include/wx/gtk) and tried to see how much further I could get.
The next problem occurred when trying to compile _core_wrap.o:

cc1plus: warning: command line option "-Wstrict-prototypes" is valid for C/ObjC but not for C++
src/gtk/_core_wrap.cpp: In function 'PyObject* _wrap_GetAccelFromString(PyObject*, PyObject*, PyObject*)':
src/gtk/_core_wrap.cpp:30339: warning: 'wxGetAccelFromString' is deprecated (declared at /Users/sander/Projects/wxpython/include/wx-2.7/wx/utils.h:571)
src/gtk/_core_wrap.cpp:30339: warning: 'wxGetAccelFromString' is deprecated (declared at /Users/sander/Projects/wxpython/include/wx-2.7/wx/utils.h:571)
src/gtk/_core_wrap.cpp: In function 'PyObject* _wrap_Window_SetDoubleBuffered(PyObject*, PyObject*, PyObject*)':
src/gtk/_core_wrap.cpp:34445: error: 'class wxWindow' has no member named 'SetDoubleBuffered'

This one can be fixed with a patch to include/wx/gtk1/window.h. Add something like this to the wxWindow declaration:

    void SetDoubleBuffered(bool ) {}

Patch submitted.

I didn't see this patch.

Now the next thing that I found was an error when compiling src/gtk/_controls_wrap.cpp (the _controls_ extension):

cc1plus: warning: command line option "-Wstrict-prototypes" is valid for C/ObjC but not for C++
src/gtk/_controls_wrap.cpp: In function 'PyObject* _wrap_TextCtrl_SetModified(PyObject*, PyObject*, PyObject*)':
src/gtk/_controls_wrap.cpp:12742: error: no matching function for call to 'wxTextCtrl::SetModified(bool&)'
/Users/sander/Projects/wxpython/include/wx-2.7/wx/gtk1/textctrl.h:140: note: candidates are: void wxTextCtrl::SetModified()

I don't really understand this error. wxTextCtrl for gtk1 has its own SetModified() without parameters (and this won't work here), however wxTextCtrlBase (the parent class) does have a SetModified() that takes a bool as parameter. Any ideas how to fix this?

It probably needs to be tested, but it looks like you can just remove the SetModified in gtk1/textctrl.h, I think the one in the base class should work ok. If not then I would just change the derived class version to take the bool parameter and set m_modified to the value of the parameter.

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!

Sander Niemeijer wrote:

I just made a temporary symbolic link from this gtk1 subdirectory (named include/wx/gtk) and tried to see how much further I could get.
The next problem occurred when trying to compile _core_wrap.o:

cc1plus: warning: command line option "-Wstrict-prototypes" is valid for C/ObjC but not for C++
src/gtk/_core_wrap.cpp: In function 'PyObject* _wrap_GetAccelFromString(PyObject*, PyObject*, PyObject*)':
src/gtk/_core_wrap.cpp:30339: warning: 'wxGetAccelFromString' is deprecated (declared at /Users/sander/Projects/wxpython/include/wx-2.7/wx/utils.h:571)
src/gtk/_core_wrap.cpp:30339: warning: 'wxGetAccelFromString' is deprecated (declared at /Users/sander/Projects/wxpython/include/wx-2.7/wx/utils.h:571)
src/gtk/_core_wrap.cpp: In function 'PyObject* _wrap_Window_SetDoubleBuffered(PyObject*, PyObject*, PyObject*)':
src/gtk/_core_wrap.cpp:34445: error: 'class wxWindow' has no member named 'SetDoubleBuffered'

This one can be fixed with a patch to include/wx/gtk1/window.h. Add something like this to the wxWindow declaration:

    void SetDoubleBuffered(bool ) {}

Patch submitted.

I didn't see this patch.

Sorry. I forget to submit it. It should be there now.

Now the next thing that I found was an error when compiling src/gtk/_controls_wrap.cpp (the _controls_ extension):

cc1plus: warning: command line option "-Wstrict-prototypes" is valid for C/ObjC but not for C++
src/gtk/_controls_wrap.cpp: In function 'PyObject* _wrap_TextCtrl_SetModified(PyObject*, PyObject*, PyObject*)':
src/gtk/_controls_wrap.cpp:12742: error: no matching function for call to 'wxTextCtrl::SetModified(bool&)'
/Users/sander/Projects/wxpython/include/wx-2.7/wx/gtk1/textctrl.h:140: note: candidates are: void wxTextCtrl::SetModified()

I don't really understand this error. wxTextCtrl for gtk1 has its own SetModified() without parameters (and this won't work here), however wxTextCtrlBase (the parent class) does have a SetModified() that takes a bool as parameter. Any ideas how to fix this?

It probably needs to be tested, but it looks like you can just remove the SetModified in gtk1/textctrl.h, I think the one in the base class should work ok. If not then I would just change the derived class version to take the bool parameter and set m_modified to the value of the parameter.

I also just submitted a patch for this.

Then on with the build and I get this:

···

On 26-okt-2006, at 20:06, Robin Dunn wrote:

cc1plus: warning: command line option "-Wstrict-prototypes" is valid for C/ObjC but not for C++
contrib/glcanvas/gtk/glcanvas_wrap.cpp: In function 'PyObject* _wrap_new_GLContext(PyObject*, PyObject*, PyObject*)':
contrib/glcanvas/gtk/glcanvas_wrap.cpp:2766: error: no matching function for call to 'wxGLContext::wxGLContext(wxGLCanvas*&, const wxGLContext*)'
/Users/sander/Projects/wxpython/include/wx-2.7/wx/gtk1/glcanvas.h:68: note: candidates are: wxGLContext::wxGLContext(bool, wxWindow*, const wxPalette&, const wxGLContext*)
/Users/sander/Projects/wxpython/include/wx-2.7/wx/gtk1/glcanvas.h:63: note: wxGLContext::wxGLContext(bool, wxWindow*, const wxPalette&)
/Users/sander/Projects/wxpython/include/wx-2.7/wx/gtk1/glcanvas.h:61: note: wxGLContext::wxGLContext(const wxGLContext&)
contrib/glcanvas/gtk/glcanvas_wrap.cpp: In function 'PyObject* _wrap_GLContext_SetCurrent(PyObject*, PyObject*, PyObject*)':
contrib/glcanvas/gtk/glcanvas_wrap.cpp:2835: error: no matching function for call to 'wxGLContext::SetCurrent(const wxGLCanvas&)'
/Users/sander/Projects/wxpython/include/wx-2.7/wx/gtk1/glcanvas.h:71: note: candidates are: void wxGLContext::SetCurrent()
contrib/glcanvas/gtk/glcanvas_wrap.cpp: In function 'PyObject* _wrap_GLCanvas_SetCurrent__SWIG_1(PyObject*, int, PyObject**)':
contrib/glcanvas/gtk/glcanvas_wrap.cpp:3178: error: no matching function for call to 'wxGLCanvas::SetCurrent(const wxGLContext&)'
/Users/sander/Projects/wxpython/include/wx-2.7/wx/gtk1/glcanvas.h:143: note: candidates are: void wxGLCanvas::SetCurrent()

This is starting to get very tiresome. I don't mind helping fixing an issue here and there, but I just don't have time to take on full maintenance for the GTK1 backend. Especially if every new change to the GTK2 backend might break the GTK1 backend again.

Fortunately, yesterday I tried to build our application with wxPython 2.7 and the latest version of VTK using GTK2 and the z-ordering issues we saw with the wxvtk binding and earlier versions of wxPython are gone now. So I think I am now going to focus my efforts on wxPython with GTK2.

P.S. If the situation with GTK1 does not improve, then might I suggest putting a big warning sign somewhere for people who want to try to use this backend. It will also reflect rather badly on the image of the whole toolbox if people are confronted with all these build errors.

Best regards,
Sander

Sander Niemeijer wrote:

Then on with the build and I get this:

cc1plus: warning: command line option "-Wstrict-prototypes" is valid for C/ObjC but not for C++
contrib/glcanvas/gtk/glcanvas_wrap.cpp: In function 'PyObject* _wrap_new_GLContext(PyObject*, PyObject*, PyObject*)':
contrib/glcanvas/gtk/glcanvas_wrap.cpp:2766: error: no matching function for call to 'wxGLContext::wxGLContext(wxGLCanvas*&, const wxGLContext*)'
/Users/sander/Projects/wxpython/include/wx-2.7/wx/gtk1/glcanvas.h:68: note: candidates are: wxGLContext::wxGLContext(bool, wxWindow*, const wxPalette&, const wxGLContext*)
/Users/sander/Projects/wxpython/include/wx-2.7/wx/gtk1/glcanvas.h:63: note: wxGLContext::wxGLContext(bool, wxWindow*, const wxPalette&)
/Users/sander/Projects/wxpython/include/wx-2.7/wx/gtk1/glcanvas.h:61: note: wxGLContext::wxGLContext(const wxGLContext&)
contrib/glcanvas/gtk/glcanvas_wrap.cpp: In function 'PyObject* _wrap_GLContext_SetCurrent(PyObject*, PyObject*, PyObject*)':
contrib/glcanvas/gtk/glcanvas_wrap.cpp:2835: error: no matching function for call to 'wxGLContext::SetCurrent(const wxGLCanvas&)'
/Users/sander/Projects/wxpython/include/wx-2.7/wx/gtk1/glcanvas.h:71: note: candidates are: void wxGLContext::SetCurrent()
contrib/glcanvas/gtk/glcanvas_wrap.cpp: In function 'PyObject* _wrap_GLCanvas_SetCurrent__SWIG_1(PyObject*, int, PyObject**)':
contrib/glcanvas/gtk/glcanvas_wrap.cpp:3178: error: no matching function for call to 'wxGLCanvas::SetCurrent(const wxGLContext&)'
/Users/sander/Projects/wxpython/include/wx-2.7/wx/gtk1/glcanvas.h:143: note: candidates are: void wxGLCanvas::SetCurrent()

This would be a bigger change to make as the wxGLCanvas had some significant patches applied to it.

This is starting to get very tiresome. I don't mind helping fixing an issue here and there, but I just don't have time to take on full maintenance for the GTK1 backend. Especially if every new change to the GTK2 backend might break the GTK1 backend again.

It's unfortunately due to the nature of how things work in the wxWidgets project. Ports that don't get active attention tend to bit-rot fairly quickly. If the main developers are not using a port then it may left up to the users of the library to keep it in working order. This may seem like a strange way to operate, but it has the good side effect that no unnecessary work is wasted on a port that nobody is interested in using or thinks is important enough to fight for.

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!