react-native-maps: [IOS] Release build configuration causes arm64 architecture build error for GoogleMaps

Is this a bug report?

Yes

Have you read the Installation Instructions?

Yes

Environment

    "react-native": "0.62.2",
    "react": "16.11.0",
    "react-native-maps": "0.27.1",

I am using GoogleMaps for IOS Deployment Target IOS 11.0 XCode Version 12.0 beta 4 (12A8179i)

Process to recreate

  1. Set your build configuration to Release on XCode
  2. Clean and build
  3. Witness Error

Expected Behavior

Simulator to launch with app running in release mode.

Actual Behavior

Error seen in logs:

ld: building for iOS Simulator, but linking in object file built for iOS, file '/Users/[username]/Documents/C/tonsr2/ios/Pods/GoogleMaps/Maps/Frameworks/GoogleMaps.framework/GoogleMaps' for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

PODFILE

platform :ios, '11.0'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'

def add_flipper_pods!(versions = {})
  versions['Flipper'] ||= '~> 0.33.1'
  versions['DoubleConversion'] ||= '1.1.7'
  versions['Flipper-Folly'] ||= '~> 2.1'
  versions['Flipper-Glog'] ||= '0.3.6'
  versions['Flipper-PeerTalk'] ||= '~> 0.0.4'
  versions['Flipper-RSocket'] ||= '~> 1.0'

  pod 'FlipperKit', versions['Flipper'], :configuration => 'Debug'
  pod 'FlipperKit/FlipperKitLayoutPlugin', versions['Flipper'], :configuration => 'Debug'
  pod 'FlipperKit/SKIOSNetworkPlugin', versions['Flipper'], :configuration => 'Debug'
  pod 'FlipperKit/FlipperKitUserDefaultsPlugin', versions['Flipper'], :configuration => 'Debug'
  pod 'FlipperKit/FlipperKitReactPlugin', versions['Flipper'], :configuration => 'Debug'

  # List all transitive dependencies for FlipperKit pods
  # to avoid them being linked in Release builds
  pod 'Flipper', versions['Flipper'], :configuration => 'Debug'
  pod 'Flipper-DoubleConversion', versions['DoubleConversion'], :configuration => 'Debug'
  pod 'Flipper-Folly', versions['Flipper-Folly'], :configuration => 'Debug'
  pod 'Flipper-Glog', versions['Flipper-Glog'], :configuration => 'Debug'
  pod 'Flipper-PeerTalk', versions['Flipper-PeerTalk'], :configuration => 'Debug'
  pod 'Flipper-RSocket', versions['Flipper-RSocket'], :configuration => 'Debug'
  pod 'FlipperKit/Core', versions['Flipper'], :configuration => 'Debug'
  pod 'FlipperKit/CppBridge', versions['Flipper'], :configuration => 'Debug'
  pod 'FlipperKit/FBCxxFollyDynamicConvert', versions['Flipper'], :configuration => 'Debug'
  pod 'FlipperKit/FBDefines', versions['Flipper'], :configuration => 'Debug'
  pod 'FlipperKit/FKPortForwarding', versions['Flipper'], :configuration => 'Debug'
  pod 'FlipperKit/FlipperKitHighlightOverlay', versions['Flipper'], :configuration => 'Debug'
  pod 'FlipperKit/FlipperKitLayoutTextSearchable', versions['Flipper'], :configuration => 'Debug'
  pod 'FlipperKit/FlipperKitNetworkPlugin', versions['Flipper'], :configuration => 'Debug'
end

# Post Install processing for Flipper
def flipper_post_install(installer)
  installer.pods_project.targets.each do |target|
    if target.name == 'YogaKit'
      target.build_configurations.each do |config|
        config.build_settings['SWIFT_VERSION'] = '4.1'
      end
    end
  end
end

target 'tonsr' do
  # Pods for tonsr
  pod 'FBLazyVector', :path => "../node_modules/react-native/Libraries/FBLazyVector"
  pod 'FBReactNativeSpec', :path => "../node_modules/react-native/Libraries/FBReactNativeSpec"
  pod 'RCTRequired', :path => "../node_modules/react-native/Libraries/RCTRequired"
  pod 'RCTTypeSafety', :path => "../node_modules/react-native/Libraries/TypeSafety"
  pod 'React', :path => '../node_modules/react-native/'
  pod 'React-Core', :path => '../node_modules/react-native/'
  pod 'React-CoreModules', :path => '../node_modules/react-native/React/CoreModules'
  pod 'React-Core/DevSupport', :path => '../node_modules/react-native/'
  pod 'React-RCTActionSheet', :path => '../node_modules/react-native/Libraries/ActionSheetIOS'
  pod 'React-RCTAnimation', :path => '../node_modules/react-native/Libraries/NativeAnimation'
  pod 'React-RCTBlob', :path => '../node_modules/react-native/Libraries/Blob'
  pod 'React-RCTImage', :path => '../node_modules/react-native/Libraries/Image'
  pod 'React-RCTLinking', :path => '../node_modules/react-native/Libraries/LinkingIOS'
  pod 'React-RCTNetwork', :path => '../node_modules/react-native/Libraries/Network'
  pod 'React-RCTSettings', :path => '../node_modules/react-native/Libraries/Settings'
  pod 'React-RCTText', :path => '../node_modules/react-native/Libraries/Text'
  pod 'React-RCTVibration', :path => '../node_modules/react-native/Libraries/Vibration'
  pod 'React-Core/RCTWebSocket', :path => '../node_modules/react-native/'

  pod 'React-cxxreact', :path => '../node_modules/react-native/ReactCommon/cxxreact'
  pod 'React-jsi', :path => '../node_modules/react-native/ReactCommon/jsi'
  pod 'React-jsiexecutor', :path => '../node_modules/react-native/ReactCommon/jsiexecutor'
  pod 'React-jsinspector', :path => '../node_modules/react-native/ReactCommon/jsinspector'
  pod 'ReactCommon/callinvoker', :path => "../node_modules/react-native/ReactCommon"
  pod 'ReactCommon/turbomodule/core', :path => "../node_modules/react-native/ReactCommon"
  pod 'Yoga', :path => '../node_modules/react-native/ReactCommon/yoga', :modular_headers => true

  pod 'DoubleConversion', :podspec => '../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec'
  pod 'glog', :podspec => '../node_modules/react-native/third-party-podspecs/glog.podspec'
  pod 'Folly', :podspec => '../node_modules/react-native/third-party-podspecs/Folly.podspec'

  # pod 'react-native-maps', path: '../node_modules/react-native-maps'
  # pod 'react-native-google-maps', path: '../node_modules/react-native-maps'  # Remove this line if you don't want to support GoogleMaps on iOS
  # pod 'GoogleMaps'  # Remove this line if you don't want to support GoogleMaps on iOS
  # pod 'Google-Maps-iOS-Utils' # Remove this line if you don't want to support GoogleMaps on iOS

  # React Native Maps dependencies
  # https://github.com/react-native-community/react-native-maps/blob/master/docs/installation.md#enabling-google-maps-on-ios-react-native-all-versions
  rn_maps_path = '../node_modules/react-native-maps'
  pod 'react-native-google-maps', :path => rn_maps_path
  pod 'GoogleMaps'
  pod 'Google-Maps-iOS-Utils'

  pod 'react-native-netinfo', :path => '../node_modules/@react-native-community/netinfo'

  pod 'appcenter-core', :path => '../node_modules/appcenter/ios/appcenter-core.podspec'

  target 'tonsrTests' do
    inherit! :complete
    # Pods for testing
  end

  use_native_modules!

  # Enables Flipper.
  #
  # Note that if you have use_frameworks! enabled, Flipper will not work and
  # you should disable these next few lines.
  add_flipper_pods!
  post_install do |installer|
    flipper_post_install(installer)

    # https://developer.apple.com/forums/thread/656509
    # installer.pods_project.targets.each do |target|
    #   target.build_configurations.each do |config|
    #     config.build_settings['ONLY_ACTIVE_ARCH'] = 'YES'
    #   end
    # end
  end
end

target 'tonsr-tvOS' do
  # Pods for tonsr-tvOS

  target 'tonsr-tvOSTests' do
    inherit! :search_paths
    # Pods for testing
  end
end


About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 17
  • Comments: 56

Most upvoted comments

Previous solution is not compatible for both simulator and distribution.

After reading this thread, here is what you need to do:

the issue appears to be Xcode 12’s inclusion of arm64 arch in the iPhone simulator, thus causing a clash between iPhone and Simulator when they are being combined to create the fat library.

Solution (at least until simulator run on arm64 macs, which is not very soon) Select the project or target -> Build Settings -> Excluded Architecture (if you can’t see it make sure [All] properties are selected) and set the Excluded Architecture for ‘Any iOS simulator SDK’ -> ‘arm64’.

Capture d’écran 2020-09-21 à 16 59 51

Temporary Solution 1

Xcode > Build Settings > Architectures > Excluded Architectures > Add “arm64”

Screen Shot 2020-09-18 at 3 37 26 PM

Temporary Solution 2

Add the following to your iOS Podfile.

post_install do |installer_representation|
    installer_representation.pods_project.targets.each do |target|
        target.build_configurations.each do |config|
            config.build_settings['ONLY_ACTIVE_ARCH'] = 'NO'
        end
    end
end

Note: This should NOT be a permanent solution.

