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

Multiple real frameworks as target dependencies #169

Open u10int opened 10 years ago

u10int commented 10 years ago

This is regarding the Real Framework template from mk7.

I've run into a strange issue that only seems to happen when I have more than one framework as a target dependency on a project. In my project I've created two frameworks that are independent of each other that my application project depends on. Before I only had one and everything worked fine, but I've added a new set of features that makes more sense to keep separate in it's own framework (as it's also in it's own git repo).

The problem I've run into and been trying to track down the cause for the past two days is it seems that if more than one Real Framework project is included as a target dependency in an app, only the last framework gets built as a universal binary. For instance, here's my project setup:

- FrameworkA.xcodeproj
- FrameworkB.xcodeproj
- Application.xcodeproj
     => FrameworkA.xcodeproj
     => FrameworkB.xcodeproj
     => Classes

When building everything from Application, FrameworkA only gets built for the current architecture (i386) while FrameworkB successfully builds as a universal binary, which I've verified with lipo -info. The other weird thing is that happens is FrameworkA will always end up with duplicate symbols when it doesn't successfully build as a static framework. However, when I build FrameworkA separately on its own, it successfully gets built as a universal binary. Also, if I remove FrameworkB as a target dependency on Application, then FrameworkA will again be a successful universal binary.

I've checked Xcode's compiler logs, specifically the echo lines from the shell scripts that create the static framework, and cannot see any difference in them that would cause this across the various methods to build them. It seems that it's only building the current architecture (i386) for both Debug-iphoneos and Debug-iphonesimulator, then combining them when trying to create the universal binary, but instead results in duplicate symbols and no universal binary.

I've searched endlessly and couldn't find anyone else having a similar issue, so wondering if it's something with the Real Framework scripts or some weird issue with Xcode. Note that I have tried completely rebuilding the FrameworkA project several times and always had the same result. I also tried with another FrameworkC instead of FrameworkA and the same thing happened to it.

u10int commented 10 years ago

I did happen to find a less-than-ideal workaround for this issue. It seems that I can set FrameworkA as a dependency of FrameworkB, and then set FrameworkB as a dependency to my Application. I still have to link with FrameworkA.framework in my Application project, but everything builds fine without the duplicate symbol errors:

- FrameworkA.xcodeproj
- FrameworkB.xcodeproj
- Application.xcodeproj
     => FrameworkB.xcodeproj
          => FrameworkA.xcodeproj
     => Classes

This isn't ideal so I'd still like to determine the cause and a solution for my original issue, if anyone has experienced something similar.

Thanks!

gabybaby16 commented 10 years ago

Try running two seperate but identical scripts and make them run from data folder

Sent from my iPhone

On Jan 10, 2014, at 7:19 AM, Nicholas Shipes notifications@github.com wrote:

This is regarding the Real Framework template from mk7.

I've run into a strange issue that only seems to happen when I have more than one framework as a target dependency on a project. In my project I've created two frameworks that are independent of each other that my application project depends on. Before I only had one and everything worked fine, but I've added a new set of features that makes more sense to keep separate in it's own framework (as it's also in it's own git repo).

The problem I've run into and been trying to track down the cause for the past two days is it seems that if more than one Real Framework project is included as a target dependency in an app, only the last framework gets built as a universal binary. For instance, here's my project setup:

  • FrameworkA.xcodeproj
  • FrameworkB.xcodeproj
  • Application.xcodeproj => FrameworkA.xcodeproj => FrameworkB.xcodeproj => Classes When building everything from Application, FrameworkA only gets built for the current architecture (i386) while FrameworkB successfully builds as a universal binary, which I've verified with lipo -info. The other weird thing is that happens is FrameworkA will always end up with duplicate symbols when it doesn't successfully build as a static framework. However, when I build FrameworkA separately on its own, it successfully gets built as a universal binary. Also, if I remove FrameworkB as a target dependency on Application, then FrameworkA will again be a successful universal binary.

I've checked Xcode's compiler logs, specifically the echo lines from the shell scripts that create the static framework, and cannot see any difference in them that would cause this across the various methods to build them. It seems that it's only building the current architecture (i386) for both Debug-iphoneos and Debug-iphonesimulator, then combining them when trying to create the universal binary, but instead results in duplicate symbols and no universal binary.

I've searched endlessly and couldn't find anyone else having a similar issue, so wondering if it's something with the Real Framework scripts or some weird issue with Xcode. Note that I have tried completely rebuilding the FrameworkA project several times and always had the same result. I also tried with another FrameworkC instead of FrameworkA and the same thing happened to it.

— Reply to this email directly or view it on GitHub.