python27.def “Symbol table not found” when trying weave

隐身守侯 提交于 2019-12-13 04:17:00

问题


I'm trying to use weave with Python ANACONDA 64 bit. As weave requires Python 2.7 i created a new env to be able to import it, during code execution it turned out that libpython27.a is missing. So I created this library i.e. 1st created def file and later library with dll tool

C:\ProgramData\Anaconda3\envs\Python27>gendef python27.dll

C:\ProgramData\Anaconda3\envs\Python27>C:\MinGW64\bin\dlltool -v --dllname python27.dll --def python27.def --output-lib libpython27.a

library creation went OK however during comlipaton by weave i'm getting Symbol table not found. After a bit of debbuging here is a code which reject is complaining that in new python27.def there is no symbol file

File "C:\ProgramData\Anaconda3\envs\Python27\lib\site-packages\numpy\distutils\mingw32ccompiler.py", line 302, in generate_def
    raise ValueError("Symbol table not found")

ValueError: Symbol table not found

def dump_table(dll):
    st = subprocess.Popen(["objdump.exe", "-p", dll], stdout=subprocess.PIPE)
    return st.stdout.readlines()

def generate_def(dll, dfile):
    """Given a dll file location,  get all its exported symbols and dump them
    into the given def file.

    The .def file will be overwritten"""
    dump = dump_table(dll)
    for i in range(len(dump)):
        if _START.match(dump[i].decode()):
            break
    else:
        raise ValueError("Symbol table not found")

Any idea what it can be ??


回答1:


After more investigations it looks like Anaconda distribution delivers msvcr90.dll without symbol table. So when generate_def(dll, dfile) for msvcr90.dll in invoked it generates empty def file.

fix for it was in line 352 mingw32compiler.py to add return False

def build_msvcr_library(debug=False):
    return False
    if os.name != 'nt':
        return False


来源:https://stackoverflow.com/questions/54712302/python27-def-symbol-table-not-found-when-trying-weave

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!