automake 输出的二进制文件大于命令行编译的二进制文件
对于我正在开发的一个小项目,我一直通过命令行使用简单的编译。然而,随着它变得越来越大,我决定学习并使用 autoconf 和 automake 来编译它。
经过一些配置后,我使用 automake 成功构建了。但我注意到输出二进制文件的大小比通过命令行使用 g++ 更大。我尝试使用静态和动态库,结果是相同的。
我还尝试过一个简单的 hello world,使用 automake 的效果也比使用命令行编译的效果要大。
因此,我尝试运行 objdump -h :编译的命令行返回 27 个部分,而在另一端,编译的 automake 返回相同的 27 个部分加上 7 个名为 debug_aranges 、debug_info 、debug_abbrev 、 debug_line 的部分、debug_loc、debug_ranges。所以我显然倾向于认为这与调试有关。
因此,任何人都知道这部分的用途、是否有必要以及如何删除它们,以便使可执行文件更小,便于分发。
For a small project I'm developing, I've been using simple compilation via command-line. However, as it became bigger, I decided to learn and use autoconf and automake to compile it.
After some configuration, I successfully built using automake. However I noted that the size of the output binary file was bigger than using g++ via command-line. I tried using static and dynamic libs and the result was the same.
I've also tried a simple hello world and it was also bigger with automake than with command-line compilation.
So, I tried to run objdump -h
: the command-line compiled returned 27 sections, and on the other side the automake compiled returned the same 27 sections plus 7 sections called debug_aranges ,debug_info ,debug_abbrev, debug_line, debug_loc, debug_ranges. So I'm obviously inclined to think it's something related with debug.
So, anyone knows what this sections are for, if they are necessary and how to a get rid of then so the executables are smaller for distribution.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
只需在安装二进制文件时调用
make install-strip
,install
就会在安装过程中剥离它们。Just invoke
make install-strip
when you install the binaries andinstall
will strip them during the install process.