Bug 22940 - Pycairo can't compile on Win32/VisualStudio
Summary: Pycairo can't compile on Win32/VisualStudio
Alias: None
Product: pycairo
Classification: Unclassified
Component: general (show other bugs)
Version: unspecified
Hardware: Other Windows (All)
: medium normal
Assignee: Steve Chaplin
QA Contact:
Depends on:
Reported: 2009-07-24 17:16 UTC by Alberto Ruiz
Modified: 2017-07-05 15:12 UTC (History)
4 users (show)

See Also:
i915 platform:
i915 features:

Move variable declarations to the top of the functions (3.63 KB, patch)
2009-08-04 04:07 UTC, Alberto Ruiz
Details | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Alberto Ruiz 2009-07-24 17:16:59 UTC
Pycairo doesn't compile on win32/VisualStudio, some .c code is assuming C99 (arbitrary variable declaration) and the setup.py file needs some fixes.

I have created a patch against the latest release that fixes the issues.
Comment 1 Steve Chaplin 2009-08-03 22:47:23 UTC
This is a very poor bug report:
- it does not describe how to reproduce the bug
- it looks like it is describing 2 bugs in one bug report
- it mentions a patch, but no patch is attached

Have a look at these links for advice on how to file bug reports:
Comment 2 Alberto Ruiz 2009-08-04 04:07:08 UTC
Created attachment 28338 [details] [review]
Move variable declarations to the top of the functions
Comment 3 Alberto Ruiz 2009-08-04 04:29:23 UTC
That was a very poor comment:

1) It didn't have any positive feedback towards the reporter, that kind of answers are discouraging and bug reports are needed.
2) It didn't take into account that the bugzilla patch submission might have done silly things (I uploaded the patch twice with the confirmation page!)

Anyway, you are right, I didn't say how to reproduce it explicitely, I thought that mentioning that I can't compile on Windows using Visual Studio was enough.

You login into a Windows host, install Visual Studio, install cairo (for example, using the Gtk+ bundle) and try to run setup.py.

Alternatively, you can run GCC with C99 disabled, that would allow you to reproduce the most relevant issues.
Comment 4 Alberto Ruiz 2009-08-14 08:57:31 UTC
Steve, any comments on the patch?

I've noticed that a new git repository has been setup which is good news.
Comment 5 Steve Chaplin 2009-08-26 04:43:30 UTC
Your compiler does not support the current C standard. I suggest opening a bug report for the compiler.
Comment 6 Alberto Ruiz 2009-08-26 05:14:39 UTC
Not posssible, Microsoft already stated that they won't support all the C99 features.

Python modules for Windows are expected and recommended to be built with the same Visual Studio version than the standard Python distribution for Windows.

If you don't accept this patch a branch would need to be created to have any sort of regular Windows builds for pycairo (and therefore pygtk). So I ask you to reconsider this patch as it has a minimum impact on the code and basically gets in the way of pygtk having regular releases on Windows (which is my motivation for this to go in).

I'd love to use MinGW if it wasn't unsupported by Python modules on windows to be honest, but that's just not the case and I don't want pygtk to rely on an unsupported toolchain for official releases.
Comment 7 Alberto Ruiz 2009-08-28 02:59:02 UTC
Steve, look at this pygtk thread where someone else has run into this problem:

Carlos Alberto makes a really good point, Cairo does not assume C99, and pycairo shouldn't go further than Cairo itself.

If you're too busy to take care of these things I volunteer myself to request commit access and take care of committing the pathces.

Comment 8 Ignacio Casal Quinteiro 2009-11-20 15:59:59 UTC
Steve, would be really appreciated to get this in, so Alberto can try to get pygtk working on windows and in this way I can get gedit python modules working finally on windows too.
Comment 9 Armin Burgmeier 2009-12-18 09:06:42 UTC
I'd also be happy to be able to use a more recent pygtk (plus dependencies) for the Windows version of Glom.
Comment 10 Rafael Villar Burke 2010-01-22 04:29:13 UTC
If the C99 changes are too controversial, could at least the setup changes be applied to also allow a clean build using MingW?

Also, aren't the changes to avoid C99 syntax minor enough if the benefit is enabling the recommended way of building the bindings (python.org uses VS)?

AFAICT, the goal of being able to use a VS based toolchain is being able to eventually build msi installers for mass deployment.
Comment 11 Alberto Ruiz 2013-07-17 21:03:22 UTC
Comment 12 Christoph Reiter 2017-07-05 15:12:27 UTC
Fixed since 1.12: https://github.com/pygobject/pycairo/issues/5

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct.