GNOME Bugzilla – Bug 123014
PyGtk build problem on Win32 using the 'distutils' approach.
Last modified: 2004-12-22 21:47:04 UTC
The current CVS head of PyGtk-2.1.x doesn't build on Win32 using the setup.py script. This is a patch to fix that. The major problem is undefined symbols in the official Gtk+-2.2.4 binaries for Win32. So I've added those symbols to the gtk-fake-win32.c file in the form of empty function stubs. Also since support for the GtkGLArea library has now been dropped on the CVS head, I modified the setup.py script to reflect that. The version numbers and the dependency version numbers have also been upgraded.
Created attachment 20207 [details] [review] Patch to fix the current CVS head build problems on Win32.
Could you please resubmit a patch created with -u to diff. It makes it easier to actually read the patch. Thanks (reopen as NEW when you attached the new patch)
Created attachment 22581 [details] [review] The new patch as requested (made with the -u argument to diff).
Aren't those IM related functions you added to gtk-fake-win32.c included in the win32 build? I seem to remember that a particular win32 GTK build missed them due to a bug in the export list for the DLL, rather than them only working on X11. If this is the case, I'd prefer to require a working GTK DLL on Windows. The other changes look sane though (updates to the distutils code for HEAD pygtk).
Yap, you're right. The IM functions now do appear on the CVS HEAD of Gtk+-2.3.1 and I've managed to compile PyGTK CVS HEAD with a modified gtk-fake-win32.c file. Please do take notice that the functions related to GtkPlug/GtkSocket and GdkFont aren't available so I've left those in the gtk-fake-win32.c file still. Following is a new patch (minus the two IM functions from the gtk-fake-win32.c file).
Created attachment 22635 [details] [review] New patch without the IM functions in gtk-fake-win32.c file.
I just applied your setup.py changes in CVS (should make things less broken than they were). I didn't include the gtk-fake-win32.c changes, instead adding the appropriate functions to the ignore-win32 section of the appropriate .overrides file. I also added the gtk_plug_construct_* functions to the ignore list for all platforms, since they shouldn't be needed. Could you check to see whether things look like they are working? In particular, the "if '--enable-threading' in sys.argv:" block looks like it might be slightly broken since you turned threading on by default (it looks like a bit of a hack, but I don't know how it is supposed to be done ...). Thanks for the patches.
The changes are fine. The "if '--enable-threading' in sys.argv" block isn't broken yet since the relevant code in the PyGtkBuild class (the line setting the 'enable_threading' variable to 1) is ineffective. A bit more code is needed to enable threading by default using the proper distutils way. I'll try to submit a patch sometime soon about that on a new bug. Let me know if you want something otherwise about that. Cheers.
Actually, there is still a problem when building the current pygtk CVS against gtk+-2.2.4 on win32. Two IM related functions (im_preedit_style and im_status_style) are still not dll exported in the (official) binary distributions of gtk+-2.2 on win32, namely Tor's binaries (20040124) and the installer from dropline. This is fixed in gtk+ HEAD but because the majority of the pygtk developers on win32 use one of these two sets of binaries, I think we should have a gtk-fake-win32.c that provides the missing *_get_type functions for gtk+-2.2.4 or below. The following patch fixes this issue. It has been tested with both gtk+-2.2.4 (dropline distribution) and gtk-2.3.x (CVS as of 20040308). However, when compiled against gtk+-2.2.4 with the fake *_get_type for im_preedit and im_status, I get those warnings ** (hello.py:3768): WARNING **: `(nil)' is not an enum type ** (hello.py:3768): WARNING **: `(nil)' is not an enum type Removing the corresponding pyg_enum_add_constants functions manually in the generated gtk/gtk.c fixes this issue, but is there a cleaner way of doing this (by adding an appropriate entry in gtk.override for example) ?
Created attachment 25375 [details] [review] Adds some fake *_get_type functions to gtk-fake-win32.c
Forget about the previous patch. This new one fixes the warning ** (hello.py:3768): WARNING **: `(nil)' is not an enum type The solution is of course to provide a copy (from gtktypebuiltins.c) of the *_get_type functions that are not dll exported. This is of course a temporary, win32-specific, messy hack that will be removed as soon as gtk+-2.4 binaries are made available for the win32 platform. In the meantime, we have to make sure that the upcoming pygtk-2.2 compiles against the binaries that are available today (the installer from dropline or Tor zip distribution)
Created attachment 25438 [details] [review] Add a copy of some missing *_get_type functions to gtk-fake-win32.c
Is this still an issue? Or can we just live on and move to 2.4 ?
This problem is fixed in GTK+-2.4. pygtk-2.2 works nicely on win32 against the GTK+-2.4 runtime (as provided for example by the gladewin32 installer). Let's move on and close this bug if nobody complains.
Great. Closing.