[yocto] Crosscompiling python extensions with yocto generated toolchains!?

Daniel. danielhilst at gmail.com
Mon Jun 20 12:08:44 PDT 2016


I've found this recipe "python-pycurl" with exports libcurl to python. What
I did was build it and take a look at temp folder to stalk what line is
used to compile that stuff. Here it is:

distutils_do_compile() {

STAGING_INCDIR=/home/geckos/yocto/yocto-daisy/build_x11/tmp/sysroots/pharosserver-imx6/usr/include
\

STAGING_LIBDIR=/home/geckos/yocto/yocto-daisy/build_x11/tmp/sysroots/pharosserver-imx6/usr/lib
\
         BUILD_SYS=x86_64-linux HOST_SYS=arm-poky-linux-gnueabi \

/home/geckos/yocto/yocto-daisy/build_x11/tmp/sysroots/x86_64-linux/usr/bin/python-native/python
setup.py build  || \
         bbfatal "python setup.py build_ext execution failed."

}


So I go to my extension's source folder and paste
STAGING_INCDIR=/home/geckos/yocto/yocto-daisy/build_x11/tmp/sysroots/pharosserver-imx6/usr/include
\
STAGING_LIBDIR=/home/geckos/yocto/yocto-daisy/build_x11/tmp/sysroots/pharosserver-imx6/usr/lib
\
BUILD_SYS=x86_64-linux HOST_SYS=arm-poky-linux-gnueabi \
/home/geckos/yocto/yocto-daisy/build_x11/tmp/sysroots/x86_64-linux/usr/bin/python-native/python
setup.py build

and everything works fine, I got my extension compiled. So, in what magic
are these enviroment variables envolved? STAGING_INCDIR
and STAGING_LIBDIR are OE stuff, what are these BUILD_SYS and HOST_SYS
related?! I'm still searching, anyway thanks Khen for
pointing me meta-python sources. It helped me a lot.

Regards,


2016-06-20 15:29 GMT-03:00 Daniel. <danielhilst at gmail.com>:

> Thank you Khem!!
>
> Regards,
>
> 2016-06-20 15:02 GMT-03:00 Khem Raj <raj.khem at gmail.com>:
>
>> On Mon, Jun 20, 2016 at 10:44 AM, Daniel. <danielhilst at gmail.com> wrote:
>> > Hi everybody..
>> >
>> > I've been playing with python extensions. Now I want to compile a simple
>> > hello world extension
>> > to my Yocto's target, but I really can't find any good resource about
>> doing
>> > it. So what is the teory behind it?
>> >
>> > I know that I need python headers "Python.h and others" and that I need
>> > distutils installed. After that everything is done by distutils and
>> setup.py
>> > script, but what is done is a mistery. I found distutilscross on
>> internet
>> > but no documentation about it!?
>> >
>> > How are python extensions cross-compiled by Yocto? Can somebody point
>> me an
>> > example?!
>>
>> take a look at meta-python.
>>
>> http://cgit.openembedded.org/meta-openembedded/tree/meta-python
>>
>> You might find some examples close to what you are looking for.
>>
>> >
>> > Regards,
>> >
>> > --
>> > "Do or do not. There is no try"
>> >   Yoda Master
>> >
>> > --
>> > _______________________________________________
>> > yocto mailing list
>> > yocto at yoctoproject.org
>> > https://lists.yoctoproject.org/listinfo/yocto
>> >
>>
>
>
>
> --
> *"Do or do not. There is no try"*
>   *Yoda Master*
>



-- 
*"Do or do not. There is no try"*
  *Yoda Master*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.yoctoproject.org/pipermail/yocto/attachments/20160620/ec759036/attachment.html>


More information about the yocto mailing list