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

Khem Raj raj.khem at gmail.com
Mon Jun 20 12:23:42 PDT 2016


On Mon, Jun 20, 2016 at 12:08 PM, Daniel. <danielhilst at gmail.com> wrote:
> 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.


OE has several classes where common operations are abstracted out and
you can see that in recipes
e.g. inherit setuptools etc. you should copy the recipe which is
closest to your package and modify it
to use your package source etc. and make other needed tweaks.

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



More information about the yocto mailing list