[U-Boot] [PATCH] libfdt: fix build with Python 3

Stefan Agner stefan at agner.ch
Tue Apr 4 18:44:17 UTC 2017


On 2017-04-04 01:53, Stefano Babic wrote:
> Hi Stefan,
> 
> On 03/04/2017 23:02, Stefan Agner wrote:
> 
>> But then, I don't expect that "/usr/bin/env python" is looking at
>> PYTHON.
>>
>> As far as I understand env, it just looks up the current environment to
>> run its COMMAND argument.
> 
> Agree, this is also mz understanding.
> 
>> It is helpful as a shebang, but it does not
>> seem to make any difference to calling "python" directly (since that
>> also just looks up the current environment PATH and executes the first
>> python it finds...
> 
> Agree - so that is disturbing is the fix calls to "python" inside
> Makefile. That means it remains to change:
> 
> tools/_libfdt.so: $(patsubst %.o,%.c,$(LIBFDT_OBJS)) tools/libfdt_wrap.c
> 	LDFLAGS="$(HOSTLDFLAGS)" CFLAGS= python $(srctree)/lib/libfdt/setup.py
> 
> to:
> 
> tools/_libfdt.so: $(patsubst %.o,%.c,$(LIBFDT_OBJS)) tools/libfdt_wrap.c
> 	LDFLAGS="$(HOSTLDFLAGS)" CFLAGS= ${PYTHON} $(srctree)/lib/libfdt/setup.py
> 

On my host

$ echo Python is \"$PYTHON\"
Python is ""

Wouldn't that break regular builds? Probably wouldn't since shebang
kicks in, but is that really what we want?

What I thought OE was doing is adding the native/x86_64 sysroots in your
path at the beginning, which should already make sure that a regular
"python" call executes OE python... But maybe there is more to it,
especially since setup.py even compiles things...

Maybe we need to peek into distutils/setuptools class to understand how
that works for regular Python modules:
https://github.com/openembedded/openembedded/blob/master/classes/setuptools.bbclass
https://github.com/openembedded/openembedded/blob/master/classes/distutils.bbclass

--
Stefan


More information about the U-Boot mailing list