Xcode 9 and Carthage - stripping out llvm instrument symbols

Like any other year the new Xcode GM came out and everybody started rushing to submit their apps. This year, I was also one of these early adopters. Things were going relatively smoothly, except for a weird issue with xattr when trying to export archives. Regardless, I uploaded the build and was ready to see it processed... And then...

The Problem§

Screen Shot 2017-09-14 at 12.42.56.png

Invalid Bundle - Disallowed LLVM instrumentation. Do not submit apps with LLVM profiling instrumentation or coverage collection enabled. Turn off LLVM profiling or code coverage, rebuild your app and resubmit the app.

LLVM instrumentation? What? I thought that gets striped out on Archive?

Well it turns out, that it does get stripped out, but only for the main application. I use Carthage for dependency management and Carthage doesn't build targets with the Archive action (or rather it can't) and Xcode 9 enables code coverage by default:

Screen Shot 2017-09-14 at 19.03.43.png

The Solution?§

xcodebuild flags don't seem to affect this issue, meaning that every framework developer that makes their libraries available through Carthage will have to manually change this setting.

For the time being you'll have to checkout all of the dependencies and manually change CLANG_ENABLE_CODE_COVERAGE to NO for every dependency before building them with carthage build.

Survival through Tooling§

I've made a little script that streamlines checking for LLVM instrument symbols. Change your working directory to the root of your project and you can pipe this script straight into bash (if you dare):

curl -fsSL https://gist.githubusercontent.com/carlossless/9492d8e20938cfd1ee8163d7cdbfab9b/raw | bash

Hopefully we'll see improvements in later versions of Xcode and xcodebuild, but for now we'll have to live with this.

Resources§

Comments