[pypy-dev] Need help disutils module with PyPy

Sasikanth Eda sasikanth.ece at gmail.com
Fri Nov 23 15:26:22 CET 2012


Hi All,

I am a newbie facing problem with utilization of disutils (
http://docs.python.org/2/distutils/introduction.html) module that helps in
distributing python modules with PyPy.

*content of demo.c:*

#include <Python.h>
#include <stdio.h>

int main (void) {
    printf("setup passed\n");
    return 0;
}

*content of setup.py:*

from distutils.core import setup, Extension

module1 = Extension('demo', sources = ['demo.c'])

setup (name = 'PackageName',
       version = '1.0',
       description = 'This is a demo package',
       ext_modules = [module1])

Now the problem is ;

if this setup.py is compiled with Python, then I am able
to successfully generate the '.so'

[linux at localhost disutils_example]$ python setup.py build
running build
running build_ext
building 'demo' extension
creating build
creating build/temp.linux-x86_64-2.7
gcc -pthread -fno-strict-aliasing -O2 -g -pipe -Wall
-Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector
--param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv
-DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions
-fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic
-D_GNU_SOURCE -fPIC -fwrapv -fPIC -I/usr/include/python2.7 -c demo.c -o
build/temp.linux-x86_64-2.7/demo.o
creating build/lib.linux-x86_64-2.7
gcc -pthread -shared -Wl,-z,relro build/temp.linux-x86_64-2.7/demo.o
-L/usr/lib64 -lpython2.7 -o build/lib.linux-x86_64-2.7/demo.so


where as using PyPy, i am getting the following error


[linux at localhost disutils_example]$ pypy setup.py build
running build
running build_ext
building 'demo' extension
cc -fPIC -Wimplicit -I/usr/lib64/pypy-1.9/include -c demo.c -o
build/temp.linux-x86_64-2.7/demo.o
demo.c:1:20: fatal error: Python.h: No such file or directory
compilation terminated.
error: command 'cc' failed with exit status 1

where as python-devel package which contains these header files is
installed.

Kindly suggest me the process to make this compile with PyPy.

Thanking you,
Sasikanth
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/pypy-dev/attachments/20121123/ce8aeed6/attachment.html>


More information about the pypy-dev mailing list