mapbox / mapbox-directions-swift

Traffic-aware directions and map matching in Swift on iOS, macOS, tvOS, watchOS, and Linux
https://www.mapbox.com/navigation/
ISC License
184 stars 90 forks source link

Can't build MapboxDirections on simulator running on M1 Mac #561

Closed Deco354 closed 3 years ago

Deco354 commented 3 years ago

Environment

Observed behavior and steps to reproduce

Attempt to run a project containing Mapbox on one of xcode's iOS simulators while on a Mac device with an M1 chip.

Error: /Users/Declan/Projects/iOS/Pods/MapboxNavigation/Sources/MapboxNavigation/Array.swift:2:8: Could not find module 'MapboxDirections' for target 'arm64-apple-ios-simulator'; found: x86_64-apple-ios-simulator, x86_64

image

Podfile:

platform :ios, '13.0'
source 'https://github.com/CocoaPods/Specs.git'
# plugin 'cocoapods-binary'

def shared_pods

    #Analytics
    pod 'UXCam', '3.2.6'

    # Networking
    pod 'Moya', '14.0.0'

    # Redux
    pod 'ReSwift', '4.0.1'
    pod 'ReSwiftRouter', '0.6.0'

    pod 'Sentry', :git => 'https://github.com/getsentry/sentry-cocoa.git', :tag => '7.0.0'

    # Crypto
    pod 'CryptoSwift', '1.3.8'
    pod 'SwiftyRSA'
    pod 'BigInt', '~> 5.2'

    # Utility
    pod 'R.swift', '5.1.0'

    # UI Helper
    pod 'MaterialComponents/BottomSheet', '124.2.0'
    pod 'SnapKit', '5.0.1'
    pod 'IQKeyboardManagerSwift', '6.5.5'
    pod 'SVProgressHUD', '2.2.5'
    pod 'Hero', '1.6.1'
    pod 'lottie-ios', '3.1.5'
    pod 'TTTAttributedLabel', '2.0.0'
    pod 'SkeletonView', '1.7.0'

    # Snapchat
    pod 'SnapSDK', '1.3.5'

    # Menu
    pod 'SideMenu', '6.4.8'

    # Load images
    pod 'SDWebImage', '5.4.2'

    # Map and navigation
    pod 'MapboxCoreNavigation', :git => 'https://github.com/mapbox/mapbox-navigation-ios.git', :tag => 'v2.0.0-beta.14'
    pod 'MapboxNavigation', :git => 'https://github.com/mapbox/mapbox-navigation-ios.git', :tag => 'v2.0.0-beta.14'
    pod 'MapboxGeocoder.swift', '0.12'

    # ReachabilitySwift
    pod 'ReachabilitySwift', '5.0.0'

    # Popups
    pod 'SwiftEntryKit', '1.2.3'

    # FIREBASE
    pod 'Firebase/Analytics', '~> 8.1'
    pod 'Firebase/Crashlytics', '~> 8.1'
    pod 'Firebase/Core', '~> 8.1'
    pod 'Firebase/Messaging', '~> 8.1'
    pod 'Firebase/RemoteConfig', '~> 8.1'

    #Facebook Login
    pod 'FBSDKLoginKit', '~> 9.0.0'

    # BlinkID
    pod 'PPBlinkID', '5.1.0'

    # Walkthrough
    pod "BWWalkthrough", '4.0.0'

    pod 'SwiftyJSON', '4.3.0'

    # Payments
    pod 'Frames', '3.1.1'

    # Referrals
    pod 'Branch', '~> 0.37.0'

    # SVGs
    pod 'SwiftSVG', '2.3.2'

    # Rx
    pod 'RxSwift', '5.1.1'
    pod 'RxCocoa', '5.1.1'
    pod 'RxBlocking', '5.1.1'

    # Pods for GrpcIOS
    pod 'gRPC-Swift', '1.1.0'

    # Pods for DI
    pod 'Resolver', '1.4.0'

    # Linter
    pod 'SwiftLint', '0.42.0'

    # Persistance
    pod 'RealmSwift', '~> 10.8'

end

target 'Skoot' do
  use_frameworks!
  shared_pods
end

target 'SkootUITests' do
  use_frameworks!
  shared_pods
end

target 'SkootTests' do
  use_frameworks!
  shared_pods

  pod "Cuckoo", '1.5.0'

end

post_install do |installer|
  installer.pods_project.build_configurations.each do |config|
    config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64"
    next unless config.name == 'Debug'
    config.build_settings['LD_RUNPATH_SEARCH_PATHS'] = [
      '$(FRAMEWORK_SEARCH_PATHS)'
    ]
  end
  installer.pods_project.targets.each do |target|
          target.build_configurations.each do |config|
              config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '13.0'
          end
      end
end

Pod warnings:

[!] CocoaPods did not set the base configuration of your project because your project already has a custom config set. In order for CocoaPods integration to work at all, please either set the base configurations of the target `Skoot` to `Target Support Files/Pods-Skoot/Pods-Skoot.release (development).xcconfig` or include the `Target Support Files/Pods-Skoot/Pods-Skoot.release (development).xcconfig` in your build configuration (`Skoot/Configs/Development.xcconfig`).

Expected behavior

Project builds and runs on simulator.

Notes / preliminary analysis

I can build the project on simulator if I open xcode with rosetta but xcode's performance makes this very difficult to use. I've also tried various solutions where I've modified the architectures used within the build settings and added a few configuration changes to the podfile but to no avail.

S2Ler commented 3 years ago

Hi @Deco354, could you try to remove config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64" work around?

Deco354 commented 3 years ago

This did the job. Thank you.