使用 install_name_tool 出了什么问题?
我正在尝试在构建 dylib 后更改它的安装路径。我使用 otool -L 来检查当前路径是什么。然后我这样做:
$ install_name_tool -change /my/current/path/libmine.dylib \
/my/new/path/libmine.dylib libmine.dylib
我没有收到错误,但没有任何变化。如果我再次检查路径,旧路径仍然存在。此外,新路径比旧路径短很多,所以没有问题,而且我认为该库甚至使用额外的标志进行编译以获得更多文件路径空间。
有什么想法吗?
I'm trying to change the install path of a dylib after it has been built. I use otool -L
to check what the current path is. And then I do:
$ install_name_tool -change /my/current/path/libmine.dylib \
/my/new/path/libmine.dylib libmine.dylib
I don't get an error, but nothing changes. If I check the path again the old one is still there. Also the new path is a lot shorter then the old one, so no problem there, and I think the lib is even compiled with extra flag for more filepath space.
Any ideas?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
install_name_tool 的手册页说 -change 用于依赖项。您正在尝试更改库本身的名称。
刚刚进行实验后,我发现我无法更改 dylib 本身内部出现的 dylib 的名称,但我可以更改其他依赖项的名称。
经过更多实验:
install_name_tool -id newname file
就可以了。The man page for install_name_tool says that -change is for dependencies. You're trying to change the name of the library itself.
Having just experimented, I found I couldn't change the name of a dylib that appears inside the dylib itself but I could change the names of other dependencies.
Having experimented more:
install_name_tool -id newname file
will do the trick.