Author sbt
Recipients sbt, vinay.sajip
Date 2012-07-16.11:30:10
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1342438211.61.0.183367325622.issue15366@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2012-07-16 11:30:11sbtsetrecipients: + sbt, vinay.sajip
2012-07-16 11:30:11sbtsetmessageid: <1342438211.61.0.183367325622.issue15366@psf.upfronthosting.co.za>
2012-07-16 11:30:11sbtlinkissue15366 messages
2012-07-16 11:30:10sbtcreate