Appboy / appboy-ios-sdk

Public repo for the Braze iOS SDK
https://www.braze.com
Other
165 stars 142 forks source link

Cannot build for simulator 📱 in Apple M1 (Apple Silicon) machine 💻 #270

Closed PH9 closed 3 years ago

PH9 commented 3 years ago

Report

Describe your environment.

Info Value
Platform Name e.g. ios
Platform Version e.g. 14.3
SDK Version e.g. 3.11.1
Integration Method e.g. cocoapods
Xcode Version e.g. Xcode 12.3 (12C33) / macOS Bug Sur 11.0.1
Repro rate e.g. all the time (100%)

What did you do?

Integrate Braze through Cocoapods.

What did you expect to happen?

Braze SDK is integrated properly and creating sessions.

What happened instead?

Error:

Ld /Users/w/Library/Developer/Xcode/DerivedData/Kaidee-fmdifjyslckreieqwbmpuwtegwoh/Build/Products/Debug-iphonesimulator/Appboy-iOS-SDK/Appboy_iOS_SDK.framework/Appboy_iOS_SDK normal (in target 'Appboy-iOS-SDK' from project 'Pods')
    cd /Users/w/iOS/Pods
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -target x86_64-apple-ios10.0-simulator -dynamiclib -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.3.sdk -L/Users/w/Library/Developer/Xcode/DerivedData/Kaidee-fmdifjyslckreieqwbmpuwtegwoh/Build/Products/Debug-iphonesimulator/Appboy-iOS-SDK -L/Users/w/iOS/Pods/Appboy-iOS-SDK/AppboyKit -F/Users/w/Library/Developer/Xcode/DerivedData/Kaidee-fmdifjyslckreieqwbmpuwtegwoh/Build/Products/Debug-iphonesimulator/Appboy-iOS-SDK -F/Users/w/Library/Developer/Xcode/DerivedData/Kaidee-fmdifjyslckreieqwbmpuwtegwoh/Build/Products/Debug-iphonesimulator/SDWebImage -filelist /Users/w/Library/Developer/Xcode/DerivedData/Kaidee-fmdifjyslckreieqwbmpuwtegwoh/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/Appboy-iOS-SDK.build/Objects-normal/x86_64/Appboy_iOS_SDK.LinkFileList -install_name @rpath/Appboy_iOS_SDK.framework/Appboy_iOS_SDK -Xlinker -rpath -Xlinker @executable_path/Frameworks -Xlinker -rpath -Xlinker @loader_path/Frameworks -dead_strip -Xlinker -object_path_lto -Xlinker /Users/w/Library/Developer/Xcode/DerivedData/Kaidee-fmdifjyslckreieqwbmpuwtegwoh/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/Appboy-iOS-SDK.build/Objects-normal/x86_64/Appboy_iOS_SDK_lto.o -Xlinker -export_dynamic -Xlinker -no_deduplicate -Xlinker -objc_abi_version -Xlinker 2 -fobjc-arc -fobjc-link-runtime -fprofile-instr-generate -ObjC -lAppboyKitLibrary -lz -framework CoreText -framework QuartzCore -framework SystemConfiguration -framework WebKit -weak_framework Accounts -weak_framework AdSupport -weak_framework CoreTelephony -weak_framework Social -weak_framework UserNotifications -ObjC -framework CoreText -framework Foundation -framework QuartzCore -framework SDWebImage -framework SystemConfiguration -framework WebKit -Xlinker -no_adhoc_codesign -compatibility_version 1 -current_version 1 -Xlinker -dependency_info -Xlinker /Users/w/Library/Developer/Xcode/DerivedData/Kaidee-fmdifjyslckreieqwbmpuwtegwoh/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/Appboy-iOS-SDK.build/Objects-normal/x86_64/Appboy_iOS_SDK_dependency_info.dat -o /Users/w/Library/Developer/Xcode/DerivedData/Kaidee-fmdifjyslckreieqwbmpuwtegwoh/Build/Products/Debug-iphonesimulator/Appboy-iOS-SDK/Appboy_iOS_SDK.framework/Appboy_iOS_SDK
ld: warning: ignoring file /Users/w/Library/Developer/Xcode/DerivedData/Kaidee-fmdifjyslckreieqwbmpuwtegwoh/Build/Products/Debug-iphonesimulator/SDWebImage/SDWebImage.framework/SDWebImage, building for iOS Simulator-x86_64 but attempting to link with file built for iOS Simulator-arm64
Undefined symbols for architecture x86_64:
  "_OBJC_CLASS_$_SDImageCache", referenced from:
      objc-class-ref in ABKSDWebImageProxy.o
  "_OBJC_CLASS_$_SDWebImageManager", referenced from:
      objc-class-ref in ABKSDWebImageProxy.o
  "_OBJC_CLASS_$_SDWebImageActivityIndicator", referenced from:
      objc-class-ref in ABKSDWebImageProxy.o
  "_OBJC_CLASS_$_SDWebImagePrefetcher", referenced from:
      objc-class-ref in ABKContentCardsTableViewController.o
      objc-class-ref in ABKNewsFeedTableViewController.o
      objc-class-ref in ABKSDWebImageProxy.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Showing Recent Messages
