xcodemacosswift-package-managerdsym

Symbolicating Swift Package Manager builds


Swift Package Manager can be a convenient way to build swift projects, and, if you (remove the absolute toolchain @rpath it adds to your binary), you can even distribute its builds.

But SPM doesn't seem to produce .dSYM debug symbol packages, so how can you symbolicate the crash reports?

Is there a better way than using swift package generate-xcodeproj and then getting Xcode to create the build and dSYMs, effectively reducing SPM to .xcodeproj shorthand?


Solution

  • UPDATE
    swift build -c release seems to create a dSYM package by default. But if you suddenly decided you wanted your debug build to have dSYMs too, then read on.

    You can get dSYM output from SPM's swift build, by passing -g and -debug-info-format=dwarf to swiftc. To do this from swift build the arguments must each be escaped with -Xswiftc:

    swift build -Xswiftc -g -Xswiftc -debug-info-format=dwarf
    

    I wasn't thrilled about using Xcode to build because it turns all sub-packages into dynamically linked frameworks which felt like too big a change/yak-shave just to get a readable backtrace.