Skip to contentSkip to conversation

Building Python extensions

DISCUSSION Marcin Juszkiewicz 2 participants 4 messages Mar 23, 2007 – Aug 22, 2007

lore
Share & tools
lore
#0 lore raw

Thanks to Mickeyl's work we have nice support for building Python and Python related stuff in OpenEmbedded.

Recently I was working for OpenedHand on project which required lot of Python work to get stuff done. And I got hit by lot of problems due to 64bit host environment while I was building for 32bit target. In short:
it is miracle that Python stuff was building before...

Longer version:

When we build Python extension (for example python-pygtk2) configure script builds one test program to check does it has Python headers. On my system it mostly failed due to this part of python2.4/pyport.h header:

#if LONG_BIT != 8 * SIZEOF_LONG
/* 04-Oct-2000 LONG_BIT is apparently (mis)defined as 64 on some recent
* 32-bit platforms using gcc. We try to catch that here at compile-time
* rather than waiting for integer multiplication to trigger bogus
* overflows.
*/
#error "LONG_BIT definition appears wrong for platform (bad gcc/glibc config?)."
#endif

And all because wrong include path is used:

configure:9284: checking for headers required to compile python extensions configure:9303: arm-linux-gcc -E -isystem/a/home/hrw/devel/build/cel/tmp/staging/arm-linux/include -I/a/home/hrw/devel/build/cel/tmp/staging/i686-linux/include/python2.4 conftest.c

So as long as we are building for target of same size as host (32bit for 32bit) everything is ok but everything is going to break for 64bit -> 32bit (or vice versa).

I got fix for it of course. M4 scripts of each used Python extensions use macro AM_CHECK_PYTHON_HEADERS which I edited to add one option to
configure: --with-python-includes which should be pointed to ${STAGING_INCDIR}/../ to get it working.

I will sync some of Python extensions with this fix from Poky into OpenEmbedded in next days (python-pygtk2 already pushed).

Signature · 5 lines
JID: hrw-jabber.org
OpenEmbedded developer/consultant

           Q:      What's a light-year?
           A:      One-third less calories than a regular year.
#1 lore raw

(Sorry for the long delay... :)

Marcin Juszkiewicz wrote on 23th of March:

Quoted 2 lines

When we build Python extension (for example python-pygtk2) configure script builds one test program to check does it has Python headers.

So this is a problem with python packages using autotools only, right? (I remember I patched distutils to take care about that).

Quoted 4 lines

I got fix for it of course. M4 scripts of each used Python extensions use macro AM_CHECK_PYTHON_HEADERS which I edited to add one option to
configure: --with-python-includes which should be pointed to ${STAGING_INCDIR}/../ to get it working.

So just adding to EXTRA_OECONF will do?

Quoted 2 lines

I will sync some of Python extensions with this fix from Poky into OpenEmbedded in next days (python-pygtk2 already pushed).

Since we don't have that many extensions using autotools, we can fix this easily.

Regards,

:M:

Signature · 1 line
Michael 'Mickey' Lauer | IT-Freelancer | http://www.vanille-media.de
#2 lore raw
Quoted 6 lines · Dr. Michael Lauer

Marcin Juszkiewicz wrote on 23th of March:

Quoted 2 lines

When we build Python extension (for example python-pygtk2) configure script builds one test program to check does it has Python headers.

So this is a problem with python packages using autotools only, right? (I remember I patched distutils to take care about that).

looks like it

Quoted 6 lines
Quoted 4 lines

I got fix for it of course. M4 scripts of each used Python extensions use macro AM_CHECK_PYTHON_HEADERS which I edited to add one option to
configure: --with-python-includes which should be pointed to ${STAGING_INCDIR}/../ to get it working.

So just adding to EXTRA_OECONF will do?

Need to patch acinclude.m4 too.

Quoted 5 lines
Quoted 2 lines

I will sync some of Python extensions with this fix from Poky into OpenEmbedded in next days (python-pygtk2 already pushed).

Since we don't have that many extensions using autotools, we can fix this easily.

you or me?

Signature · 4 lines
JID: hrw-jabber.org
OpenEmbedded developer/consultant

        Linux! -- Because a big world can not fit in small windows.
#3 lore raw
Quoted 7 lines · Marcin Juszkiewicz
Quoted 5 lines
Quoted 2 lines

I will sync some of Python extensions with this fix from Poky into OpenEmbedded in next days (python-pygtk2 already pushed).

Since we don't have that many extensions using autotools, we can fix this easily.

you or me?

If you have time, please take a shot. I'm on Froscon07 and on MDD07 and won't have time before returning from Denmark (early September).

Regards,

:M:

Signature · 1 line
Michael 'Mickey' Lauer | IT-Freelancer | http://www.vanille-media.de