[yocto] How does python-native work?

Gary Thomas gary at mlbassoc.com
Wed Apr 23 08:44:52 PDT 2014


On 2014-04-23 09:37, Chris Larson wrote:
>
> On Wed, Apr 23, 2014 at 7:57 AM, Gary Thomas <gary at mlbassoc.com <mailto:gary at mlbassoc.com>> wrote:
>
>     On 2014-04-23 08:21, Chris Larson wrote:
>
>         On Wed, Apr 23, 2014 at 7:15 AM, Gary Thomas <gary at mlbassoc.com <mailto:gary at mlbassoc.com> <mailto:gary at mlbassoc.com <mailto:gary at mlbassoc.com>>> wrote:
>
>              How is python-native supposed to work?  I can see that it's
>              built and installed in my tmp/sysroots/HOST but it's installed
>              in a sub-directory which is not found by normal means.
>
>
>         inherit pythonnative (or one of the classes that inherit it)
>
>
>     Thanks, I imported 'distutils' and that helped, but I still have problems with it.  Looking
>     at log.do_configure:
>        checking for python... /local/rpi_2014-04-10/tmp/__sysroots/x86_64-linux/usr/bin/__python-native/python
>        checking for python-config... /local/rpi_2014-04-10/tmp/__sysroots/x86_64-linux/usr/bin/__python-native/python-config
>        Traceback (most recent call last):
>          File "/local/rpi_2014-04-10/tmp/__sysroots/x86_64-linux/usr/bin/__python-native/python-config", line 6, in <module>
>            from distutils import sysconfig
>          File "/local/rpi_2014-04-10/tmp/__sysroots/x86_64-linux/usr/lib/__python2.7/distutils/sysconfig.__py", line 22, in <module>
>            PREFIX = os.path.normpath(sys.prefix).__replace( os.getenv("BUILD_SYS"), os.getenv("HOST_SYS") )
>        TypeError: expected a character buffer object
>
>     When I ran python-config before (original email), the results
>     were from outside the build environment, i.e. the command line
>     where I run 'bitbake'.  When do_configure() runs in my recipe,
>     the environment seems to be quite different.  If I try to run
>     python-config from devshell (for my recipe), it fails as above.
>
>
> First, it's a bit worrisome that you're inheriting a class for distutils when your build doesn't actually use distutils.. but beyond that, I don't think the classes inherited by
> distutils assume you'll be running python-config. Add this:
>
>      export BUILD_SYS
>      export HOST_SYS

I went back to only inheriting pythonnative (I was a bit
overzealous to follow your 'or a class that inherits it').

I found that I also needed:
   export STAGING_INCDIR
   export STAGING_LIBDIR

Perhaps pythonnative should imply those exports, as without
them, python-config is useless.

Anyway, now the recipe successfully builds the python interface!!

Thanks for the help

-- 
------------------------------------------------------------
Gary Thomas                 |  Consulting for the
MLB Associates              |    Embedded world
------------------------------------------------------------



More information about the yocto mailing list