我尝试将一个共享的C库编译成Python模块并使用它。我发现,根据
我已经尝试手动检查哪些库在
DYLD_LIBRARY_PATH
的设置不同,我的代码有时可以运行,但有时会因为一个神秘的错误消息而崩溃。Jul 24 02:44:44 master
$ DYLD_LIBRARY_PATH=/opt/local/lib python -c 'import opengm'
OKAY
Jul 24 02:45:41 master
$ DYLD_LIBRARY_PATH= python -c 'import opengm'
python(86214,0x7fff70ccdcc0) malloc: *** error for object 0x7fff70177500: pointer being freed was not allocated
*** set a breakpoint in malloc_error_break to debug
Abort trap
我已经尝试手动检查哪些库在
/usr/lib
和 /usr/local/lib
以及 /opt/local/lib
中是共同存在的,但我没有找到导致崩溃的原因。解决问题的一种方法是找出这两个进程使用了哪些 dylib
文件?但我无法通过使用 opensnoop
或 dtruss
找到它们,也许我使用这些工具的方法不正确。
如何找到这个崩溃的原因?