如何定义在Mac OS X上使用哪个库?

时间:2011-05-01 15:33:01

标签: macos go

我无法让程序运行,我觉得这是因为Mac OS X决定使用错误的库。我希望它使用SDL_image,但我认为它选择使用SDL-1.2。有没有办法强制它使用SDL_image?如果它有帮助,我正在尝试运行用Go程序语言编写的程序。

我已经尝试修改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.

1 个答案:

答案 0 :(得分: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下,您就不会遇到这类问题。