4

My cython module builds fine, but when I try to import it I get the following error:

ImportError: ./pyflite.so: undefined symbol: basic_ff_register

here's my setup.py.

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

ext_modules = [Extension("pyflite",
                         ["pyflite.pyx"],
                         extra_objects=[
                                   "/usr/local/lib/libflite.a",
                                   "/usr/local/lib/libflite_cmulex.a",
                                   "/usr/local/lib/libflite_usenglish.a",
                                   "/usr/local/lib/libflite_cmu_us_slt.a"])]

setup(
  name = 'pyflite',
  cmdclass = {'build_ext': build_ext},
  ext_modules = ext_modules
)

as you can see, since the libs are static, I had to add them to extra_objects rather than libraries

Here's what's puzzling me:

nm -o --defined-only /usr/local/lib/*.a | grep 'basic_ff_register'

/usr/local/lib/libflite.a:cst_ffeatures.o:00000000000017a0 T basic_ff_register

doesn't that mean that that the function is in libflite.a which I'm linking with?

Any help would be appreciated,

-Scott

ckot
  • 819
  • 2
  • 10
  • 23

1 Answers1

0

Try to reverse the order in which you link the static libraries. libflite.a (where the symbol is missing) should not be first.

Carlo Benussi
  • 165
  • 1
  • 14