XCode4.1“复制期间去除调试符号”
我无法在 XCode 中使用“复制期间剥离调试符号”选项来按照我认为应该的方式工作。文档说:
“激活此设置会导致在构建期间(例如在复制捆绑资源或复制文件构建阶段)复制的二进制文件被删除调试符号。”
然而,实际上发生的情况是,剥离仅在复制发生后对链接的二进制文件执行,因此复制的文件永远不会被剥离。例如:构建日志内容类似于:
Compile main.c...
Link /Users/snowcrash/proj/blah/build/Release/foo.dylib
Copy bar/foo.dylib
Strip build/Release/foo.dylib
根据 nm
bar/foo.dylib
中仍然包含调试符号,正如您所期望的那样 foo.dylib< /code> 在剥离之前被复制。我尝试了各种设置组合(如下),但无法在复制之前进行剥离。
知道如何删除复制的文件吗?或者也许我只是误解了它的用途!
其他相关设置:
- 部署后处理 - 是(必需或其他设置 复制
- 期间剥离调试符号 - 是
- 剥离链接产品 - 是(剥离 build/Release/foo.dylib 产品)
- 使用单独剥离 - 是(使用下面的附加剥离标志调用剥离,不剥离复制的文件)
- 附加剥离标志 - 是'-x'
如果复制期间剥离调试符号不起作用,我将尝试使用构建后脚本并自己调用剥离。
I can't get the "strip debug symbols during copy" option in XCode to work how I think it should work. The docs say:
"Activating this setting causes binary files which are copied during the build (e.g. in a Copy Bundle Resources or Copy Files build phase) to be stripped of debugging symbols."
However, what appears to happen in practice is that stripping is only performing on the linked binary after the copy happens, so the copied file is never stripped. e.g.: build log reads something like:
Compile main.c...
Link /Users/snowcrash/proj/blah/build/Release/foo.dylib
Copy bar/foo.dylib
Strip build/Release/foo.dylib
According to nm
bar/foo.dylib
still has debug symbols in it, as you'd expect since foo.dylib
was copied before stripping. I have tried various combinations of settings (below) but can't make the strip happen before the copy.
Any idea how to make the copied file be stripped? Or maybe I've just misunderstood what it is meant to do!
Other relevant settings:
- Deployment Postprocessing - Yes (required or other settings are
ignored) - Strip Debug Symbols During Copy - Yes
- Strip Linked Product - Yes (strips the build/Release/foo.dylib product)
- Use Separate Strip - Yes (invokes strip with additional strip flags below, does not strip copied file)
- Additional Strip Flags - '-x'
If the Strip Debug Symbols During Copy just doesn't work, I will try and use a post-build script and invoke strip myself.
由于 XCode strip 选项的行为不符合预期,我已将它们全部关闭并添加了一个运行脚本构建阶段,该阶段执行以下操作:
Since the XCode strip options do not behave as expected, I have turned them all off and added a Run Script build phase which does this: