segmentio / analytics-ios

The hassle-free way to integrate analytics into any iOS application.
https://segment.com/libraries/ios
MIT License
401 stars 334 forks source link

Unable to build the framework #115

Closed jorlow closed 9 years ago

jorlow commented 10 years ago

I have a fresh checkout of the source, an up to date cocoapods, ran "pod install", and then tried to build the "Analytics.framework" scheme and got the following error.

fatal error: lipo: fat input file (/Users/jorlow/src/segment-io/DerivedData/Analytics/Build/Products/Release/libAnalytics.a) does not contain the specified architecture (x86_64) to thin it to

Any idea what's going on or how I can fix it? I saw this with both Xcode 5 and 5.1

reinpk commented 10 years ago

I think you'll need to set the Pod project to build for arm64, for some reason the pod project that gets created isn't set by default to build for all architectures. If that's not the issue feel free to re-open :)

jorlow commented 10 years ago

I tried a bunch of things and had a couple co-workers give it a shot too (who are wiser in the ways of cocoapods and xcode). We weren't able to get it working though. Any advice, guidance would be really nice.

jorlow commented 10 years ago

I can't figure out how to re-open though.

reinpk commented 10 years ago

will try to look into this week!

jorlow commented 10 years ago

Thanks a lot! For what it's worth, I had two others try this on their computer and fail but then a third (with a similar set up to the rest of us) tried and had no problem. So I'm not sure what's going on. But let me know if there's any info I can provide to help!

reinpk commented 10 years ago

haha oh fun :D ok i'll commandeer someone's computer this week and try it out, did you compare versions or anything? that would be super helpful, thanks man!

jorlow commented 10 years ago

What things should we look at besides xcode version and cococapods version?

reinpk commented 10 years ago

that's probably good!

jkoppel commented 10 years ago

I'm getting this too. I thought I was okay because the "Analytics" scheme built fine, but the "Analytics.framework" scheme is failing with the same error.

realf commented 10 years ago

The same issue here

realf commented 10 years ago

This is what helped to me https://gist.github.com/realf/9972233

jorlow commented 10 years ago

Thanks a lot @realf !

That got me closer, but now I'm seeing this: "lipo: can't open input file: /Users/jorlow/src/segment-io/DerivedData/Analytics/Build/Products/Release/libAnalytics-x86_64-clean.a (No such file or directory)"

realf commented 10 years ago

@jorlow Try to remove it in a framework build phase:

## Create a fat lib from the now cleaned up thin libs and place inside framework
lipo -output "${PRODUCT_PATH}/Versions/A/Analytics" -create \
    "${SYMROOT}/Release/libAnalytics-i386-clean.a" \
    "${SYMROOT}/Release/libAnalytics-armv7-clean.a" \
    "${SYMROOT}/Release/libAnalytics-armv7s-clean.a" \
    "${SYMROOT}/Release/libAnalytics-arm64-clean.a" \
    "${SYMROOT}/Release/libAnalytics-x86_64-clean.a"
jorlow commented 10 years ago

Sorry @realf I don't quite understand what you mean.

realf commented 10 years ago

@jorlow https://gist.github.com/realf/10011777 Here is a gist. Copy and paste it to the build phase "Build Framework" of Analytics.framework

jorlow commented 10 years ago

It finally built after I did that and deleted "${SRCROOT}/Pods/Mixpanel/Mixpanel/*.xib". Thanks a lot!

reinpk commented 10 years ago

this is pretty odd, x86_64 is the architecture required to run the simulator on a 64-bit Mac. Do you have a 32-bit Mac that you're developing on?

jorlow commented 10 years ago

Mavericks with latest gen mac book pro + Xcode 5.0. Definitely 64bit.

$ xcodebuild -version Xcode 5.0.2 Build version 5A3005

$ pod --version 0.29.0

$ ruby --version ruby 2.0.0p247 (2013-06-27 revision 41674) [universal.x86_64-darwin13]

reinpk commented 10 years ago

have you tried testing the built framework in a simulator demo app? i tried making the suggested changes here locally, and while it also builds successfully for me, a simulator demo app now fails to build with the following error:

ld: warning: missing required architecture x86_64 in file /analytics-ios/Examples/DirectIncludeExample/Analytics.framework/Analytics (4 slices)

when I add back the x86_64 slice then the demo app builds happily for the simulator.

this makes sense since the simulator needs an x86_64 slice. i'm not sure how to debug the framework build issue that all you guys are seeing :/ but for the main repo and framework build script we definitely need to keep that slice in.

i'd love to resolve this since it seems to be a blocker on contributions to the SDK, but not sure how to replicate, sorry!

realf commented 10 years ago

Well, another blocking thing was Localytics. We had to remove its provider to be able to build the framework.

travisjeffery commented 10 years ago

i was recently chatting with someone who had this problem and this was the solution for them

f2prateek commented 9 years ago

Closing, feel free to reopen if you're still encountering issues.