PAR 打包程序可执行文件大小
我已经使用 PAR:Packer (pp) 为 Windows 创建二进制文件有一段时间了。它们一直很大(大约 6-8MB),这是可以理解的,最近我更新了我的软件包(我在 Windows 上使用 stawberry perl),现在它生成的二进制文件几乎有 20MB!我知道它包括一个完整的 perl 环境和所有需要的模块,但是它已经失控了,而且给某人一个 19MB 的简单脚本有点尴尬!有没有办法减少二进制大小?有人知道为什么最近几个版本或 PAR Packer 的大小有所增加吗?
I have been using PAR:Packer (pp) to create binaries for windows for a while. They have always been understandably large (around 6-8MB), recently I updated my packages (I use stawberry perl on windows) and now it is producing binaries that are almost 20MB! I understand it is including an entire perl environment with all needed modules, but it is getting out of hand, and a little embarrassing to hand someone a simple script that is 19MB! Is there anyway to reduce the binary size? Any one know why the size has increases in the last couple releases or PAR Packer?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
当您在 Perl 环境中安装新模块(甚至只升级一些模块)时,随着时间的推移,pp 将包含许多附加文件,即使您的脚本未使用它们。这是因为 pp 对于要包含的内容比严格更安全,因此它会产生大量无用的依赖项。
诀窍是使用两个 Perl 环境。一种用于开发,另一种仅用于构建二进制文件。对于构建环境,从全新的 Perl 安装开始,安装 PAR::Packer 并仅安装应用程序所需的模块。
通过我的构建环境,我可以生成仅 5 Mb 的 Tk 二进制文件。我的开发环境(有很多来自 CPAN 的垃圾)位于同一台机器上,相同的脚本有 13 Mb。
When you install new modules in your Perl environment (or even only upgrade some), pp will include a lot of additional files over time even if they are not used by your script. It's because pp is more safe than strict concerning what to include that it picks up a lot of useless dependencies.
The trick is to use two Perl environments. One for development and another one only for building binaries. For the building environment, start from a fresh Perl install, install PAR::Packer and only the modules needed by your application.
With my building environment, I can produce a Tk binary of only 5 Mb. With my development environment (which has a lot of junk from CPAN) on the same machine, the same script is 13 Mb.
它有什么区别?恕我直言,我不会关心大小,只关心性能PAR 不会隐藏任何内容如果您想知道哪些文件被打包,它们是否被删除了 pod 等等,您想要做的就是查看内部unzip -d foo foo.exe
FWIW, AFAIK,大小没有改变,所以你一定使用了很多很多的模块。
What difference does it make?IMHO, I wouldn't be concerned with size, only with performancePAR doesn't hide anything from you, you wantIf you're curious to know which files get packed, if they're stripped of pod, etc etc, all you have to do is look insideunzip -d foo foo.exe
FWIW, AFAIK, the size hasn't changed, so you must be using lots and lots of modules.