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

duplicate symbols for architecture x86_64 #718

Closed
skylarmb opened this issue Oct 21, 2016 · 51 comments

Comments

@skylarmb
Copy link

commented Oct 21, 2016

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?

@jojonarte

This comment has been minimized.

Copy link

commented Oct 24, 2016

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

@palmsey

This comment has been minimized.

Copy link

commented Oct 25, 2016

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

@jojonarte

This comment has been minimized.

Copy link

commented Oct 26, 2016

@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.

@skylarmb

This comment has been minimized.

Copy link
Author

commented Oct 26, 2016

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

@jojonarte

This comment has been minimized.

Copy link

commented Oct 28, 2016

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

@mersay

This comment has been minimized.

Copy link

commented Oct 30, 2016

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

@mersay

This comment has been minimized.

Copy link

commented Oct 30, 2016

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.
@knkevinlai

This comment has been minimized.

Copy link

commented Oct 31, 2016

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

@knkevinlai

This comment has been minimized.

Copy link

commented Oct 31, 2016

@jojonarte

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

@knkevinlai

This comment has been minimized.

Copy link

commented Nov 1, 2016

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

@warmwater

This comment has been minimized.

Copy link

commented Nov 8, 2016

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

@roocell

This comment has been minimized.

Copy link

commented Nov 29, 2016

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.

@hossamghareeb

This comment has been minimized.

Copy link

commented Dec 5, 2016

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.

@arthurnn

This comment has been minimized.

Copy link

commented Dec 30, 2016

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?

@hossamghareeb

This comment has been minimized.

Copy link

commented Dec 30, 2016

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

@arthurnn

This comment has been minimized.

Copy link

commented Jan 1, 2017

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?

@antonsivogrivov

This comment has been minimized.

Copy link

commented Feb 4, 2017

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

@maxfysho

This comment has been minimized.

Copy link

commented Feb 10, 2017

I was able to fix this issue by following @hzalaz instructions on this following (auth0/react-native-lock#3).

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

@jojonarte

This comment has been minimized.

Copy link

commented Feb 22, 2017

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

@nikolakanacki

This comment has been minimized.

Copy link

commented Feb 24, 2017

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.

@se1exin

This comment has been minimized.

Copy link
Contributor

commented Apr 20, 2017

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

@ashokrse2020

This comment has been minimized.

Copy link

commented Jun 12, 2017

@se1exin thanks lot it works.

UPDATE DOCUMENTATION.

Please create PR.

@se1exin

This comment has been minimized.

Copy link
Contributor

commented Jun 14, 2017

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

se1exin added a commit to se1exin/react-native-maps that referenced this issue Jul 3, 2017
@mmailhos

This comment has been minimized.

Copy link

commented Jul 3, 2017

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.

@RyanMitchellWilson

This comment has been minimized.

Copy link

commented Oct 10, 2017

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

@8of

This comment has been minimized.

Copy link

commented Jan 16, 2018

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
@alexghinea-adswizz

This comment has been minimized.

Copy link

commented Mar 14, 2018

@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).

@sujitpk-perennial

This comment has been minimized.

Copy link

commented Mar 27, 2018

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

@waleedarshad

This comment has been minimized.

Copy link

commented May 9, 2018

Yarn clear worked for me

@cristiam86

This comment has been minimized.

Copy link

commented Aug 15, 2018

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.

@rkuncewicz

This comment has been minimized.

Copy link

commented Aug 30, 2018

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

@hafizmuhammadshoaib

This comment has been minimized.

Copy link

commented Feb 17, 2019

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.

@alvelig

This comment has been minimized.

Copy link
Collaborator

commented Feb 17, 2019

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

@hafizmuhammadshoaib

This comment has been minimized.

Copy link

commented Feb 18, 2019

@alvelig Thankyou it works like a charm

@alainib

This comment has been minimized.

Copy link

commented Mar 11, 2019

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

@mor12

This comment has been minimized.

Copy link

commented Mar 22, 2019

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

@SamilMehdiyev

This comment has been minimized.

Copy link

commented Apr 6, 2019

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

It works for me, thanks @mor12

@andrey-shostik

This comment has been minimized.

Copy link

commented Apr 15, 2019

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

@carlos-cne

This comment has been minimized.

Copy link

commented Apr 17, 2019

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

@YangKunGit

This comment has been minimized.

Copy link

commented Apr 29, 2019

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

@billel-boudchicha

This comment has been minimized.

Copy link

commented May 13, 2019

thanks @alvelig

@datvp09

This comment has been minimized.

Copy link

commented Jun 13, 2019

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

@Luckygirlllll

This comment has been minimized.

Copy link

commented Jul 31, 2019

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

@datvp09

This comment has been minimized.

Copy link

commented Jul 31, 2019

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

@Luckygirlllll

This comment has been minimized.

Copy link

commented Jul 31, 2019

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....

@datvp09

This comment has been minimized.

Copy link

commented Aug 1, 2019

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

@mattdamon108

This comment has been minimized.

Copy link

commented Aug 2, 2019

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
You can’t perform that action at this time.