减少 MacOS 上已编译 dylib 的大小
我已从第三方 (LibXL) 获得了一个库的许可,我想在自己的应用程序中使用该库。我收到了一个已经编译的 dylib 文件和标头。
问题是这个库有 37MB 大!它是一个胖库,包括 PPC(32 位)和 Intel(32 位+64 位)的代码。我设法通过使用 lipo 删除 PPC 部分将文件大小减小到 25MB,但这仍然很大!我的应用程序只有大约 5MB 大,包含一个仅我的应用程序的一小部分需要的 25MB 库似乎很荒谬。
有人知道如何减少编译库的大小吗?是否可以以某种方式静态链接 dylib 文件,以便我可以删除未使用的符号?
文件大小是由于调试符号或 dylib 内类似的东西造成的吗? dylibs 中是否有任何不必要的东西可以被删除?
I have licensed a library from a 3rd party (LibXL) that I want to use in my own application. I received an already compiled dylib file and headers.
The problem is that this library is 37MB large! It's a fat library including code for PPC (32bit) and Intel (32bit+64bit). I managed to reduce the file size to 25MB by removing the PPC part with lipo, but that's still huge! My application is only around 5MB large and it seems ridiculous to include a 25MB library that's only needed for a small part of my application.
Does anybody have an idea how to reduce the size of the compiled library? Is it possible to somehow statically link a dylib file so I can strip unused symbols?
Is the huge file size due to debug symbols or something like that inside the dylib? Is there any unnecessary stuff that can be stripped inside dylibs?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您是否尝试过在其上运行
strip
?http://developer.apple。 com/library/mac/#documentation/Darwin/Reference/ManPages/man1/strip.1.html
Have you tried running
strip
on it?http://developer.apple.com/library/mac/#documentation/Darwin/Reference/ManPages/man1/strip.1.html