uboot-kirkwood (at least) fails to build if swig is installed but python headers are not available
Username: Nathaniel Wesley Filardo
Origin: https://bugs.openwrt.org/index.php?do=details&task_id=659
Building LEDE head (reboot-3906-g2a2dfb2be7) on a machine without python development headers but with swig in $PATH yields
HOSTLD tools/dumpimage
HOSTCC tools/mkimage.o
HOSTLD tools/mkimage
swig -python -o tools/libfdt_wrap.c lib/libfdt/libfdt.swig
LDFLAGS="" python ./lib/libfdt/setup.py
"-Wall -Wstrict-prototypes -O2 -fomit-frame-pointer -include ./include/libfdt_env.h -idirafterinclude -idirafter./arch/arm/include -I./lib/libfdt -I./tools -DUSE_HOSTCC -D__KERNEL_STRICT_NAMES -D_GNU_SOURCE " lib/libfdt/fdt.c lib/libfdt/fdt_ro.c lib/libfdt/fdt_rw.c lib/libfdt/fdt_strerror.c lib/libfdt/fdt_wip.c lib/libfdt/fdt_region.c lib/libfdt/fdt_sw.c tools/libfdt_wrap.c
tools/libfdt_wrap.c:130:21: fatal error: Python.h: No such file or directory
include <Python.h>
^
compilation terminated. error: command 'x86_64-linux-gnu-gcc' failed with exit status 1 tools/Makefile:123: recipe for target 'tools/_libfdt.so' failed make[5]: *** [tools/_libfdt.so] Error 1 Makefile:1229: recipe for target 'tools' failed make[4]: *** [tools] Error 2 make[4]: Leaving directory '/tank/openwrt/scratch/builder-nwftest/build_dir/target-arm_xscale_musl_eabi/u-boot-pogo_v4/u-boot-2017.03'
As I don’t believe there are any in-tree consumers of the python libfdt bindings, adding the following patch file, which just removes the test for swig and therefore acts as if it is never present, should do the right thing:
$ cat package/boot/uboot-kirkwood/patches/201-no-python-fdt.patch --- u-boot-2017.03/tools/Makefile.orig 2017-03-28 03:11:34.081325904 +0000 +++ u-boot-2017.03/tools/Makefile 2017-03-28 03:13:09.225349051 +0000 @@ -112,10 +112,6 @@ fit_info-objs := $(dumpimage-mkimage-objs) fit_info.o fit_check_sign-objs := $(dumpimage-mkimage-objs) fit_check_sign.o
-# Build a libfdt Python module if swig is available -# Use 'sudo apt-get install swig libpython-dev' to enable this -hostprogs-y += \
- $(if $(shell which swig 2> /dev/null),_libfdt.so) _libfdt.so-sharedobjs += $(LIBFDT_OBJS) libfdt: