Issue 15366: venv assumes header files in sys._home + '/Include' (original) (raw)

Created on 2012-07-16 11:30 by sbt, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
distutils-sysconfig.patch sbt,2012-07-16 12:55 review
distutils-sysconfig.patch sbt,2012-07-16 15:17 review
Pull Requests
URL Status Linked Edit
PR 1515 merged python-dev,2017-05-09 12:42
PR 1625 merged vstinner,2017-05-17 00:25
PR 1626 merged vstinner,2017-05-17 00:26
Messages (8)
msg165589 - (view) Author: Richard Oudkerk (sbt) * (Python committer) Date: 2012-07-16 11:30
For Unix I follow the practice suggested in README of running configure from a subdir of the main python directory, eg mkdir release cd release ../configure make But if I create a venv then I cannot use it to compile C extensions because the include dirs are wrong, eg running build running build_ext building 'demo' extension gcc -pthread -Wno-unused-result -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/home/user/Repos/cpython/release/Include -I/home/user/Repos/cpython/release -c demo.c -o build/temp.linux-i686-3.3/demo.o demo.c:1:20: fatal error: Python.h: No such file or directory compilation terminated. error: command 'gcc' failed with exit status 1 The problem seems to be that distutils.sysconfig.get_python_inc() assumes that if sys._home is set (as it is in a virtual env) then the standard header files can be found in sys._home + '/Include'. But for my venv this is wrong, since sys._home is "/home/user/Repos/cpython/release" and "/home/user/Repos/cpython/release/Include" is empty. Instead get_python_inc() should return "/home/user/Repos/cpython/Include". BTW, a seperate issue seems to be that ${venv}/include is not added to the list of include dirs used when compiling.
msg165598 - (view) Author: Richard Oudkerk (sbt) * (Python committer) Date: 2012-07-16 12:55
The attached patch seems to fix the problem.
msg165624 - (view) Author: Richard Oudkerk (sbt) * (Python committer) Date: 2012-07-16 15:17
Updated patch. Old one broke test_distutils...
msg165642 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2012-07-16 17:25
New changeset 998c8a8f2aea by Vinay Sajip in branch 'default': Closes #15366: Corrected computation of include location for source builds. Thanks to Richard Oudkerk for the bug report and patch. http://hg.python.org/cpython/rev/998c8a8f2aea
msg293301 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2017-05-09 11:23
I reverted the commit in 2.7, 3.5, 3.6 and master (3.7) branches to fix bpo-30273, but I'm unable to reproduce this bug so it seems like venv and virtualend have been updated in the meanwhile to add ${venv}/include to the include directories. See for example the commit ab6b962ef241be97536573d7490ce1cfc74fde18.
msg293322 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2017-05-09 15:24
New changeset dbdea629e2e0e4bd8845aa55041e0a0ca4172cf3 by Victor Stinner (Jeremy Kloth) in branch 'master': bpo-30273: update distutils.sysconfig for venv's created from Python (#1515) https://github.com/python/cpython/commit/dbdea629e2e0e4bd8845aa55041e0a0ca4172cf3
msg293833 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2017-05-17 00:58
New changeset 460945f22acd288e660b432b288d9d81655572bf by Victor Stinner in branch '3.6': bpo-30273: update distutils.sysconfig for venv's created from Python (#1515) (#1625) https://github.com/python/cpython/commit/460945f22acd288e660b432b288d9d81655572bf
msg293835 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2017-05-17 00:59
New changeset f01c0ec9fe571e8afd50d2f5180db3c0d7b613af by Victor Stinner in branch '3.5': bpo-30273: update distutils.sysconfig for venv's created from Python (#1515) (#1626) https://github.com/python/cpython/commit/f01c0ec9fe571e8afd50d2f5180db3c0d7b613af
History
Date User Action Args
2022-04-11 14:57:32 admin set github: 59571
2017-05-17 00:59:26 vstinner set messages: +
2017-05-17 00:58:05 vstinner set messages: +
2017-05-17 00:26:07 vstinner set pull_requests: + <pull%5Frequest1717>
2017-05-17 00:25:28 vstinner set pull_requests: + <pull%5Frequest1715>
2017-05-09 15:24:15 vstinner set messages: +
2017-05-09 12:42:33 python-dev set pull_requests: + <pull%5Frequest1615>
2017-05-09 11:23:56 vstinner set nosy: + vstinnermessages: +
2012-07-16 17:25:07 python-dev set status: open -> closednosy: + python-devmessages: + resolution: fixedstage: needs patch -> resolved
2012-07-16 15:17:18 sbt set files: + distutils-sysconfig.patchmessages: +
2012-07-16 12:55:26 sbt set files: + distutils-sysconfig.patchkeywords: + patchmessages: +
2012-07-16 11:30:11 sbt create