React-native-maps: duplicate symbols for architecture x86_64

Created on 22 Oct 2016  路  52Comments  路  Source: react-native-maps/react-native-maps

After dragging the AirMaps and AirGoogleMaps folders into my xcode project and running react-native run-ios, I get

ld: 175 duplicate symbols for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

** BUILD FAILED **

Full output here: http://pastebin.com/td7gRy9g

Anyone else have this issue or just me?

Most helpful comment

I resolved this issue and succesfully implemented GMaps on IOS simulator by the followings:
(ref.: http://stackoverflow.com/questions/24298144/duplicate-symbols-for-architecture-x86-64)

  1. Open Xcode > Pods > Targets Support Files > Pods-{TARGET-NAME}
    find "OTHER_LDFLAGS" and remove only "-ObjC" in these two files:
    Pods-{TARGET-NAME}.release.xcconfig & Pods-{TARGET-NAME}.debug.xcconfig
  2. Go to project main target > Build Settings > Other Linker Flags:
    Make sure no "-ObjC" is left in the value
  3. I deleted the build/Build folder in ios and run-ios again. It works now.
  4. Also make sure you have enable Google Maps SDK for iOS on Google APIs console (only enabling API key will not success)

Side effects from the link above: the app may become larger as there may be duplicated symbols during compile

Hope can help you.
P.S. Not yet try on real device

All 52 comments

Have you managed to solve this? I also have this issue when trying to run it for adhoc on a device.

I'm running into this too. Were either of you able to resolve it yet?

@palmsey nope it wasn't resolved yet. I'm still waiting for other people who might have encountered this too and resolved. And I've been trying things but to no success.

No, I haven't resolved it. I am just using Apple maps on iOS for now. feelsbadman.jpg

I have resolved it, this is my pod file below

# Uncomment this line to define a global platform for your project
# platform :ios, '9.0'

target 'App' do
  # Uncomment this line if you're using Swift or would like to use dynamic frameworks
  # use_frameworks!

  # Pods for NearBy


  pod 'React', path: '../node_modules/react-native', :subspecs => [
  'Core',
  'RCTActionSheet',
  'RCTGeolocation',
  'RCTImage',
  'RCTLinkingIOS',
  'RCTNetwork',
  'RCTSettings',
  'RCTText',
  'RCTVibration',
  'RCTWebSocket'
  ]

  pod 'GoogleMaps'



end
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'
use_frameworks!


  • First I made sure that react-native link goes on without an error.
  • Do the pod install with the above podfile edited with right project
  • Moved AirGoogleMaps and AirMaps to ios project by dragging.
  • Removed Airmaps.xcodeproj and libairmaps if it exist in Libraries folder and Build Settings respectively.

713

i have the exact same error too, also on xcode 8

ok i successfully installed the whole thing by react-native init a new project. I use option 1, I'm on xCode 8, RN 0.36 and node v7, you have to be very careful with each step.
When you drag the folders
1) make sure that it is "create group" rather than "create folder reference"
2) use the xcworkspace file instead of .xcodeproj.
3) if you want googleMap support then import googleMap.h and add your apikey to your delegate.m file. Screwing one of the steps in option 1 screws up a lot of stuff.
Hope that helps.

Same issue here (175 duplicate symbols, too)

Node 4.5, RN 0.35, xCode 8

Have tried all methods above, not working. Not sure if version matters.

This problem did not exist 5 days ago

@jojonarte

Removing Airmaps.xcodeproj cause missing library during build on my machine.

