0

Hi have this cocoapod framework, which I distribute in binary mode only (no sources). Basically, I am distributing the output of carthage build, which creates a dynamic framework.

I have been asked to release a static version of this framework as well. I have made a new target in XCode which builds the framework using a static library (using same sources as the dynamic framework).

Eventually, I file ...blabla.a and see it contains only arm architectures.

I have been looking into: https://github.com/Carthage/Carthage/blob/master/Documentation/StaticFrameworks.md - but this just fails for me (at linking state it tries to execute Ld which fails).

My code is only objc, and I am running Xcode 10.2.1.

elcuco
  • 8,948
  • 9
  • 47
  • 69

1 Answers1

0

Version v0.30 and above of Carthage can build static frameworks. Documentation does not say how :)

The link provided above is useless (does not work on modern systems). Instead I used this: https://github.com/Carthage/Carthage/issues/2534#issuecomment-407807111 and got a static framework.

As a bonus, I was able to make a new cocoapod (I added a new podfile, with same name and a static postfix), which links to my static build (in the same repo as the dynamic, just a different path), only diff between those two pods, is s.static_framework = true.

I am unsure how to make this a single pod which will honour use_framworks!, this this method

elcuco
  • 8,948
  • 9
  • 47
  • 69
  • Hi Elcuco, how to add static framework dependent libraries within the static framework binary? Here is what I am looking for and having hard time to figure out in adding dependencies. https://stackoverflow.com/questions/64074890/xcode-11-building-a-static-framework-which-includes-other-frameworks-libs-into – Shiva Reddy Sep 28 '20 at 04:11
  • @ShivaReddy I no longer have access to a mac, so "wave handing" this to you. I created another library, which is called "foo_static" on it I added `s.static_framework = true` - when on my dependant target I asked the `foo_static` instead of `foo`. – elcuco Oct 05 '20 at 16:29