Ignoring file /Users/w/Library/Developer/Xcode/DerivedData/Kaidee-fmdifjyslckreieqwbmpuwtegwoh/Build/Products/Debug-iphonesimulator/SDWebImage/SDWebImage.framework/SDWebImage, building for iOS Simulator-x86_64 but attempting to link with file built for iOS Simulator-arm64
Undefined symbol: _OBJC_CLASS_$_SDImageCache
Undefined symbol: _OBJC_CLASS_$_SDWebImageManager
Undefined symbol: _OBJC_CLASS_$_SDWebImageActivityIndicator
Undefined symbol: _OBJC_CLASS_$_SDWebImagePrefetcher

image

Steps to reproduce

  1. Open terminal /Applications/Utilities/Terminal.app via rosetta. By goto /Applications/Utilities/ then right click at Terminal check Open using Rosseta in General section.
  2. Install via rosetta 2 arch -x86_64 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
  3. Install rbenv brew install rbenv
  4. Install oh-my-zsh sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
  5. rbenv install 2.7.2
  6. rbenv global 2.7.2
  7. rbenv init and copy eval "$(rbenv init -)" to .zshrc
  8. re-run the terminal
  9. bundle install
  10. bundle exec pod install
  11. open .xcworkspace with an Xcode.
  12. CMD+R then build fail and got above log.
PH9 commented 3 years ago

Supporting email said it related to #268 and workaround here: https://github.com/Appboy/appboy-ios-sdk/issues/268#issuecomment-749200637 I'll try on this, and give you the results.

Not sure this will help, because we are running the project over the intel machine with Xcode 12.3.

PH9 commented 3 years ago

It is able to run on real devices only, not support for simulator.

ilendemli commented 3 years ago

Hi! I have some compilation errors using the '4.0.0-beta' branch on an M1 machine aswell:

