Compiling and Linking pre-built Windows Python libraries with C++ files on Linux for Windows

Christian Gollwitzer auriocus at gmx.de
Sat Mar 19 02:04:33 EDT 2022


Am 19.03.22 um 01:08 schrieb Ankit Agarwal:
> This is a very specific question. I am trying to figure out whether or not
> I can use pre-built python libraries and headers on Windows in a MinGW
> build on Linux.

With the mingw cross-compiler on Linux that should be possible, however 
I guess it might be difficult to set it up. Setuptools is not good for 
crosscompiling. The easiest way to build Python extensions across 
multiple OSes is cibuildwheel: https://github.com/pypa/cibuildwheel

Especially if your code lives on Github, then you can simply add 
cibuildwheel to your workflow and it will build for multiple OSes and 
Python versions on every commit. For OpenSource projects, Githubs build 
servers are  even for free! Otherwise, the prices are moderate as well.

If you happen to have your own build server farm (as in a commercial 
setting) then you can also use other CI tools with cibuildwheel.

	Christian


More information about the Python-list mailing list