liboauth 未正确链接
我正在尝试将 liboauth.dylib 添加到我的 xcode 项目(c++)中。我已经配置并制作了该库,该库现在位于我的 /usr/local/lib
中,其中现在包含:
liboauth.0.dylib
liboauth.dylib <- a link to liboauth.0.dylib
liboauth.li
liboauth.a
标头位于 usr/local/include
中。看起来不错。
我已将其包含在我的 xcode 中,方法是将路径 /usr/local/lib/liboauth.dylib
添加到 Other Linker Flags
部分,以及 usr/local/ include/
到标题搜索路径
。
我还在库搜索路径
中包含了相同的内容。
这在我的系统上构建得很好。但是,如果我将生成的 .app 带到另一台(osx)计算机上,它会给出错误 /usr/local/liboauth.0.dylib
(我通过打开 .app 并运行 unix 可执行文件得到这个错误)。
链接器在构建时不应该包含 liboauth dylib 吗?那么当使用另一台计算机时应该不会有问题吧?
如果答案是否定的,那么我该如何将 liboauth.dylib 包含到 .app 中,以便它可以在任何计算机上运行(运行 osx)?
这是具体的错误:
Library not loaded: /usr/local/lib/liboauth.0.dylib
Referenced from: /Users/scratch/gameTest.app/Contents/MacOS/gameTest
Reason: image not found
编辑:我发现了问题!在 liboauth.0.dylib 上使用 otool -l 命令我发现了这一点:
Load command 3
cmd LC_ID_DYLIB
cmdsize 56
name /usr/local/lib/liboauth.0.dylib (offset 24)
time stamp 1 Thu Jan 1 12:00:01 1970
current version 9.1.0
compatibility version 9.0.0
有人能帮我弄清楚如何更改它吗?我认为这与 install_name_tool 有关,但我不知道如何正确处理。
I am trying to add the liboauth.dylib to my xcode project (c++). I have configured and made the library, which is now sitting in my /usr/local/lib
which now has:
liboauth.0.dylib
liboauth.dylib <- a link to liboauth.0.dylib
liboauth.li
liboauth.a
with the header in usr/local/include
. Seems fine.
I have included this in my xcode by adding the path /usr/local/lib/liboauth.dylib
to the Other Linker Flags
section, and usr/local/include/
to the Header Search Paths
.
I have also included the same in the Library Search Paths
.
This builds fine on my system. However if I take the resulting .app to another (osx) computer it gives the error the /usr/local/liboauth.0.dylib
(I get this by opening the .app and running the unix executable).
Shouldn't the linker have included the liboauth dylib when built? And then it shouldn't be a problem when going to a different computer?
If the answer is no, then how would I go about included the liboauth.dylib into the .app, so it can run on any computer (running osx)?
Here is the specific error:
Library not loaded: /usr/local/lib/liboauth.0.dylib
Referenced from: /Users/scratch/gameTest.app/Contents/MacOS/gameTest
Reason: image not found
Edit: I have found the problem! Using the otool -l command on the liboauth.0.dylib I found this:
Load command 3
cmd LC_ID_DYLIB
cmdsize 56
name /usr/local/lib/liboauth.0.dylib (offset 24)
time stamp 1 Thu Jan 1 12:00:01 1970
current version 9.1.0
compatibility version 9.0.0
Can someone help me to figure out how to change this? I think it has something to do with the install_name_tool but I do not know how to go about it properly.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
两个系统一样吗? 32 位/64 位,雪豹与豹。
我可以看到这些库会有什么不同,如果是这种情况,可能会产生错误。
如果它们相同,则您可能在项目设置中设置了链接器标志,并且它被目标设置覆盖。
Are both system the same? 32-bit/64-bit, Snow Leopard vs. Leopard.
I can see how the libraries would be different and that error could be produced if that was the case.
If they are the same, it is possible that you are setting the linker flags in your project settings and it is being overridden by your target settings.