0002-Fix-get_python_inc-for-cross-compilation.patch 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. From 367ee7d103cf9f670c3925d555edf6f6a5b9d8d5 Mon Sep 17 00:00:00 2001
  2. From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
  3. Date: Tue, 7 Mar 2017 22:17:25 +0100
  4. Subject: [PATCH] Fix get_python_inc() for cross-compilation
  5. When we are cross compiling, doing os.path.dirname(sys.executable) to
  6. get the build directory is incorrect, because we're executing the host
  7. Python to build things for the target. Instead, we should use the
  8. project_base variable.
  9. This fixes cross-compilation, which was adding incorrect header paths
  10. pointing to the location where the host Python was built:
  11. /home/thomas/projets/buildroot/output/host/usr/bin/arm-none-linux-gnueabi-gcc -fPIC -fno-strict-aliasing \
  12. -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -pipe -Os -DNDEBUG -g -O3 -Wall -Wstrict-prototypes \
  13. -I/usr/include -I. -IInclude -I./Include -I/home/thomas/projets/buildroot/output/host/usr/arm-buildroot-linux-gnueabi/sysroot/usr/include \
  14. -I/home/thomas/projets/buildroot/output/host/usr/bin/Include -I/home/thomas/projets/buildroot/output/host/usr/bin \
  15. -c /home/thomas/projets/buildroot/output/build/python-2.7.6/Modules/_struct.c \
  16. -o build/temp.linux2-arm-2.7/home/thomas/projets/buildroot/output/build/python-2.7.6/Modules/_struct.o
  17. This patch allows to fix the
  18. /home/thomas/projets/buildroot/output/host/usr/bin/Include and
  19. /home/thomas/projets/buildroot/output/host/usr/bin paths that are
  20. incorrectly added to the header paths.
  21. Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
  22. ---
  23. Lib/distutils/sysconfig.py | 2 +-
  24. 1 file changed, 1 insertion(+), 1 deletion(-)
  25. diff --git a/Lib/distutils/sysconfig.py b/Lib/distutils/sysconfig.py
  26. index de7da1d..d72b6e5 100644
  27. --- a/Lib/distutils/sysconfig.py
  28. +++ b/Lib/distutils/sysconfig.py
  29. @@ -79,7 +79,7 @@ def get_python_inc(plat_specific=0, prefix=None):
  30. if os.name == "posix":
  31. if python_build:
  32. - buildir = os.path.dirname(sys.executable)
  33. + buildir = project_base
  34. if plat_specific:
  35. # python.h is located in the buildir
  36. inc_dir = buildir
  37. --
  38. 2.7.4