KISS 🇺🇦

Stop the war!

Stop the war in Ukraine! Fuck putin!

More information is at: https://war.ukraine.ua/.

There is a fund to support the Ukrainian Army: https://savelife.in.ua/en/donate/, and there is a special bank account that accepts funds in multiple currencies: https://bank.gov.ua/en/about/support-the-armed-forces. I donated to them. Please donate if you can!

Killer putin

Killer putin. Source: politico.eu.

Arrested putin

"It hasn't happened yet, but it will happen sooner or later. Beautiful photo, isn't it?" Source: twitter.

CocoaPods and iOS-Universal-framework in the same project

| comments

Updated on 2012-10-10: A follow-up article is here: continuation.

In one of the projects for iOS I’m working on I use CocoaPods to manage external dependencies and a project based on iOS-Universal-framework to build a C++ component as a static library. That is, I have an Xcode workspace with 3 projects: the main one, the library one, and Pods with other dependencies. It all works great except for one thing: I build the project for iOS devices, then build it for simulators, then build for devices again, and here build fails with linking errors:

1
2
3
4
5
6
7
ld: warning: ignoring file ~/Library/Developer/Xcode/DerivedData/proj-aghrequilhjyjydjjzsvybqpxbuq/Build/Products/Debug-iphoneos/libPods.a,
file was built for archive which is not the architecture being linked (armv7):
~/Library/Developer/Xcode/DerivedData/proj-aghrequilhjyjydjjzsvybqpxbuq/Build/Products/Debug-iphoneos/libPods.a
Undefined symbols for architecture armv7:
  "_OBJC_CLASS_$_DDFileLogger", referenced from:
      objc-class-ref in AppDelegate.o

These symbols are from external libraries and exported by the Pods project. In a clean project, which uses CocoaPods, everything is fine. If I delete the framework project, the build process works great: no unnecessary rebuilds after switching schemes.

After some investigation, I found out that the framework project somehow triggered rebuilding the Pods project on every build, and moreover the libPods.a library had the wrong architecture for the target. In other words, when scheme is iOS Device, the library contains armv6 and armv7 architectures in both Debug-iphoneos and Debug-iphonesimulator directories, even though it should contain i386 in the latter file. Then, selecting the scheme for simulator, the both files contain armv6 and armv7 architectures. The third time the files aren’t being rebuilt. That’s why the linking errors show up.

I haven’t been able to fix the cause of the issue, but here are 2 solutions I’ve discovered:

  1. Clean the project before building it for other scheme. It may take a long time though.

  2. The issue seems to be somehow related to the way Xcode builds a workspace with dependencies. Go to Product > Edit Scheme… (⌘<), select Build on the left, and turn off Parallelize Builds option on the right:

This did the trick for me. I have this issue with Xcode 4.3.3 and 4.4, but the cause may be with the iOS-Universal-framework template.

I’d like to find out what’s exactly wrong there. Do you have any ideas?

Comments