002-fix-get-python-inc.patch 1.8 KB

123456789101112131415161718192021222324252627282930313233343536
  1. Fix get_python_inc() for cross-compilation
  2. When we are cross compiling, doing os.path.dirname(sys.executable) to
  3. get the build directory is incorrect, because we're executing the host
  4. Python to build things for the target. Instead, we should use the
  5. project_base variable.
  6. This fixes cross-compilation, which was adding incorrect header paths
  7. pointing to the location where the host Python was built:
  8. /home/thomas/projets/buildroot/output/host/usr/bin/arm-none-linux-gnueabi-gcc -fPIC -fno-strict-aliasing \
  9. -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -pipe -Os -DNDEBUG -g -O3 -Wall -Wstrict-prototypes \
  10. -I/usr/include -I. -IInclude -I./Include -I/home/thomas/projets/buildroot/output/host/usr/arm-buildroot-linux-gnueabi/sysroot/usr/include \
  11. -I/home/thomas/projets/buildroot/output/host/usr/bin/Include -I/home/thomas/projets/buildroot/output/host/usr/bin \
  12. -c /home/thomas/projets/buildroot/output/build/python-2.7.6/Modules/_struct.c \
  13. -o build/temp.linux2-arm-2.7/home/thomas/projets/buildroot/output/build/python-2.7.6/Modules/_struct.o
  14. This patch allows to fix the
  15. /home/thomas/projets/buildroot/output/host/usr/bin/Include and
  16. /home/thomas/projets/buildroot/output/host/usr/bin paths that are
  17. incorrectly added to the header paths.
  18. Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
  19. Index: b/Lib/distutils/sysconfig.py
  20. ===================================================================
  21. --- a/Lib/distutils/sysconfig.py
  22. +++ b/Lib/distutils/sysconfig.py
  23. @@ -79,7 +79,7 @@
  24. if os.name == "posix":
  25. if python_build:
  26. - buildir = os.path.dirname(sys.executable)
  27. + buildir = project_base
  28. if plat_specific:
  29. # python.h is located in the buildir
  30. inc_dir = buildir