Skip to content
This repository has been archived by the owner on Jul 18, 2020. It is now read-only.

ld: 221 duplicate symbols for architecture x86_64 #3

Closed
cancan101 opened this issue Nov 13, 2015 · 17 comments
Closed

ld: 221 duplicate symbols for architecture x86_64 #3

cancan101 opened this issue Nov 13, 2015 · 17 comments

Comments

@cancan101
Copy link

Once I have pod install and then open the .xcworkspace. Attempting to run:

duplicate symbol _OBJC_CLASS_$_RCTVirtualImageManager in:
    /Users/alex/Library/Developer/Xcode/DerivedData/qsi-dbkmltjrefgyjbctqvuiubbxvspu/Build/Products/Debug-iphonesimulator/libReact.a(RCTVirtualImageManager.o)
    /Users/alex/Library/Developer/Xcode/DerivedData/qsi-dbkmltjrefgyjbctqvuiubbxvspu/Build/Products/Debug-iphonesimulator/libRCTImage.a(RCTVirtualImageManager.o)
duplicate symbol _OBJC_METACLASS_$_RCTVirtualImageManager in:
    /Users/alex/Library/Developer/Xcode/DerivedData/qsi-dbkmltjrefgyjbctqvuiubbxvspu/Build/Products/Debug-iphonesimulator/libReact.a(RCTVirtualImageManager.o)
    /Users/alex/Library/Developer/Xcode/DerivedData/qsi-dbkmltjrefgyjbctqvuiubbxvspu/Build/Products/Debug-iphonesimulator/libRCTImage.a(RCTVirtualImageManager.o)
duplicate symbol _OBJC_CLASS_$_RCTImageStoreManager in:
    /Users/alex/Library/Developer/Xcode/DerivedData/qsi-dbkmltjrefgyjbctqvuiubbxvspu/Build/Products/Debug-iphonesimulator/libReact.a(RCTImageStoreManager.o)
    /Users/alex/Library/Developer/Xcode/DerivedData/qsi-dbkmltjrefgyjbctqvuiubbxvspu/Build/Products/Debug-iphonesimulator/libRCTImage.a(RCTImageStoreManager.o)
...
duplicate symbol _OBJC_METACLASS_$_RCTWebSocketExecutor in:
    /Users/alex/Library/Developer/Xcode/DerivedData/qsi-dbkmltjrefgyjbctqvuiubbxvspu/Build/Products/Debug-iphonesimulator/libReact.a(RCTWebSocketExecutor.o)
    /Users/alex/Library/Developer/Xcode/DerivedData/qsi-dbkmltjrefgyjbctqvuiubbxvspu/Build/Products/Debug-iphonesimulator/libRCTWebSocket.a(RCTWebSocketExecutor.o)
duplicate symbol _OBJC_IVAR_$_RCTWebSocketExecutor._url in:
    /Users/alex/Library/Developer/Xcode/DerivedData/qsi-dbkmltjrefgyjbctqvuiubbxvspu/Build/Products/Debug-iphonesimulator/libReact.a(RCTWebSocketExecutor.o)
    /Users/alex/Library/Developer/Xcode/DerivedData/qsi-dbkmltjrefgyjbctqvuiubbxvspu/Build/Products/Debug-iphonesimulator/libRCTWebSocket.a(RCTWebSocketExecutor.o)
duplicate symbol _OBJC_IVAR_$_RCTWebSocketExecutor._jsQueue in:
    /Users/alex/Library/Developer/Xcode/DerivedData/qsi-dbkmltjrefgyjbctqvuiubbxvspu/Build/Products/Debug-iphonesimulator/libReact.a(RCTWebSocketExecutor.o)
    /Users/alex/Library/Developer/Xcode/DerivedData/qsi-dbkmltjrefgyjbctqvuiubbxvspu/Build/Products/Debug-iphonesimulator/libRCTWebSocket.a(RCTWebSocketExecutor.o)
duplicate symbol _OBJC_IVAR_$_RCTWebSocketExecutor._socketOpenSemaphore in:
    /Users/alex/Library/Developer/Xcode/DerivedData/qsi-dbkmltjrefgyjbctqvuiubbxvspu/Build/Products/Debug-iphonesimulator/libReact.a(RCTWebSocketExecutor.o)
    /Users/alex/Library/Developer/Xcode/DerivedData/qsi-dbkmltjrefgyjbctqvuiubbxvspu/Build/Products/Debug-iphonesimulator/libRCTWebSocket.a(RCTWebSocketExecutor.o)
ld: 221 duplicate symbols for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
@hzalaz hzalaz closed this as completed Dec 10, 2015
@hzalaz
Copy link
Member

hzalaz commented Dec 10, 2015

This is caused by having two copies of React Native in the Xcode project, one from CocoaPods and another as a subproject. Since Lock will need cocoapods to fetch it's dependencies, the suprojects should be removed, which is everything under Libraries inside Xcode.

@huangkaiw3n
Copy link

@hzalaz thanks, you just solved my problem with a react-native google maps ios project that was installed through CocoaPods. Was stuck on it for hours and hours as the project could build in Debug and Release but throws these errors when attempting to Archive.

@nikolakanacki
Copy link

nikolakanacki commented Feb 24, 2017

How exactly do you fix this tho? Having the same problem with react-native-maps

@nikolakanacki
Copy link

Found it, nevermind. For anybody else having the same issue: Look at your Podfile, take a note of all the modules declared in there and remove those exact modules in Xcode under Libraries.

@richardcalahan
Copy link

@nikolakanacki When I remove these references in Libraries, the duplicate errors go away, but I get runtime errors when building. For example, removing RCTImage results in all images not being able to render (I get red boxes instead).

Any more specifics on how to remove these dupes?

@nikolakanacki
Copy link

nikolakanacki commented Apr 12, 2017

@richardcalahan Just brushed through the relevant codebase where I had this problem: what I ended up doing is removing those dupes from the Podfile instead of the Xcode Libraries (effectively leaving the Libraries group untouched for this fix). Also found a "@note" in the Podfile I've (apparently) left for myself saying that the first solution I posted above "wont build production". Hope this helps.

@nikolakanacki
Copy link

It also just occured to me that "production" (at the time being) may have ment "run from Xcode" vs "run from rn cmdline"

@bitsal
Copy link

bitsal commented May 5, 2017

@nikolakanacki
When I removed

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

from my Podfile 0.11.0 React is installing by pod install

How to deal with it?

@luco
Copy link

luco commented Jun 26, 2017

Anyone getting this error, I manage to fix it by this answer:
react-native-maps/react-native-maps#718 (comment)

@cbartondock
Copy link

@bitsal ditto. Did you ever find a fix?

@bitsal
Copy link

bitsal commented Jul 7, 2017

I just removed React lib and their sublibs from cocoapods and linked them manually.

@cbartondock
Copy link

cbartondock commented Jul 7, 2017

When I do that and run pod install it tries to install React 0.11.0 of all things

(if I run pod install)

Sent from my Google Pixel XL using FastHub

@8of
Copy link

8of 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

@hszeto
Copy link

hszeto commented Jan 26, 2018

@8of thanks!! i've wasted days on this issue... your code seems to help !

@aterribili
Copy link

@8of thanks!! I spent a lot of time trying to fix that. <3

@ashraf-patel
Copy link

@8of Thanks dude!

@robertoclavijob
Copy link

thanks @8of

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests