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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  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. [Asaf: update for 2.7.17]
  23. Signed-off-by: Asaf Kahlon <asafka7@gmail.com>
  24. ---
  25. Lib/distutils/sysconfig.py | 2 +-
  26. 1 file changed, 1 insertion(+), 1 deletion(-)
  27. diff --git a/Lib/distutils/sysconfig.py b/Lib/distutils/sysconfig.py
  28. index 1a4b792644..14c7d81c48 100644
  29. --- a/Lib/distutils/sysconfig.py
  30. +++ b/Lib/distutils/sysconfig.py
  31. @@ -85,7 +85,7 @@ def get_python_inc(plat_specific=0, prefix=None):
  32. if os.name == "posix":
  33. if python_build:
  34. if sys.executable:
  35. - buildir = os.path.dirname(sys.executable)
  36. + buildir = project_base
  37. else:
  38. # sys.executable can be empty if argv[0] has been changed
  39. # and Python is unable to retrieve the real program name
  40. --
  41. 2.20.1