I have noticed that several mature Python libraries have precompiled versions for most architectures (Win32/Win-amd64/MacOS) and versions of Python. What is the standard way to cross-compile your extensions for different environments? Wine? Virtual machines? Crowd sourcing?
-
2You can find some limited information about this in the official Python docs.Niklas B.– Niklas B.2012-01-04 04:22:37 +00:00Commented Jan 4, 2012 at 4:22
-
Thanks, but this answers the question only partially.golobor– golobor2012-01-04 05:48:07 +00:00Commented Jan 4, 2012 at 5:48
-
I think Christoph Gohlke could answer this question. I brought his attention to it.Piotr Dobrogost– Piotr Dobrogost2012-01-04 14:00:37 +00:00Commented Jan 4, 2012 at 14:00
-
Is this a question of how to develop cross platform code or the actual cross compiling?Demolishun– Demolishun2012-01-09 07:48:26 +00:00Commented Jan 9, 2012 at 7:48
-
Sorry for the late answer. The question is about actual cross compiling. I have seen that some serious projects (i.e. Numpy) have a package for almost every popular architecture. So the question is how do they usually do this? Do people have a physical/virtual machine with these OSes, or they crowd source actual compilation, or there is some online service for cross-compiling?golobor– golobor2012-01-20 05:05:31 +00:00Commented Jan 20, 2012 at 5:05
3 Answers
We use Virtual Machines and a Hudson server.
We have a Virtual Machine for each architecture we support (generally compiling doesn't stretch the resources allocated to them, so a VM is fine). I guess the configuration of each VM could be managed by something like Puppet or Chef to ensure it is a suitable build environment. You could of course use real machines if you have the hardware, but you'd want to avoid using machines which people are actually using (e.g. developer workstations).
We then use a multi-configuration project in Hudson to setup a build matrix. The build matrix allows us to (with a single click) build multiple python versions, on multiple architectures, but in theory you can build every and any combination you can setup in your matrix. Of course you could use Jenkins instead.
3 Comments
SWIG provides a path for multiplatform code generation.
1 Comment
All of my Python extension modules are C++, not C so I use boost Python. I also use virtual machines when I need to support different operating systems. Boost's bjam build driver allows you to build with different versions of Python (2.6, 2.7) different versions of g++ and various other things. If I had an extension module that was very popular and many people wanted to use it on platforms that I do not have, then I would just make sure my code was very portable (it should be anyway) and provide instructions on how I build it with bjam using several different examples for different Python versions, etc. That would be enough to get them started. If this works, you could ask them to contribute their builds back so others could use them (unsupported by you of course).