automake 输出的二进制文件大于命令行编译的二进制文件

发布于 2024-12-26 04:39:41 字数 470 浏览 6 评论 0原文

对于我正在开发的一个小项目,我一直通过命令行使用简单的编译。然而,随着它变得越来越大,我决定学习并使用 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

下壹個目標 2025-01-02 04:39:41

只需在安装二进制文件时调用make install-stripinstall就会在安装过程中剥离它们。

Just invoke make install-strip when you install the binaries and install will strip them during the install process.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文