2011-05-01 132 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下,你不会遇到这种问题。