Panda3d and cython- problems

The blog entry provides an example on how to use cython with panda3d. I had to change the setup.py to this to work on linux, the test.pyx remains the same:

from Cython.Distutils import build_ext
from distutils.core import setup
from distutils.extension import Extension
import sys

# make setup do what we want,
# build extension modules in place
sys.argv.append('build_ext')
sys.argv.append('--inplace')

setup(
    cmdclass={'build_ext': build_ext},
    ext_modules=[Extension("helloworld", ["Test.pyx"], include_dirs=["/usr/include/panda3d"], language="c++")])

and I have this script to import and run it.

import panda3d
from panda3d.core import Vec3
from panda3d.core import Geom
import Test
print("Hi")

But I get the error:
[color=red]

ImportError: /media/Storage/Dokumente/Programeering/Cython Testing/src/Test.so: undefined symbol: _ZTI11TypedObject

I noticed in the blog entry another user had the same problem (This one) But he still doesn’t have an answer.

I’m on linux with cython0.14. Any help would be appreciated.

Its a C++ linking problem check out the C++ section. My guess is that there is a version missmatch some place.

You need to inform the linker which modules to link against. In the provided setup.py this can be done by adding

args['libraries']=['p3framework', 'panda', 'pandafx', 'pandaexpress', 'p3dtoolconfig', 'p3dtool', 'p3pystub', 'p3direct']

before the compilation happens.