导入我创建的扩展时出现未定义的符号错误。
我使用的一个扩展使用了我制作的一些其他函数(在扩展本身使用的源之外),但它在导入时抱怨它们是未定义的符号。
选择 | 换行 | 行号
- >>> import libpytwo2gam
- Traceback (most recent call last):
- File "<stdin>", line 1, in <module>
- ImportError: ./libpytwo2gam.so: undefined symbol: twoll_linearsearch
- >>>
twoll_linearsearch()是我在设置中创建的Extension对象的extra_objects成员中包含的对象文件中的函数。py脚本。以下是脚本:
选择 | 换行 | 行号
- from distutils.core import setup, Extension
- ARCH = 'x86_64'
- extra = ['../../../misc/ll/'+ARCH+'_tmp/ll.o',
- '../../simple/'+ARCH+'_tmp/srctools.o',
- '../'+ARCH+'_tmp/util.o',
- '../'+ARCH+'_tmp/extern.o']
- print extra
- two2gam_module = Extension('libpytwo2gam',
- sources=['pyext.c'],
- extra_objects = extra,
- libraries=['SDL', 'SDL_image'])
- setup(name = 'libpytwo2gam',
- version = '0.0.1',
- description = 'Python Interface for two2gam',
- author = '{2}rIng',
- author_email = 'xxx@xxx.com',
- long_description = '''
- Description says it (IOW, long_descriptions goes here!).
- ''',
- ext_modules = [two2gam_module])