英文:
How do I define which library to use on Mac OS X?
问题
我在尝试运行一个程序时遇到了问题,我有一种感觉是因为Mac OS X决定使用了错误的库。我希望它使用SDL_image,但我认为它选择使用了SDL-1.2。有没有办法强制它使用SDL_image?如果有帮助的话,我正在尝试运行用Go编写的程序。
我尝试修改DYLD_LIBRARY_PATH变量,因为我怀疑dyld可能与此有关,但没有成功。我找到的与该问题相关的其他内容只是一些错误日志,没有提到如何解决它。
objc[96907]: Class SDLTranslatorResponder在/opt/local/lib/libSDL-1.2.0.dylib和/usr/local/lib/libSDL-1.3.0.dylib中都有实现。其中之一将被使用,但未定义使用哪一个。
objc[96907]: Class SDLTranslatorResponder在/opt/local/lib/libSDL-1.2.0.dylib和/usr/local/lib/libSDL_ttf-2.0.0.dylib中都有实现。其中之一将被使用,但未定义使用哪一个。
objc[96907]: Class SDL_QuartzView在/opt/local/lib/libSDL-1.2.0.dylib和/usr/local/lib/libSDL_ttf-2.0.0.dylib中都有实现。其中之一将被使用,但未定义使用哪一个。
objc[96907]: Class SDL_QuartzWindowDelegate在/opt/local/lib/libSDL-1.2.0.dylib和/usr/local/lib/libSDL_ttf-2.0.0.dylib中都有实现。其中之一将被使用,但未定义使用哪一个。
objc[96907]: Class SDL_QuartzWindow在/opt/local/lib/libSDL-1.2.0.dylib和/usr/local/lib/libSDL_ttf-2.0.0.dylib中都有实现。其中之一将被使用,但未定义使用哪一个。
objc[96907]: Class SDLTranslatorResponder在/opt/local/lib/libSDL-1.2.0.dylib和/usr/local/lib/libSDL_image-1.2.0.dylib中都有实现。其中之一将被使用,但未定义使用哪一个。
objc[96907]: Class SDL_QuartzView在/opt/local/lib/libSDL-1.2.0.dylib和/usr/local/lib/libSDL_image-1.2.0.dylib中都有实现。其中之一将被使用,但未定义使用哪一个。
objc[96907]: Class SDL_QuartzWindowDelegate在/opt/local/lib/libSDL-1.2.0.dylib和/usr/local/lib/libSDL_image-1.2.0.dylib中都有实现。其中之一将被使用,但未定义使用哪一个。
objc[96907]: Class SDL_QuartzWindow在/opt/local/lib/libSDL-1.2.0.dylib和/usr/local/lib/libSDL_image-1.2.0.dylib中都有实现。其中之一将被使用,但未定义使用哪一个。
英文:
I'm having trouble getting a program to work, and I have a feeling it is because Mac OS X has decided to use the wrong library. I want it to use SDL_image, but I think its choosing to use SDL-1.2 instead. Is there a way to force it to use SDL_image? If it helps at all, I'm trying to run a program written in the Go program language.
I've tried modifying the DYLD_LIBRARY_PATH variable because I suspect dyld might have something to do with it, but it didn't work. Everything else I've found relating to the problem is just error logs that say nothing about how to fix it.
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
得分: 4
你尝试过使用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下,就不会遇到这种问题了。
英文:
Have you tried using install_name_tool -change on your executable to make the library references have absolute path?
You could also try using install_name_tool to change the rpath for the executable and remove /opt/local if it is there. Or if there is no rpath you could try adding /usr/local/lib and -change the library references to use @rpath/ (see "man dyld" and "man install_name_tool")
You could also switch from MacPorts to Homebrew then all your open-source software lives under /usr/local and you don't get into this sort of problem.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论