This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author yan12125
Recipients doko, hundeboll, thomas-petazzoni, vstinner, xdegaye, yan12125, zach.ware
Date 2016-12-10.09:35:00
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1481362500.83.0.04248775804.issue20211@psf.upfronthosting.co.za>
In-reply-to
Content
xdegaye's explanation is incorrect. The actual scene is much more complicated. First, let me explain why things may be broken. The wrong directory is included only if all of the following conditions are met:

1. PYTHON_FOR_BUILD is not installed with --prefix=/usr. A common example is those which are installed with pyenv. This condition is here simply because of `os.path.normpath(sys.base_prefix) != '/usr'`
2. The build script uses $DESTDIR convention to compile CPython
3. Header files in $DESTDIR$PREFIX/include are not equivalent to $PREFIX/include. Here "equivalent" means they are for the same set of architecture/kernel/... This is a common case when cross compiling, while a famous exception is the multiarch framework on Debian-based systems.

For example, if I use --prefix=/usr and DESTDIR=/tmp/python3-android/build, INCLUDEDIR will be /usr/include, which should not be included. On the other hand, if I use --prefix=/tmp/python3-android/build/usr and omit DESTDIR, INCLUDEDIR is correct /tmp/python3-android/build/usr/include. With $DESTDIR specified, the build script has the responsibility to specify $DESTDIR$PREFIX/include in CPPFLAGS, or CPython interpreter core won't even build, so skipping adding INCLUDEDIR in setup.py is safe. However, for the latter case (not using DESTDIR), the build script still needs to specify correct CPPFLAGS. I see it as a CPython limitation and worth documentation.

For Debian's multiarch framework, paths are already handled by add_multiarch_paths(). I'm not sure whether $PREFIX/include should still be included or not. (I don't use Debian-based systems)
History
Date User Action Args
2016-12-10 09:35:00yan12125setrecipients: + yan12125, doko, vstinner, xdegaye, zach.ware, thomas-petazzoni, hundeboll
2016-12-10 09:35:00yan12125setmessageid: <1481362500.83.0.04248775804.issue20211@psf.upfronthosting.co.za>
2016-12-10 09:35:00yan12125linkissue20211 messages
2016-12-10 09:35:00yan12125create