Dear Apple Developer Forum!
I'm in need of help regarding an issue that has to do with binaries.
I'm building an iOS App that needs a fingerprint of its binaries, exclusively based on the source code written. A "reproducible" build, meaning that when I compile it on my machine and run checksum on it, the output (hash) will be the same, as if another device clones the project, compiles and checksums the values.
The App depends on swift packages which depends on Swift Packages, which I've managed to compile to .o
files, convert to .a
files (static frameworks) and create xcframeworks
, which the App depends on. They work great, once compiled, their checksum value does not change when App is compiled (unless source code of them is changed of course), but the Apps executable (checksummed inside the IPA) changes every time it's compiled. I'm guessing that perhaps the Xcode compiler injects a timestamp or other unique identifier in the binaries?
Is there any way to have "reproducible" builds on iOS (Swift Xcode)?
All input is greatly appreciated,
Thank you very much,
Kind regards Johan.
The stable identifier for builds coming from Xcode is the build UUID that is embedded as part of the Mach-O metadata. This is what ties an executable or framework together with its associated dSYM file for things like crash symbolication. So rather than using a checksum (without knowing what you're trying to accomplish), you might be better off by looking for the build UUID. You can get it by running dwarfdump --uuid /Path/To/Binary
.
The build UUIDs produced by Xcode should be identical across builds for the following conditions:
- Exact same source code
- Exact same Xcode version
- Exact same build settings
If any one of those conditions change, then the build UUID will change. But if you run back to back builds for the purposes of testing this, then the dwarfdump
command will show you the builds are identical via the same UUID.
We have documentation for this focused on what goes into debug symbol generation, but the Overview outlines what I said above.
— Ed Ford, DTS Engineer