导入我创建的扩展时出现未定义的符号错误。

我使用的一个扩展使用了我制作的一些其他函数(在扩展本身使用的源之外),但它在导入时抱怨它们是未定义的符号。

选择 | 换行 | 行号
  1. >>> import libpytwo2gam 
  2. Traceback (most recent call last):
  3.   File "<stdin>", line 1, in <module>
  4. ImportError: ./libpytwo2gam.so: undefined symbol: twoll_linearsearch
  5. >>> 
  6.  

twoll_linearsearch()是我在设置中创建的Extension对象的extra_objects成员中包含的对象文件中的函数。py脚本。以下是脚本:

选择 | 换行 | 行号
  1.  
  2. from distutils.core import setup, Extension
  3.  
  4. ARCH = 'x86_64'
  5.  
  6. extra = ['../../../misc/ll/'+ARCH+'_tmp/ll.o',
  7.          '../../simple/'+ARCH+'_tmp/srctools.o',
  8.          '../'+ARCH+'_tmp/util.o',
  9.          '../'+ARCH+'_tmp/extern.o']
  10. print extra
  11.  
  12. two2gam_module = Extension('libpytwo2gam',
  13.                            sources=['pyext.c'],
  14.                            extra_objects = extra,
  15.                            libraries=['SDL', 'SDL_image'])
  16.  
  17. setup(name = 'libpytwo2gam',
  18.        version = '0.0.1',
  19.        description = 'Python Interface for two2gam',
  20.        author = '{2}rIng',
  21.        author_email = 'xxx@xxx.com',
  22.        long_description = '''
  23. Description says it (IOW, long_descriptions goes here!).
  24. ''',
  25.        ext_modules = [two2gam_module])
  26.  

标签: python

添加新评论