``` Undefined symbols for architecture arm64: "_OBJC_CLASS_$_ABKInAppMessageHTML", referenced from: objc-class-ref in ABKInAppMessageUIController.o (maybe you meant: _OBJC_CLASS_$_ABKInAppMessageHTMLFullViewController, _OBJC_CLASS_$_ABKInAppMessageHTMLViewController , _OBJC_CLASS_$_ABKInAppMessageHTMLBaseViewController ) "_OBJC_CLASS_$_ABKInAppMessageHTMLFull", referenced from: objc-class-ref in ABKInAppMessageUIController.o (maybe you meant: _OBJC_CLASS_$_ABKInAppMessageHTMLFullViewController) "_OBJC_CLASS_$_ABKInAppMessageModal", referenced from: objc-class-ref in ABKInAppMessageImmersiveViewController.o objc-class-ref in ABKInAppMessageUIController.o objc-class-ref in ABKInAppMessageWindowController.o (maybe you meant: _OBJC_CLASS_$_ABKInAppMessageModalViewController) "_OBJC_CLASS_$_ABKInAppMessageSlideup", referenced from: objc-class-ref in ABKInAppMessageSlideupViewController.o objc-class-ref in ABKInAppMessageUIController.o objc-class-ref in ABKInAppMessageWindowController.o (maybe you meant: _OBJC_CLASS_$_ABKInAppMessageSlideupViewController) "_OBJC_CLASS_$_ABKInAppMessageWebViewBridge", referenced from: objc-class-ref in ABKInAppMessageHTMLBaseViewController.o "_OBJC_CLASS_$_ABKInAppMessageFull", referenced from: objc-class-ref in ABKInAppMessageImmersiveViewController.o objc-class-ref in ABKInAppMessageUIController.o (maybe you meant: _OBJC_CLASS_$_ABKInAppMessageFullViewController) "_OBJC_CLASS_$_Appboy", referenced from: objc-class-ref in ABKInAppMessageHTMLBaseViewController.o objc-class-ref in ABKInAppMessageModalViewController.o objc-class-ref in ABKInAppMessageUIController.o objc-class-ref in ABKInAppMessageWindowController.o objc-class-ref in ABKUIURLUtils.o "_OBJC_CLASS_$_ABKInAppMessageImmersive", referenced from: objc-class-ref in ABKInAppMessageFullViewController.o objc-class-ref in ABKInAppMessageImmersiveViewController.o objc-class-ref in ABKInAppMessageModalViewController.o objc-class-ref in ABKInAppMessageUIController.o objc-class-ref in ABKInAppMessageWindowController.o (maybe you meant: _OBJC_CLASS_$_ABKInAppMessageImmersiveViewController) ld: symbol(s) not found for architecture arm64 clang: error: linker command failed with exit code 1 (use -v to see invocation) ```
tbelote commented 3 years ago

For M1 support along with simulator it is likely to force us to use xcframeworks instead of plain static libraries with multiple architectures lipo'd in to them. This is something we are working on and more updates are coming.

julianpomper commented 3 years ago

Hi :) I have the same issue as @ilendemli. Are there any updates regarding this?

Vitalii-Gozhenko commented 3 years ago

Hi, Is there any news about Apple Silicon support and migration to xcframework?

hokstuff commented 3 years ago

Hi @Vitalii-Gozhenko,

Sorry for the delay - we are actively working to use XCFrameworks in our Cocoapods release to officially support M1 devices. We don't yet have an exact timeline for when this will be available, but we are aiming to have it ready soon. In the meantime, please try using our version 4.0.0-beta1 that should have initial support for M1 devices.

Thanks for your patience!

S2Ler commented 3 years ago

@hokstuff Will you distribute AppboyPushStory.framework as a xcframework as well?

hokstuff commented 3 years ago

@S2Ler Yup, we plan to distribute an AppboyPushStory.xcframework through Cocoapods in the near future. That project is currently in the validation phases so we will hopefully be able to release it soon.

Right now, we have AppboyPushStory available as an xcframework when integrating with Swift Package Manager.

S2Ler commented 3 years ago

Thanks a lot, I will give it a try.

daltonclaybrook commented 3 years ago

Hi, checking in here since there hasn't been any activity in a while. Any progress to report on the XCFramework migration?

hokstuff commented 3 years ago

Hi @daltonclaybrook,

Thanks for checking in! As of right now we don't have an exact timeline, but - pending any new changes - we are hoping to include the rest of our XCFramework migration in the next release.

Thanks!

hokstuff commented 3 years ago

@PH9 @ilendemli @julianpomper @Vitalii-Gozhenko @S2Ler @daltonclaybrook and others,

We're excited to announce that we've released version 4.0.0 to GA which uses XCFrameworks for Cocoapods. This means that your apps will now be able to run on the simulator on your M1 machines!

We appreciate the patience y'all have shown during this process! Let us know if you run into any issues.

Thank you!