I resolved this issue and succesfully implemented GMaps on IOS simulator by the followings:
(ref.: http://stackoverflow.com/questions/24298144/duplicate-symbols-for-architecture-x86-64)

  1. Open Xcode > Pods > Targets Support Files > Pods-{TARGET-NAME}
    find "OTHER_LDFLAGS" and remove only "-ObjC" in these two files:
    Pods-{TARGET-NAME}.release.xcconfig & Pods-{TARGET-NAME}.debug.xcconfig
  2. Go to project main target > Build Settings > Other Linker Flags:
    Make sure no "-ObjC" is left in the value
  3. I deleted the build/Build folder in ios and run-ios again. It works now.
  4. Also make sure you have enable Google Maps SDK for iOS on Google APIs console (only enabling API key will not success)

Side effects from the link above: the app may become larger as there may be duplicated symbols during compile

Hope can help you.
P.S. Not yet try on real device

just create a brand new project, i have same error...175 duplicate symbols

update:
I have tried @knkevinlai solution, it works! make sure double check step 2

in my case these duplicate errors were occurring because I have .m files for these objects twice in xcode.
Once because "pod install" has added AirMaps.xcodeproj to my project. And another because the react-native-maps instructions told me to drag the AirMaps files into my project. (https://github.com/airbnb/react-native-maps/blob/master/docs/installation.md)

I'm not sure why the instructions tell you to copy the files over - they're already there!
I resolved it simply by not copying the AirMaps folder into my project.

I got the same error and thanks to @jojonarte this step solved my problem:
Removed Airmaps.xcodeproj and libairmaps if it exist in Libraries folder and Build Settings respectively.

getting the same error here =(,
@hossamghareeb when you say:

Removed Airmaps.xcodeproj and libairmaps if it exist in Libraries folder and Build Settings respectively.

where in the Build Settings?

@arthurnn As far as I remember its in Build Phases not Build Settings under Compile Sources or Link Binary With Libraries

So, now the question is, why the docs say to drag-n-drop the project in xcode, if it will be referenced already on the link binary option.
Should we change the docs to not say to drag-n-drop the project anymore?

I have ld: framework not found React error after @jojonarte steps. What should I do?

I was able to fix this issue by following @hzalaz instructions on this following (https://github.com/auth0/react-native-lock/issues/3).

In summary, the duplication issue because you a linking RCT** Libraries twice, once in your PodFile and again in your SubProjects.

@tonygriv my solution might not anymore be relevant with the latest update as it was way back a few updates ago.

Look at your Podfile, take a note of all the modules declared in there and remove those exact modules in Xcode under Libraries. This helped for react-native: 0.41.2.

Just chiming in, I finally got around the duplicate symbols problem on all build configs (Debug/Release/Archive) with the following steps:

Versions:

  • react-native v42
  • react-native-maps v0.14.0

If you have an existing project, clear out any modifications to your Podfile that you've made while following the install instructions/GH issue comments
Remove any and all AirMaps and/or AirGoogleMaps Libraries/References from your XCode Project / Workspace
Make sure the default React xcodeprojects are listed under your XCode Libraries, as they won't be added to the Podfile (see screenshot 1 below).

Install and link the regular react-native-maps module without using Pods!

npm install --save react-native-maps
react-native-link react-native-maps

At this point you should have the AirMaps.xcodeproj under your Libraries folder in XCode (screenshot 1), and libAirMaps.a and the default React libs are in your Linked Frameworks and Libraries (screenshot 2)

Screenshot 1

Screenshot 2

Now the fun stuff

Drag the AirGoogleMaps folder from node_modules/react-native-maps/lib/ios into the top most level of your Xcode Project, and select add as 'Create Groups' when the popup appears after dropping the folder.

AirGoogleMaps needs the React headers, so add $(SRCROOT)/../node_modules/react-native/React to your Header Search Paths (under Build Settings in Xcode) and make it recursive. Double check the AirMaps path is in there as well (Screenshot 3)

Screenshot 3

Now AirGoogleMaps should be completely linked, the GoogleMaps pod just needs to be installed.

Go to the Podfile, and add pod 'GoogleMaps', and run pod install (Screenshot 4)

Screenshot 4

Now run Run/Build/Archive, and it should all compile without duplicate symbols!

Successfully tested on a real iOS device with a Google Map and custom styles (just to really confirm it was a GMap rendering).

--

Please let me know if this works for anyone else, if it fixes the problem for everyone then I'll make a PR to update the install documentation

@se1exin thanks lot it works.

UPDATE DOCUMENTATION.

Please create PR.

@AshokICreate awesome, glad to hear it was helpful. I'll make a PR for the docs tonight after if finish work.

Weird! For me, @knkevinlai solution worked but not @se1exin 's one.

My podfile:

source 'https://github.com/CocoaPods/Specs.git'

platform :ios, '8.0'

target 'gmp' do
  use_frameworks!

  pod 'Yoga', :path => '../node_modules/react-native/ReactCommon/yoga'

  pod 'React', path: '../node_modules/react-native', :subspecs => [
    'Core',
    'RCTActionSheet',
    'RCTGeolocation',
    'RCTImage',
    'RCTLinkingIOS',
    'RCTNetwork',
    'RCTSettings',
    'RCTText',
    'RCTVibration',
    'RCTWebSocket',
    'BatchedBridge',
    'DevSupport'
  ]
  pod 'GoogleMaps'  # <~~ remove this line if you do not want to support GoogleMaps on iOS

end

I am kind of concern about size increase due to duplicated symbols but since I have been struggling on that for days, I'll keep it that way for now.
Using react-native: 0.45.1 and react-native-maps 0.15.3.

So, basically for me: just delete -Objc flags as described previously.

@se1exin ~It's not working for me on 0.47.1, is that correct?~

Wuuut, I didn't follow the cleanup step because I thought it wasn't needed. But it clearly was, it works now. Thanks, you saved me so much time!

Hey @se1exin!

Thank you so much for your instructions! Do you have to add your Gmaps api key anywhere though? I ran your steps explicitly on a new react native project and it all worked great, but now I'm scratching my head about the API key stuff :)

Thanks again!!

@RWOverdijk @peterp - Sorry for the delayed reply, but I'm glad it has been of help!

@peterp - Yep you need to add your API Key to AppDelegate.m. Checkout step 5 of the GMaps iOS setup guide.

Followed @se1exin guide, but getting the error message about the missing AirGoogleMaps directory :(

If anyone is still having problems I followed this walkthrough and it worked perfectly. Very easy to follow and has step by step instructions. https://medium.com/@kswanie21/react-native-google-map-with-react-native-maps-572e3d3eee14

Try to add code at the very end of Podfile:

post_install do |installer|
  installer.pods_project.targets.each do |target|
    if target.name == "React"
      target.remove_from_project
    end
  end
end

@8of I can also confirm that this works when you have Libraries and Pods together in one React Native project (any project with a similar structure).

For me the issues was related to frameworks. So I was added explicitly google frameworks in frameworks folder. After removing it, error is gone

Yarn clear worked for me

If you came here not for the maps concrete issue but for a general duplicate symbols for architecture x86_64 error, try @nikolakanacki solution, it worked for me after days of following dead ends.

I think that the error may have been produced by executing pod update. In my case it added
pod 'rn-fetch-blob', :path => '../node_modules/rn-fetch-blob' pod 'react-native-image-picker', :path => '../node_modules/react-native-image-picker'
to my Podfile but I had linked them previously when installing for the first time so they were duplicated.

We were running into similar issues and the only thing that worked for us was first unlinking the libraries we previously linked using react-native link <lib>. This has some more information https://sandstorm.de/de/blog/post/react-native-managing-native-dependencies-using-xcode-and-cocoapods.html

i have linker error it says 240 duplicates for x86_64. i have implemented react native maps and several other pods. Here is my podfile:

Uncomment the next line to define a global platform for your project

platform :ios, '9.0'

target 'Routes' do
rn_path = '../node_modules/react-native'
rn_maps_path = '../node_modules/react-native-maps'

# See http://facebook.github.io/react-native/docs/integration-with-existing-apps.html#configuring-cocoapods-dependencies
pod 'yoga', path: "#{rn_path}/ReactCommon/yoga/yoga.podspec"
pod 'React', path: rn_path, subspecs: [
  'Core',
  'CxxBridge',
  'DevSupport',
  'RCTActionSheet',
  'RCTAnimation',
  'RCTGeolocation',
  'RCTImage',
  'RCTLinkingIOS',
  'RCTNetwork',
  'RCTSettings',
  'RCTText',
  'RCTVibration',
  'RCTWebSocket',
]
# React Native third party dependencies podspecs
pod 'DoubleConversion', :podspec => "#{rn_path}/third-party-podspecs/DoubleConversion.podspec"
pod 'glog', :podspec => "#{rn_path}/third-party-podspecs/glog.podspec"
# If you are using React Native <0.54, you will get the following error:
# "The name of the given podspec `GLog` doesn't match the expected one `glog`"
# Use the following line instead:
#pod 'GLog', :podspec => "#{rn_path}/third-party-podspecs/GLog.podspec"
pod 'Folly', :podspec => "#{rn_path}/third-party-podspecs/Folly.podspec"

# react-native-maps dependencies
pod 'react-native-maps', path: rn_maps_path
pod 'Firebase/Core'
pod 'RNVectorIcons', :path => '../node_modules/react-native-vector-icons'
pod 'react-native-google-maps', path: rn_maps_path  # Uncomment this line if you want to support GoogleMaps on iOS
pod 'GoogleMaps'  # Uncomment this line if you want to support GoogleMaps on iOS
pod 'Google-Maps-iOS-Utils' # Uncomment this line if you want to support GoogleMaps on iOS

end

post_install do |installer|
installer.pods_project.targets.each do |target|
if target.name == 'react-native-google-maps'
target.build_configurations.each do |config|
config.build_settings['CLANG_ENABLE_MODULES'] = 'No'
end
end
if target.name == "React"
target.remove_from_project
end
end
end

20190217_150609
screenshot of error is also pasted please help me with this.

@hafizmuhammadshoaib react-native unlink react-native-maps; cd ios; pod install;

@alvelig Thankyou it works like a charm

did this work with react native 0.58 ?
i try to make it work since two days, create a new blank project (with init) and fail with all kind of error.

Did some one have a example project with react 0.58 and maps ?
thank you

i just had to remove libairmaps.a from the search of build phases ;)

i just had to remove libairmaps.a from the search of build phases ;)

It works for me, thanks @mor12

If you first linked using react-native link and then try to use maps with cocoaponds you should make following from @alvelig

@alvelig worked for me as well! Thanks!!!

Try to add code at the very end of Podfile:

post_install do |installer|
  installer.pods_project.targets.each do |target|
    if target.name == "React"
      target.remove_from_project
    end
  end
end

It worked for me, very Thanks

thanks @alvelig

I'm using "react-native-maps": "^0.24.2" which is the latest version on 13 June, 2019
for me, I solved by keeping podfile as simple as possible below

target 'vexere' do
  platform :ios, '9.0'
  # Uncomment the next line if you're using Swift or would like to use dynamic frameworks
  # use_frameworks!

  ...your pod

  pod 'GoogleMaps'  # Remove this line if you don't want to support GoogleMaps on iOS
  pod 'Google-Maps-iOS-Utils'
end

then

react-native unlink react-native-maps
cd ios
pod install

After that it will be another issue
Now, just delete (remove reference) 2 folder: AirMaps + AirGoogleMaps in project root then add again (they're in node_module/react-native-maps/lib/ios)
Then add HAVE_GOOGLE_MAPS=1 like here

This issue is already alive for 3 years. "react-native-maps": "^0.24.2", the same problem.

This issue is already alive for 3 years. "react-native-maps": "^0.24.2", the same problem.

@Luckygirlllll have you followed my solution?
I was able to solve it

Yeah, this helped!
react-native unlink react-native-maps
cd ios
pod install

However, when I will need to make a build for Android I will need to link map again, then unlink for IOS....

In this case you should fully manual linking, no pod, no react-native link

I had a exactly same issues, then I resolved it after I removed all the related Frameworks in project sidebar because it is already linked. It causes a duplicated symbols.

Basically you need to go through your libraries and remove them using the lipo command. Not sure, if this helps but I tried using the steps here https://redflowerinc.com/how-i-solved-the-duplicate-symbols-issue-when-integrating-google-frameworks-sdk-for-ios/

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Hyllesen picture Hyllesen  路  48Comments

AzarouAmine picture AzarouAmine  路  52Comments

henrikra picture henrikra  路  44Comments

thiagoterleski picture thiagoterleski  路  55Comments

vinceyuan picture vinceyuan  路  61Comments