将一些 macports 库与可执行文件打包以创建应用程序包
我正在尝试为一个游戏创建一个应用程序包,该游戏使用我通过 macports 安装的一些库。我想将依赖项放入包中,但不知道如何做到这一点。
我已经编译了游戏并尝试使用 install_name_tool 更改所使用的路径,以便可执行文件在捆绑包内搜索,我没有收到错误,但路径没有改变。例如: install_name_tool -change libSDL-1.2.0.dylib @executable_path/../Frameworks/libSDL-1.2.0.dylibmeandmyshadow
该可执行文件是使用 CMake 生成的 Makefile 构建的。
XCode 会是更好的选择吗?我正在采取的步骤中是否遗漏了什么?
I'm trying to create an application bundle for a game that uses some libraries I installed using macports. I would like to put the dependencies inside the bundle but am at loss on how to do that.
I've compiled the game and tried to use install_name_tool to change the path used so that the executable searches inside the bundle, I get no error but the path doesn't change. E.g.:
install_name_tool -change libSDL-1.2.0.dylib @executable_path/../Frameworks/libSDL-1.2.0.dylib meandmyshadow
The executable was built using a CMake generated Makefile.
Would XCode be a better option? Is there anything I'm missing from the steps I'm taking?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
要回答有关如何使用
install_name_tool
的具体问题:如果您使用otool -L Meandmyshadow
查看meandmyshadow 的库链接,它可能看起来像这样:当您使用
install_name_tool
更改程序中的引用,需要使用完整的引用。您指定要更改引用libSDL-1.2.0.dylib
,但需要指定绝对路径,例如/opt/local/lib/libSDL-1.2.0.dylib
:至于如何将库包含到应用程序包中的更大问题,您可以像上面使用
install_name_tool
那样手动完成,或者考虑尝试 dylibbundler 它会自动为您完成此操作。您可以使用 MacPorts 安装它:sudo port install dylibbundler
。To answer your specific question about how to use
install_name_tool
: if you look at the library linkage of meandmyshadow usingotool -L meandmyshadow
it'll probably look something like this:When you use
install_name_tool
to change a reference in the program, you need to use the complete reference. You specified that you wanted to change the referencelibSDL-1.2.0.dylib
but you need to specify the absolute path, e.g./opt/local/lib/libSDL-1.2.0.dylib
:As for the bigger question about how to include libraries into an application bundle, you can do it manually as you're doing above with
install_name_tool
, or consider trying dylibbundler which does it for you automatically. You can install it using MacPorts:sudo port install dylibbundler
.