Cross compiling

25 views
Skip to first unread message

Ruben De Smet

unread,
Mar 25, 2016, 5:23:03 PM3/25/16
to min...@googlegroups.com
Hello,

I'm currently working on a Python module, which I'd like to set under CI
using mingw on a Linux machine.

I can get it compiled and linked using mingw under Arch Linux, but it
doesn't run when loaded (MemoryError).

Is this project the one I should watch for development on that topic? I
would compile the thing using MSVC, but I'm using C99 variadic macro's,
so that doesn't really work.

I would like to get subscribed to this list, but I am unable to (except
for my gmail.com account, but I do not read that).

Ruben

Nathaniel Smith

unread,
Mar 25, 2016, 5:49:38 PM3/25/16
to mingwpy, Ruben De Smet
On Fri, Mar 25, 2016 at 2:23 PM, Ruben De Smet <ruben....@rubdos.be> wrote:
> Hello,
>
> I'm currently working on a Python module, which I'd like to set under CI
> using mingw on a Linux machine.
>
> I can get it compiled and linked using mingw under Arch Linux, but it
> doesn't run when loaded (MemoryError).
>
> Is this project the one I should watch for development on that topic? I
> would compile the thing using MSVC, but I'm using C99 variadic macro's,
> so that doesn't really work.

Yes, mingwpy should allow you to use gcc to build Python modules for
windows targeting python 2.6 / 2.7 / 3.3 / 3.4.

Currently it's only been tested for building Windows-native compilers,
but it should be possible to build mingwpy as a cross-compiler in
principle, and is definitely a desirable feature. I don't know
anything about how mingw cross-compilers are generally built, but if
you figure it out then we'd definitely like to know :-). (For all I
know it might be as simple as just running the existing build script
on Linux -- the scripts are written in bash.) Otherwise then probably
someone else will get around to doing this at some point, but it's
hard to know when.

> I would like to get subscribed to this list, but I am unable to (except
> for my gmail.com account, but I do not read that).

The general rule for google groups is that you can subscribe with a
non-gmail address... *unless* you have a google account that has both
your non-gmail address associated with it, and also a gmail address.
If your non-gmail address and gmail address are both associated with
the same google account, then in that case google forces you to use
the gmail address. It's *extremely* annoying :-(. But maybe that gives
you some clue for how to work around it...

(I guess you could make some free email address somewhere -- possibly
even gmail -- and configure it to forward all email to your real
account, and then subscribe that address to the list.)

-n

--
Nathaniel J. Smith -- https://vorpus.org

Ruben De Smet

unread,
Mar 25, 2016, 6:02:48 PM3/25/16
to Nathaniel Smith, mingwpy
On 03/25/2016 10:49 PM, Nathaniel Smith wrote:
> On Fri, Mar 25, 2016 at 2:23 PM, Ruben De Smet <ruben....@rubdos.be> wrote:
>> Hello,
>>
>> I'm currently working on a Python module, which I'd like to set under CI
>> using mingw on a Linux machine.
>>
>> I can get it compiled and linked using mingw under Arch Linux, but it
>> doesn't run when loaded (MemoryError).
>>
>> Is this project the one I should watch for development on that topic? I
>> would compile the thing using MSVC, but I'm using C99 variadic macro's,
>> so that doesn't really work.

I will probably rewrite those macro's tomorrow into something less C99,
so this project can go on, but after that I'm still very interested in
mingw because of CI and stuff like that.

>
> Yes, mingwpy should allow you to use gcc to build Python modules for
> windows targeting python 2.6 / 2.7 / 3.3 / 3.4.
>
> Currently it's only been tested for building Windows-native compilers,
> but it should be possible to build mingwpy as a cross-compiler in
> principle, and is definitely a desirable feature. I don't know
> anything about how mingw cross-compilers are generally built, but if
> you figure it out then we'd definitely like to know :-). (For all I
> know it might be as simple as just running the existing build script
> on Linux -- the scripts are written in bash.) Otherwise then probably
> someone else will get around to doing this at some point, but it's
> hard to know when.

I will probably try very soon, probably this weekend.

What exactly are the differences with a normal mingw compiler? I read
about defaulting to static linkage of libgcc and libstdc++, but I can
achieve that too by using a regular mingw-w64 (`-static -static-libgcc
-static-libstdc++`).

>
>> I would like to get subscribed to this list, but I am unable to (except
>> for my gmail.com account, but I do not read that).
>
> The general rule for google groups is that you can subscribe with a
> non-gmail address... *unless* you have a google account that has both
> your non-gmail address associated with it, and also a gmail address.
> If your non-gmail address and gmail address are both associated with
> the same google account, then in that case google forces you to use
> the gmail address. It's *extremely* annoying :-(. But maybe that gives
> you some clue for how to work around it...

I've managed to ask for a subscription by sending an email to
mingw+subscribe at googlegroups dot com.

I wrongly sent an e-mail via another e-mail account; you can ignore that.

>
> (I guess you could make some free email address somewhere -- possibly
> even gmail -- and configure it to forward all email to your real
> account, and then subscribe that address to the list.)

I have my own e-mail server, that should do the trick imo :p

Thank you,

Ruben


signature.asc

carlkl

unread,
Mar 26, 2016, 2:45:37 AM3/26/16
to mingwpy, n...@vorpus.org, ruben....@rubdos.be
You can use the old mingwpy builds on my conda channel:

pip install -i https://pypi.anaconda.org/carlkl/simple mingwpy

right now and switch to the new builds once they are ready.

Carl

Am Freitag, 25. März 2016 23:02:48 UTC+1 schrieb Ruben De Smet:
On 03/25/2016 10:49 PM, Nathaniel Smith wrote:

Ruben De Smet

unread,
Mar 26, 2016, 5:31:26 PM3/26/16
to carlkl, mingwpy, n...@vorpus.org
On 03/26/2016 07:45 AM, carlkl wrote:
> You can use the *old *mingwpy builds on my conda channel:
>
> pip install -i https://pypi.anaconda.org/carlkl/simple mingwpy
>
> right now and switch to the new builds once they are ready.
>

Thank you. Am I correct that these only run under Windows? If so, it
would probably already be of a big help.

Can I invoke these without using distutils?

Our project is something that's not really a Python module, but a plugin
for Blender and it needs our own build system.

In any case, thank you for helping out.

carlkl

unread,
Mar 26, 2016, 5:43:25 PM3/26/16
to mingwpy, cmkle...@gmail.com, n...@vorpus.org, ruben....@rubdos.be
You have to download the approbriate wheel file, extract the share/mingwpy folder to a suitable place and add mingwpy/bin to the PATH. In a next step you have to copy the import libraries for python and the C-runtime DLL (i.e. libpython27.dll.a and msvcr90.dll) to the approbriate python libs folder. Thats all hopefully.

Happy Eastern!

Ruben De Smet

unread,
Mar 26, 2016, 6:06:23 PM3/26/16
to carlkl, mingwpy, n...@vorpus.org
Ow. I'm using Python 3.5... :) I guess I'll have to wait for the next
build ;)

Happy Eastern indeed!

Ruben.
Reply all
Reply to author
Forward
0 new messages