kstenerud / iOS-Universal-Framework

An XCode project template to build universal frameworks (arm7, arm7s, and simulator) for iOS / iPhone.
2.95k stars 473 forks source link

Is "Build active architecture only" supposed to be set to "no" or "yes" in project's framework target? #163

Closed Halle closed 5 years ago

Halle commented 10 years ago

Greetings Karl,

Thank you so much for this incredibly useful project. I have been using it for years for my libraries and it has made the install process for new developers much easier to execute and to troubleshoot, so it has really helped me keep support focused on helping people develop their apps rather helping them get libraries linked.

I am using mk7 still because my build system is pretty complex and I haven't quite gotten the time to do the depth of testing I'd need before confidently switching to mk8. In all of my framework projects, "Build Active Architecture Only" is set to "no". I no longer recall if that was their original setting or if I changed that at some point while troubleshooting a linker error.

My question is whether this is the correct setting, or if the fact that the scripts execute the multiple architecture slice builds mean that the project's "Build Active Architecture Only" setting can be on "yes".

For some background on why I haven't just tested this myself yet, I started looking into it by first building my framework using both of the build settings in question and taking a look at the product size, and it was identical in both cases (the build time in both cases is not the same -- it's about 5x longer when "Build Active Architecture Only" is set to "no" with most of the time being spent in running the last script). This file size similarity suggests that it is the full-size universal static library with all slices in both cases, regardless of whether building all architectures has been requested in the build settings or not, but the difference in build time suggests that something significant is happening in the second case.

Then when I set the project to build active architectures only, when it was embedded in another project as a dependency, I got an error about a missing slice when sending the app project to a test. However, it is entirely possible that this is not an error in the framework being a universal static library or not, but instead something to do with a picky or quirky setting of my overall build system, so before starting a big round of troubleshooting to verify this further I wanted to check in with you and just ask:

It is expected that changing the "Build Active Architecture Only" for a framework target will affect whether a universal static library with slices for all architectures is built? Is it a requirement that it be set to "no" in order to build a universal static library with all of the slices requested in the "Architectures" setting or is it actually possible to build a universal static library product when "Build Active Architecture Only" is set to "yes" due to the extra slices being produced as a result of the script? Thank you for your assistance.

thalmicMark commented 10 years ago

I believe it is supposed to be set to NO for both debug and release. As well, I've got Architectures set to standard architectures (including 64-bit) and Valid Architectures set to armv7 armv7s i386 arm64 in order to build a universal framework for these architectures. If I change these settings, I believe it will not build a universal framework, thus throwing the error you saw.