[pypy-dev] Problem building C Extension

Kevin Gill kevin at movieextras.ie
Tue Dec 14 11:13:46 CET 2010


Hi,

I am new to PyPy.

I built pypy using...

$ python translate.py --opt=jit targetpypystandalone.py

When I try to build eggs with C extensions it doesn't work. I am using pip in a virtualenv. The build
uses the wrong compiler "cc" instead of "gcc" and does not use CFLAGS.

For example:

$ pip -v install zope.interface==3.6.1

shows this output

cc -I/home/kevin/pypp/env/include -c src/zope/interface/_zope_interface_coptimizations.c -o build/temp.linux-x86_64-2.5/src/zope/interface/_zope_interface_coptimizations.o
src/zope/interface/_zope_interface_coptimizations.c: In function ‘verifying_changed’:
src/zope/interface/_zope_interface_coptimizations.c:1349: warning: assignment makes pointer from integer without a cast
cc -shared build/temp.linux-x86_64-2.5/src/zope/interface/_zope_interface_coptimizations.o -o build/lib.linux-x86_64-2.5/zope/interface/_zope_interface_coptimizations.pypy-14.so
/usr/bin/ld: build/temp.linux-x86_64-2.5/src/zope/interface/_zope_interface_coptimizations.o: relocation R_X86_64_32 against `.rodata' can not be used when making a shared object; recompile with -fPIC
build/temp.linux-x86_64-2.5/src/zope/interface/_zope_interface_coptimizations.o: could not read symbols: Bad value
collect2: ld returned 1 exit status

I did some digging through the source. I found that the compiler configuration is normally loaded
via distutils/sysconfig.py, but that module was effectively disabled in pypy. I cannot override
using environment variables for example because the customisation function is as follows:

def customize_compiler(options):
     """Dummy method to let some easy_install packages that have
     optional C speedup components.
     """
     pass

I see from the mailing list that people are compiling C extensions. What am I doing wrong?

Thanks

Kevin

------------------------------------------------------------
Version of pypy that I am using.

$ svn info
Path: .
URL: http://codespeak.net/svn/pypy/trunk
Repository Root: http://codespeak.net/svn
Repository UUID: fd0d7bf2-dfb6-0310-8d31-b7ecfe96aada
Revision: 79796
Node Kind: directory
Schedule: normal
Last Changed Author: afa
Last Changed Rev: 79794
Last Changed Date: 2010-12-03 21:52:49 +0000 (Fri, 03 Dec 2010)








More information about the Pypy-dev mailing list