[OE-core] [PATCH]] python: Unbreak Python third-party extensions

Michael Lippautz michael.lippautz at gmail.com
Tue May 3 12:09:32 UTC 2011


On Tue, May 03, 2011 at 11:50:50AM +0100, Richard Purdie wrote:
> On Fri, 2011-04-29 at 12:44 +0200, Michael Lippautz wrote:
> > This fixes compilation/linking of Python 3rd party extensions.
> > 
> > ${STAGING_LIBDIR}/python<pyver>/config/Makefile needs the correct
> > INCDIR and LIBDIR settings to be used in cross compilation for the
> > target. 3rd party module use distutils.sysconfig which uses this
> > Makefile to create compiler/linker flags.
> > 
> > Workflow:
> > 1) compile needs the staged/sysroot Makefile since it is needed
> >    for compilation/linking
> > 2) install needs the unmodified Makefile to install files (i.e.
> >    headers) into the right directores. (otherwise they would be
> >    installed in ${D}/${STAGING_...}
> > 3) staging needs modified Makefile again
> > 4) packaging needs unmodified to make compilation on the target
> >    possible
> > 
> > Signed-off-by: Michael Lippautz <michael.lippautz at gmail.com>
> > ---
> >  meta/recipes-devtools/python/python_2.6.6.bb |   25 +++++++++++++++++++------
> >  1 files changed, 19 insertions(+), 6 deletions(-)
> 
> I'm ok with this patch but I am a little worried looking at the python
> recipe that it won't interact well with sstate. I'd therefore like to
> fix this whilst we have someone who understands this code around.
> 
> The problem is that do_compile_prepend() is poking files directly into
> staging. Instead, do_install should be manipulating things in ${D}
> instead and then PACKAGE_PREPROCESS_FUNCS and SYSROOT_PREPROCESS_FUNCS
> should be taking care of any fixups for the target/sysroot cases.
> 
> Can we add the code in the do_compile_prepend() to the start of the
> do_install() ?
> 

As far as I know (I am no expert though) is that we can't do this. Python
cross-compilation is rather complex, because it basically utilizes the same
approach described above to compile its own Python/C extensions.

When you look at the do_compile section of the recipe you notice that
libpython<pyver> is compiled and staged before the actual Python compilation
takes place. This is needed since Python itself uses distutils.sysconfig to link
iits Python/C extensions against -lpython<pyver>.

[Please correct me if I am wrong, but I have tried a few things with this recipe
by now, and couldn't come up with anything better.]

> Cheers,
> 
> Richard
> 

Regards,
Michael




More information about the Openembedded-core mailing list