Jonas
Jonas

Reputation: 665

All source files for cocoa pods are compiled twice

I have an Xcode project (objective c, Xcode 8.2.1).

Whenever I do "Clean build" and build again, it takes a very long time. I started to look into the reason for this and I noticed that all my pod source files are being compiled twice (which I guess doubles the compile time).

At the top of Xcode, you can see the status of the build as it progresses

enter image description here

You can see in the screenshot above that Xcode is compiling 142 source files for the Realm pod, but it only has 71 source files. All my other pods have the same issue.

I tested creating a new xcode project and adding pods, and then I don't experience the same problem as in this project.

@Bdash suggested that I might be having the build setting "Build Active Architecture Only" set to "No", but I have checked this and it is set to "Yes".

Any ideas on what could be the problem here?

Upvotes: 1

Views: 556

Answers (2)

Víctor Pimentel
Víctor Pimentel

Reputation: 128

This tends to happen when you have custom names for your build configurations. That is, if you have a name other than Debug or Release, CocoaPods will treat such configurations as release ones. Besides other things, this means enabling optimizations and setting the Build Active Architecture Only flag for those Pods to YES. Both options will hinder compilation times for Debug configurations.

To fix it you have to specify which configurations are Debug ones. Following the docs, you have to change your Podfile so it looks something like this:

project 'MyApp', 'MyAppRelease' => :release, 'MyAppDebug' => :debug

Upvotes: 1

AustinZ
AustinZ

Reputation: 1787

Unfortunately, Realm is a large project with a significant number of C++ and Objective-C++ source files, and generally takes a while to compile (especially after cleaning the build folder). Exactly how long Realm takes to build depends on what sort of computer Xcode is running on, but the numbers you provided don't seem to be unreasonable for older hardware.

Upvotes: 0

Related Questions