We build our Swift 5 app with bazel which allows us to utilize a remote cache for downloading artifacts that have previously been built. When testing this behavior and generating a dSYM, we got this warning:
warning: /private/var/tmp/_bazel_iosci/f749baf807251022363d6bcea6ad530d/execroot/lyftios/bazel-out/ios-armv7-min10.0-applebin_ios-ios_armv7-dbg/bin/_objc_module_cache/2AFT5C5VLSSQV/UIKit-3IG826SVDQUFO.pcm: No such file or directory
note: while processing /private/var/tmp/_bazel_iosci/f749baf807251022363d6bcea6ad530d/execroot/lyftios/bazel-out/ios-armv7-min10.0-applebin_ios-ios_armv7-dbg/bin/_objc_module_cache/2AFT5C5VLSSQV/UIKit-3IG826SVDQUFO.pcm
note: Linking a static library that was built with -gmodules, but the module cache was not found. Redistributable static libraries should never be built with module debugging enabled. The debug experience will be degraded due to incomplete debug information.
warning: /private/var/tmp/_bazel_iosci/f749baf807251022363d6bcea6ad530d/execroot/lyftios/bazel-out/ios-armv7-min10.0-applebin_ios-ios_armv7-dbg/bin/_objc_module_cache/2AFT5C5VLSSQV/ObjectiveC-TF7LBA6W6M7C.pcm: No such file or directory
note: while processing /private/var/tmp/_bazel_iosci/f749baf807251022363d6bcea6ad530d/execroot/lyftios/bazel-out/ios-armv7-min10.0-applebin_ios-ios_armv7-dbg/bin/_objc_module_cache/2AFT5C5VLSSQV/ObjectiveC-TF7LBA6W6M7C.pcm
warning: /private/var/tmp/_bazel_iosci/f749baf807251022363d6bcea6ad530d/execroot/lyftios/bazel-out/ios-armv7-min10.0-applebin_ios-ios_armv7-dbg/bin/_objc_module_cache/2AFT5C5VLSSQV/Foundation-M22A4D3IGJY9.pcm: No such file or directory
note: while processing /private/var/tmp/_bazel_iosci/f749baf807251022363d6bcea6ad530d/execroot/lyftios/bazel-out/ios-armv7-min10.0-applebin_ios-ios_armv7-dbg/bin/_objc_module_cache/2AFT5C5VLSSQV/Foundation-M22A4D3IGJY9.pcm
warning: /private/var/tmp/_bazel_iosci/f749baf807251022363d6bcea6ad530d/execroot/lyftios/bazel-out/ios-armv7-min10.0-applebin_ios-ios_armv7-dbg/bin/_objc_module_cache/2AFT5C5VLSSQV/CoreGraphics-HOC1SLJ4ZMTL.pcm: No such file or directory
note: while processing /private/var/tmp/_bazel_iosci/f749baf807251022363d6bcea6ad530d/execroot/lyftios/bazel-out/ios-armv7-min10.0-applebin_ios-ios_armv7-dbg/bin/_objc_module_cache/2AFT5C5VLSSQV/CoreGraphics-HOC1SLJ4ZMTL.pcm
warning: /private/var/tmp/_bazel_iosci/f749baf807251022363d6bcea6ad530d/execroot/lyftios/bazel-out/ios-armv7-min10.0-applebin_ios-ios_armv7-dbg/bin/_objc_module_cache/2AFT5C5VLSSQV/SwiftShims-3HHJ0DU6KU482.pcm: No such file or directory
note: while processing /private/var/tmp/_bazel_iosci/f749baf807251022363d6bcea6ad530d/execroot/lyftios/bazel-out/ios-armv7-min10.0-applebin_ios-ios_armv7-dbg/bin/_objc_module_cache/2AFT5C5VLSSQV/SwiftShims-3HHJ0DU6KU482.pcm
This warnings comes from here in dsymutil seemingly when creating a dSYM from a binary that linked a static library that was built on another machine.
The warning indicates that we are passing -gmodules
, causing the issue. -gmodules
seems to only be a flag to clang, which we are never passing during our build (although we are passing -g
in this case). When you do pass this flag, the handling logic adds 2 other flags to the invocation: -fmodule-format=obj
, which is also added by Swift here and -dwarf-ext-refs
which, based on this comment, seems to be the one causing this.
I'm curious if the behavior of clang's -gmodules
flag is the default in Swift, through this flag or others, and if so how we could avoid this so debugging isn't degraded on developer machines when some of the libraries are pulled from a shared cache.
We've also had a difficult time reproducing this without building our entire app. What are the specific factors that lead to the absolute path of a pcm
to end up in debug info?