0
我想編譯和使用一個共享的C庫作爲一個Python模塊,我觀察到,根據DYLD_LIBRARY_PATH
我的代碼工作或崩潰與一個神祕的錯誤消息。如何查找OSX上的進程加載哪個共享庫?
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
之間,但我一直沒能找到失事的原因。找出問題原因的一種方法是找出哪兩個進程使用哪個文件?我無法使用opensnoop
或dtruss
來計算這個值,但也許我錯誤地使用了這些工具。
我怎樣才能找出這次事故的原因?
我投票關閉這一問題作爲題外話,因爲它已經交叉張貼在更適合的Stack Exchange站點上。將來,請僅在單個Stack Exchange站點上發佈您的問題。有關更多信息,請參閱[這裏](http://meta.stackexchange.com/q/64068)。 (http://apple.stackexchange.com/questions/247227/how-to-find-which-shared-library-is-loaded-by-a-process-on-osx)。 – Matt