The problem is still active in google-maps-ios-utils

For M1 Macs: running Xcode under Rossetta will fix the issue (temporary workaround)

1 - With Xcode closed (Important) Go to finder -> Applications
2 - Right Click on Xcode and select "Get Info"
3 - On the info panel check "Open using Rosetta"
4 - Double Click in the bottom large preview of the info panel.

** This will cause a decrease in speed and performance in Xcode and simulator

still not working in M1 machines.

@salah-ghanim sorry to comment on the closed issue, but google maps just released v6.0 that they claim should work with M1 Macs:

https://cloud.google.com/blog/products/maps-platform/announcing-version-60-maps-and-places-sdks-ios

Is it realistic to expect an update soon?

Here’s an update on the current situation of this issue:

Installing from master isn’t necessary as I’ve released a beta version of react-native-maps on the @beta channel of npm that includes the updated version of the Google Maps SDK, that everyone expected to include a fix for M1 macs.

But for whatever reason, Google has decided not to include the fix in the CocoaPods release of the library (see this). I have no insights as to why this is, but until the M1 fix is released in the CocoaPods version, there’s not much we can do about it.

I suggest that someone who is affected by this opens an issue on Google’s public issue tracker and everyone else affected supports this.

I am also still experiencing this issue😢:

"react": "17.0.2",
"react-native": "0.66.3",
"react-native-maps": "^0.29.4"

Hi there,

Completely agreed with @Shaninnik. We’ve been patient for GoogleMaps to update their SDK for iOS.

Can we reopen this issue and update this dependency to make it accessible to all react-native users ?

Thanks a lot !

@salah-ghanim, I did not mean to be insulting. I have updated my language to help lighten the comment.

My opinion on the matter is as follows: I would expect the parent issue to be cited, but due to the severity of the issue and the increased usage of m1 macs in the last 30 days, and that this issue should remain open until the user has a solution or workaround.

As a user, when I encounter an issue and search it on GitHub or google, and discover a closed issue my initial reaction is

A: the issue is something I did B: the issue was solved C: The issue is unimportant

I don’t think is appropriate to close an issue even when the source of the issue is in an upstream dependency. Unless the team here is absolutely positive, no follow-up changes would be needed in this project once the issue is fixed upstream.

Hello everyone!

I’ve just released a 1.4.0 that should fix the m1/arm build issues reported here. Please check it out 😃

Hello @salah-ghanim, I’m trying to manually install and use the Google Maps SDK XCFramework but I’m running into multiple issues. Can you provide some guidance on how to make react-native-maps use the XCFramework instead of the dependency installed via cocoapods? Thank you!

working solution regarding M1 , iOS simulator and latest version of google maps this is a clear description of the current status and a working solution: https://github.com/googlemaps/google-maps-ios-utils/issues/355#issuecomment-1060959728

TLDR use the 6.0.1-beta as an XCFramework.

  • ether use carthage instead of cocoapods to import google maps
  • manually import the google maps ios utils

any news? I have the same issue!

Which is me, and I believe a lot of people since MacBook Pro 16" with M1 Max is available worldwide 😃

Facing the same problem. @HugoGresse’s solution dosen’t work for me on Apple M1. I got new errors about

17 errors 

ld: warning: ignoring file Build/Products/Debug-iphonesimulator/libCordova.a, building for iOS Simulator-x86_64 but attempting to link with file built for iOS Simulator-arm64
...
Undefined symbol: _CDV...
Undefined symbol: _OBJC...

Linked post:

@HugoGresse I followed your steps but these errors happened. スクリーンショット 2020-09-23 19 35 32

My issue was solved by doing these step (temporary work around) :

  1. install Rosseta using the terminal softwareupdate --install-rosetta
  2. Go to Applications -> Right Click Xcode -> Select “Get Info” -> check the “Open using rosseta”
  3. Open Xcode then clean and build the app via Xcode

Note : i was using "react-native-maps": "^0.31.0-beta.5"

@tolik85 can you please check against master now ? the latest Google Maps SDK for iOS (6.0.1) I can’t find a release note for that version but I imagine the issue is fixed

Does this mean that any project that uses Google Maps is unable to run on a simulator?

@jwaldrip seems obvious to me that @salah-ghanim clearly cares about the community as he spends his time helping maintain this package for the rest of us. There’s a clear temporary workaround for the time being here in this thread and if a maintainer thinks it’s more correct to close out issues with no actionable items on their end for whatever reason they have then I think it’s pretty wild to call them ignorant.

Their README clearly states they are looking for more help maintaining this package. If you want to manage issues here how you see best I suggest you offer to help out.

Thanks @HugoGresse ! Your solution worked perfectly for my app.

This started for me after upgrading to xcode 12