Re: Distributing Python to Losedows useds

1 reply [Última entrada]
Parodper
Desconectado
Joined: 05/01/2020

O 21/04/22 ás 14:40, name at domain escribiu:
> Normally, this would be fairly easily achieved by bundling a Python
> interpreter with the program. Unfortunately, the existing tools for the
> job rely on Python built with nonfree M$ Visual Studio compiler. If a
> program relies on nonfree software to build, it cannot be considered
> entirely free. For that reason, I'd like to find a way to cross-compile
> Python interpreter for mingw-w64 using GCC (although LLVM would also be
> OK) under a GNU/Linux system. Such setup doesn't seem to be supported by
> upstream CPython sources but I hope to find some workarounds. For
> example, it seems MSYS2 patches CPython so that it builds with GCC.
> Another idea is to try distributing a Cygwin build of CPython instead. I
> could also try giving PyPy a go.

Not an expert, but I when I had to do something like that I followed
this guide:
https://andreafortuna.org/2017/12/27/how-to-cross-compile-a-python-script-into-a-windows-executable-on-linux

koszkonutek
Desconectado
Joined: 03/19/2020

Yep, this is exactly the kind of tool I meant when I complained about relying on CPython built with nonfree MSVC compiler. If you dig into PyInstaller's source you'll most likely find out that it just fetches a prebuilt Python interpreter from somewhere. In case of Windows (including Wine) that interpreter will be one built with M$' C compiler unless you make your own effort to replace it with for example a GCC-built one.

The problem here is that even though we know GCC can build (a properly patched version of) CPython under Windows, we don't know if it can also do it under Wine. In the past I had an issue with libmariadb which I could not build under Wine because of some missing headers or APIs. Here we might (or might not!) hit the same issue :/