防止编译在 OS X 上生成 dSYM(使用 make)
我有一个 C++ 项目(开源),默认情况下不需要删除调试符号。有很多测试可执行文件,在 OS X 上生成了很多 dSYM 文件。我尝试过 -g3 作为 g++ 标志,但无济于事。有想法吗?
谢谢! 胡安
I've got a c++ project (open source) that does not need to strip debugging symbols by default. With a lot of test executables, there are a lot of dSYM files generated on OS X. I've tried -g3 as a g++ flag to no avail. Ideas?
Thanks!
Juan
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
如果您使用“-g”标志进行编译,请将其删除。
If you're compiling with the "-g" flag, remove it.
正如 Ted Mielczarek 指出的那样,gcc 本身并不生成 dSYM 文件,它只是将生成它们所需的信息存储在目标文件中。如果您使用 make 来构建项目,则 makefile 中很可能有一个单独的步骤,该步骤在编译/链接可执行文件后运行 dsymutil,看看是否可以找到并删除它。
As Ted Mielczarek pointed out, gcc does not produce dSYM files on its own, it simply stores the information needed to produce them in the object files. If you're using make to build your project, it is most likely that there is a separate step in the makefile which runs dsymutil after compiling/linking the executable, see if you can find and remove it.
你是通过 XCode 编译的吗? GCC 不生成 .dSYM 文件,XCode 运行 dsyumutil 来生成它们。在我的(过时的)XCode 3.2.3 中,在“项目设置”下,“构建选项”->“调试信息格式,您可以选择“DWARF with dSYM File”或仅“DWARF”。后者不应导致生成 dSYM。
但是,请注意,使用 Apple 的工具链时,DWARF 驻留在 .o 文件中,并且不会链接到最终的二进制文件中。 (GDB 知道如何找到它,但它需要磁盘上的 .o 文件。)如果您打算将二进制文件发送给其他人,您确实需要生成一个 dSYM 来将它们与二进制文件一起发送。
Are you compiling via XCode? GCC does not produce .dSYM files, XCode runs dsyumutil to generate them. In my (outdated) XCode 3.2.3, under Project Settings, Build Options -> Debug Information Format, you can choose "DWARF with dSYM File" or just "DWARF". The latter should not result in a dSYM being produced.
However, note that with Apple's toolchain, the DWARF resides in the .o files, and does not get linked into the final binary. (GDB knows how to find it, but it needs the .o files laying around on disk.) If you intend to send the binaries to someone else, you really do need to produce a dSYM to send them along with the binary.