Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When runtime adds Cocoapods, it should include 'i386' as architecture options #536

Closed
NathanWalker opened this issue Mar 21, 2016 · 6 comments

Comments

@NathanWalker
Copy link
Contributor

For instance, this Cocoapod:
https://github.com/NathanWalker/MaterialCard

Can be setup as a plugin with a Podfile:

pod 'MaterialCard', '~> 1.0.4'

And when run via tns emulate ios, it fails because the Simulator requires i386 architecture and pod setups by default only specify the various standard $(ARCHS_STANDARD) flavors like arm64 armv7 armv7s.
The runtime should automatically ensure that i386 architecture is added for CocoaPods when installing and running them in the Simulator.

Worth noting that using tns run ios with a iPhone connected runs just fine.
So it's definitely isolated to running in the Simulator.

The pod is used here:
https://github.com/bradmartin/nativescript-cardview
Holding off on releasing a new version until I can get some feedback here on what's going on with the aforementioned.
Please help provide insight here if anyone knows?

@NathanWalker
Copy link
Contributor Author

Sample of errors resulting from not including i386 as build architecture option:

ld: warning: Auto-Linking supplied '/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/libswiftFoundation.dylib', missing required architecture i386 in file /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/libswiftFoundation.dylib (3 slices)
ld: warning: Auto-Linking supplied '/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/libswiftObjectiveC.dylib', missing required architecture i386 in file /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/libswiftObjectiveC.dylib (3 slices)
ld: warning: Auto-Linking supplied '/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/libswiftDispatch.dylib', missing required architecture i386 in file /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/libswiftDispatch.dylib (3 slices)
ld: warning: Auto-Linking supplied '/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/libswiftCore.dylib', missing required architecture i386 in file /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/libswiftCore.dylib (3 slices)
ld: warning: Auto-Linking supplied '/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/libswiftCoreGraphics.dylib', missing required architecture i386 in file /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/libswiftCoreGraphics.dylib (3 slices)
ld: warning: Auto-Linking supplied '/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/libswiftUIKit.dylib', missing required architecture i386 in file /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/libswiftUIKit.dylib (3 slices)
ld: warning: Auto-Linking supplied '/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/libswiftDarwin.dylib', missing required architecture i386 in file /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/libswiftDarwin.dylib (3 slices)
ld: warning: Auto-Linking supplied '/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/libswiftCoreImage.dylib', missing required architecture i386 in file /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/libswiftCoreImage.dylib (3 slices)

@ivanbuhov
Copy link
Contributor

Hi @NathanWalker
Check this thread and try the suggested solutions. Downgrading to Xcode 7.1 should do the trick but if you don't want to downgrade you can try settings "Embedded Content Contains Swift Code" option to "Yes" in the app's target. If this makes it work, you can apply this setting by setting it in a plugin's build.xcconfig file, instead of manually changing the Xcode project in platforms/ios. The CLI will merge the .xcconfig file with the project settings.
Let me know if this works for you.

@NathanWalker
Copy link
Contributor Author

@ivanbuhov Thanks for your help. I've tried this but doesn't seem to work or I'm not doing it correctly.
Things I've tried:

  • add platforms/ios/build.xcconfig alongside the Podfile in the plugin with these contents:
EMBEDDED_CONTENT_CONTAINS_SWIFT = YES

Result: Doesn't appear to change anything.

  • add post_install step to Podfile which would append that to the Pod's .xcconfig:
post_install do |installer|
    system "sed -i '' -E 's/SKIP_INSTALL[[:space:]]=[[:space:]]YES/SKIP_INSTALL = YES\\\nEMBEDDED_CONTENT_CONTAINS_SWIFT = YES\\\n/g' Pods/Target\\ Support\\ Files/MaterialCard/*.xcconfig"
end

Result: It does add to the .xcconfig correctly but it results in the same error above. (missing required architecture i386)

  • modifying post_install to add VALID_ARCHS:
post_install do |installer|
    system "sed -i '' -E 's/SKIP_INSTALL[[:space:]]=[[:space:]]YES/SKIP_INSTALL = YES\\\nEMBEDDED_CONTENT_CONTAINS_SWIFT = YES\\\nVALID_ARCHS = \\\"i386\\\"/g' Pods/Target\\ Support\\ Files/MaterialCard/*.xcconfig"
end

Result: Same error still.

Any other suggestions? Or help me understand what is going on. Pretty frustrating.

@ivanbuhov
Copy link
Contributor

My idea was to take advantage of the CLI support for merging build.xcconfig files instead of doing it manually, but it seems this will not make it work. What is your Xcode version? If you are using Xcode 7.2, try downgrading to 7.1.1. It is helpful to know whether the issue is reproducible with Xcode 7.1.1 because according to this related thread it appears only on Xcode 7.2.

@NathanWalker
Copy link
Contributor Author

Thanks @ivanbuhov you've been very helpful. I'm going to try the brave new ground with XCode 7.3 just released yesterday actually. If that doesn't work, I'll downgrade.

@NathanWalker
Copy link
Contributor Author

Ok so I just tried 7.3 and it works and fixes this issue! Hooray! 👍
However this issue applies (added separately) here:
#538

I'll close this in favor of the new one, hopefully a new ios-runtime can be released to fix that for 7.3 and all will be good.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants