2011-05-01 37 views
3

我無法使程序正常工作,我有一種感覺,那就是因爲Mac OS X決定使用錯誤的庫。我希望它使用SDL_image,但我認爲它選擇使用SDL-1.2。有沒有辦法強制它使用SDL_image?如果它有幫助,我試圖運行一個用Go程序語言編寫的程序。如何定義在Mac OS X上使用哪個庫?

我試過修改DYLD_LIBRARY_PATH變量,因爲我懷疑dyld可能與它有關,但它不起作用。我發現的與該問題有關的其他一切只是錯誤日誌,沒有說明如何解決問題。

objc[96907]: Class SDLTranslatorResponder is implemented in both /opt/local/lib/libSDL-1.2.0.dylib and /usr/local/lib/libSDL-1.3.0.dylib. One of the two will be used. Which one is undefined. 
objc[96907]: Class SDLTranslatorResponder is implemented in both /opt/local/lib/libSDL-1.2.0.dylib and /usr/local/lib/libSDL_ttf-2.0.0.dylib. One of the two will be used. Which one is undefined. 
objc[96907]: Class SDL_QuartzView is implemented in both /opt/local/lib/libSDL-1.2.0.dylib and /usr/local/lib/libSDL_ttf-2.0.0.dylib. One of the two will be used. Which one is undefined. 
objc[96907]: Class SDL_QuartzWindowDelegate is implemented in both /opt/local/lib/libSDL-1.2.0.dylib and /usr/local/lib/libSDL_ttf-2.0.0.dylib. One of the two will be used. Which one is undefined. 
objc[96907]: Class SDL_QuartzWindow is implemented in both /opt/local/lib/libSDL-1.2.0.dylib and /usr/local/lib/libSDL_ttf-2.0.0.dylib. One of the two will be used. Which one is undefined. 
objc[96907]: Class SDLTranslatorResponder is implemented in both /opt/local/lib/libSDL-1.2.0.dylib and /usr/local/lib/libSDL_image-1.2.0.dylib. One of the two will be used. Which one is undefined. 
objc[96907]: Class SDL_QuartzView is implemented in both /opt/local/lib/libSDL-1.2.0.dylib and /usr/local/lib/libSDL_image-1.2.0.dylib. One of the two will be used. Which one is undefined. 
objc[96907]: Class SDL_QuartzWindowDelegate is implemented in both /opt/local/lib/libSDL-1.2.0.dylib and /usr/local/lib/libSDL_image-1.2.0.dylib. One of the two will be used. Which one is undefined. 
objc[96907]: Class SDL_QuartzWindow is implemented in both /opt/local/lib/libSDL-1.2.0.dylib and /usr/local/lib/libSDL_image-1.2.0.dylib. One of the two will be used. Which one is undefined. 
+0

你用什麼命令鏈接你的可執行文件?你的可執行文件中'otool -L'的輸出是什麼?你究竟如何使用'DYLD_LIBRARY_PATH'? – 2011-05-02 02:31:56

+0

是你的問題鏈接時間?運行時? – Kissaki 2011-05-11 11:45:27

+0

日誌相當詳細。它會告訴您SDL lib文件有兩個版本,並且未指定使用哪一個版本。你必須(以某種方式)定義,使用哪些。 – Kissaki 2011-05-11 11:46:08

回答

3

您是否嘗試過在可執行文件上使用install_name_tool -change使庫引用具有絕對路徑?

您也可以嘗試使用install_name_tool更改可執行文件的rpath,並刪除/ opt/local(如果存在)。或者如果沒有rpath,您可以嘗試添加/ usr/local/lib並將庫引用更改爲使用@ rpath /(請參閱「man dyld」和「man install_name_tool」)

您也可以從MacPorts切換到Homebrew那麼你所有的開源軟件都在/ usr/local下,你不會遇到這種問題。