1 setup.py: do not add invalid header locations
3 This piece of code incorrectly adds /usr/include to
4 self.compiler.include_dirs, and results in the following invalid
7 /home/thomas/projets/buildroot/output/host/usr/bin/arm-none-linux-gnueabi-gcc
8 -fPIC -Wno-unused-result -Werror=declaration-after-statement -DNDEBUG -g
9 -O3 -Wall -Wstrict-prototypes -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE
10 -D_FILE_OFFSET_BITS=64 -pipe -Os
11 -I./Include -I/usr/include -I. -IInclude
12 -I/home/thomas/projets/buildroot/output/host/usr/arm-buildroot-linux-gnueabi/sysroot/usr/include
13 -I/home/thomas/projets/buildroot/output/build/python3-3.4.0b1/Include
14 -I/home/thomas/projets/buildroot/output/build/python3-3.4.0b1
15 -c /home/thomas/projets/buildroot/output/build/python3-3.4.0b1/Modules/_struct.c
16 -o build/temp.linux-arm-3.4/home/thomas/projets/buildroot/output/build/python3-3.4.0b1/Modules/_struct.o
17 cc1: warning: include location "/usr/include" is unsafe for cross-compilation [-Wpoison-system-directories]
19 The -I/usr/include is wrong when cross compiling, so we disable adding
20 INCLUDEDIR and LIBDIR from the host when cross compiling.
22 Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
24 ===================================================================
28 add_dir_to_list(dir_list, directory)
30 if os.path.normpath(sys.base_prefix) != '/usr' \
31 - and not sysconfig.get_config_var('PYTHONFRAMEWORK'):
32 + and not sysconfig.get_config_var('PYTHONFRAMEWORK') \
33 + and not cross_compiling:
34 # OSX note: Don't add LIBDIR and INCLUDEDIR to building a framework
35 # (PYTHONFRAMEWORK is set) to avoid # linking problems when
36 # building a framework with different architectures than