[Pyrex] newbie question: error using pyrex

Christian Meesters meesters at uni-mainz.de
Wed Sep 19 09:45:03 CEST 2007


Thanks,

This is all valuable input I will consider. However, wenn compiling with
the following setup script:

from distutils.core import setup
from distutils.extension import Extension
from Pyrex.Distutils import build_ext

setup(
    name = "pofr",
    ext_modules = [
        Extension("pofr", ["pofr_module3.pyx"])
        ],
    cmdclass = {'build_ext' : build_ext}
)

I'll get a bunch of warnings:
pofr_module3.c: In function ‘__pyx_f_12pofr_module3_pofr’:
pofr_module3.c:203: warning: label ‘__pyx_L3’ defined but not used
pofr_module3.c:201: warning: label ‘__pyx_L2’ defined but not used
pofr_module3.c:200: warning: label ‘__pyx_L5’ defined but not used
pofr_module3.c:198: warning: label ‘__pyx_L4’ defined but not used
pofr_module3.c: At top level:
pofr_module3.c:27: warning: ‘__Pyx_UnpackItem’ declared ‘static’ but
never defined
pofr_module3.c:28: warning: ‘__Pyx_EndUnpack’ declared ‘static’ but
never defined
pofr_module3.c:29: warning: ‘__Pyx_PrintItem’ declared ‘static’ but
never defined
pofr_module3.c:30: warning: ‘__Pyx_PrintNewline’ declared ‘static’ but
never defined
pofr_module3.c:31: warning: ‘__Pyx_Raise’ declared ‘static’ but never
defined
pofr_module3.c:32: warning: ‘__Pyx_ReRaise’ declared ‘static’ but never
defined
pofr_module3.c:33: warning: ‘__Pyx_Import’ declared ‘static’ but never
defined
pofr_module3.c:34: warning: ‘__Pyx_GetExcValue’ declared ‘static’ but
never defined
pofr_module3.c:35: warning: ‘__Pyx_ArgTypeTest’ declared ‘static’ but
never defined
pofr_module3.c:36: warning: ‘__Pyx_TypeTest’ declared ‘static’ but never
defined
pofr_module3.c:37: warning: ‘__Pyx_GetStarArgs’ declared ‘static’ but
never defined
pofr_module3.c:38: warning: ‘__Pyx_WriteUnraisable’ declared ‘static’
but never defined
pofr_module3.c:40: warning: ‘__Pyx_ImportType’ declared ‘static’ but
never defined
pofr_module3.c:41: warning: ‘__Pyx_SetVtable’ declared ‘static’ but
never defined
pofr_module3.c:42: warning: ‘__Pyx_GetVtable’ declared ‘static’ but
never defined
pofr_module3.c:43: warning: ‘__Pyx_CreateClass’ declared ‘static’ but
never defined
pofr_module3.c:45: warning: ‘__Pyx_InitStrings’ declared ‘static’ but
never defined
gcc -pthread -shared -Wl,-O1 build/temp.linux-i686-2.5/pofr_module3.o -o
build/lib.linux-i686-2.5/pofr.so

These warnings vary, of course, depending on the actual code for
pofr_module?.pyx, but are all similar.

When calling the compiler directly:
cmeesters:src cm$ gcc -c -fPIC -I/usr/include/python2.5/ pofr_module2.c 
cmeesters:src cm$ gcc -shared pofr_module2.o -o pofr.so
I don't get any warnings and the module is compiled (nice).

However, import into python does not work for both scenarios:
Python 2.5.1 (r251:54863, May  2 2007, 16:56:35) 
[GCC 4.1.2 (Ubuntu 4.1.2-0ubuntu4)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import pofr
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: dynamic module does not define init function (initpofr)

What am I missing now? And can anybody point me to the relevant
documentation, in case I overlooked that part?

TIA
Christian



More information about the Pyrex mailing list