[oe] Building Python extensions

Marcin Juszkiewicz openembedded at hrw.one.pl
Fri Mar 23 11:00:30 UTC 2007


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).

-- 
JID: hrw-jabber.org
OpenEmbedded developer/consultant

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






More information about the Openembedded-devel mailing list