我编译了一个用C ++编写的python模块,它依赖于:VTK,ITK,VMTK,CGAL(CGAL也取决于boost),以及libtirpc或XDR以Windows 10中的XDR格式编写文件。 -W64 POSIX可从源代码构建VTK,ITK,VMTK,CGAL,boost和libtirpc。另外,我的python来自Anaconda2(python 2.7)X64官方预构建二进制文件。顺便说一句,我应该说这个python模块在UNIX机器上可以正常工作很多年,但这是我第一次尝试将其移植到Windows机器上。一切都编译得很好(当然很麻烦!),但是在运行时会显示此错误:
Exception thrown at 0x00007FFA69075553 (ntdll.dll) in python.exe: 0xC0000005: Access violation writing location 0x0000000000000024.
我使用Visual Studio堆栈跟踪来找出模块的哪个部分导致此异常,并且似乎存在以下问题:ntdll.dll!RtlpWaitOnCriticalSection()
更重要的是,完整的堆栈跟踪看起来像这样:
> ntdll.dll!RtlpWaitOnCriticalSection() Unknown
ntdll.dll!RtlpEnterCriticalSectionContended() Unknown
ntdll.dll!RtlEnterCriticalSection() Unknown
msvcrt.dll!fwrite() Unknown
mgwxdr-0.dll!000000000b324bd3() Unknown
mgwxdr-0.dll!000000000b321635() Unknown
_Generation.pyd!000000006ebcb035() Unknown
_Generation.pyd!000000006ebc316d() Unknown
_Generation.pyd!000000006ebc2bc5() Unknown
_Generation.pyd!000000006ebd48a2() Unknown
python27.dll!PyCFunction_Call(_object * func, _object * arg, _object * kw) Line 81 C
python27.dll!call_function(_object * * * pp_stack, int oparg) Line 4372 C
python27.dll!PyEval_EvalFrameEx(_frame * f, int throwflag) Line 3013 C
python27.dll!fast_function(_object * func, _object * * * pp_stack, int n, int na, int nk) Line 4458 C
python27.dll!call_function(_object * * * pp_stack, int oparg) Line 4392 C
python27.dll!PyEval_EvalFrameEx(_frame * f, int throwflag) Line 3013 C
python27.dll!fast_function(_object * func, _object * * * pp_stack, int n, int na, int nk) Line 4458 C
python27.dll!call_function(_object * * * pp_stack, int oparg) Line 4392 C
python27.dll!PyEval_EvalFrameEx(_frame * f, int throwflag) Line 3013 C
python27.dll!fast_function(_object * func, _object * * * pp_stack, int n, int na, int nk) Line 4458 C
python27.dll!call_function(_object * * * pp_stack, int oparg) Line 4392 C
python27.dll!PyEval_EvalFrameEx(_frame * f, int throwflag) Line 3013 C
python27.dll!PyEval_EvalCodeEx(PyCodeObject * co, _object * globals, _object * locals, _object * * args, int argcount, _object * * kws, int kwcount, _object * * defs, int defcount, _object * closure) Line 3604 C
python27.dll!run_mod(_mod * mod, const char * filename, _object * globals, _object * locals, PyCompilerFlags * flags, _arena * arena) Line 1386 C
python27.dll!PyRun_FileExFlags(_iobuf * fp, const char * filename, int start, _object * globals, _object * locals, int closeit, PyCompilerFlags * flags) Line 1372 C
python27.dll!PyRun_SimpleFileExFlags(_iobuf * fp, const char * filename, int closeit, PyCompilerFlags * flags) Line 958 C
python27.dll!PyRun_AnyFileExFlags(_iobuf * fp, const char * filename, int closeit, PyCompilerFlags * flags) Line 762 C
python27.dll!Py_Main(int argc, char * * argv) Line 649 C
python.exe!__tmainCRTStartup() Line 586 C
_Generation.pyd
是我的python模块,它尝试将XDR(cf. mgwxdr-0.dll
)文件写入磁盘时也会崩溃,该文件也显示在msvcrt.dll!fwrite()
的stacktrace中。老实说,我不知道为什么会发生以及如何解决它。任何想法或建议都会受到赞赏。