0

I am working in React Native project and I am trying to build the project and I am facing this error now

/Users/XXXX/Library/Developer/Xcode/DerivedData/XXX-cdhqlijyeqlscheswseaiojrllyn/Build/Products/Debug-iphonesimulator/`**TcpSockets**`/libTcpSockets.a(GCDAsyncSocket.o)
ld: 79 duplicate symbols for architecture x86_64

I had like 144 duplicate symbols for architecture x86_64 and my error was something like that.

/Users/XXXX/Library/Developer/Xcode/DerivedData/XXX-cdhqlijyeqlscheswseaiojrllyn/Build/Products/Debug-iphonesimulator/react-native-udp/../..

and when I uninstall react-native-udp the duplicate symbols decreased from 144 to 79

and I tried to delete the TcpSockets but it gets created with the build or install pod

I don't have much knowledge in Xcode so Any clues what's the problem or maybe solution ?

Mohamed Ahmed
  • 259
  • 3
  • 17
  • Does this answer your question? [duplicate symbols for architecture x86\_64 ios React Native](https://stackoverflow.com/questions/48214603/duplicate-symbols-for-architecture-x86-64-ios-react-native) – tomerpacific Apr 19 '21 at 10:42
  • @tomerpacific the libraries folder is empty I auto-linked all libraries that I used I just have error in the `Pods/Products/libPods-ProjectName-ProjectNameTest.a` (in red), and I don't what does that mean – Mohamed Ahmed Apr 19 '21 at 10:55

2 Answers2

5

There was not CocoaAsyncSocket but there was GCDAsyncSocket. Solution:

  1. Go to xcode

  2. into project navigator, click on Pods folder

  3. then select TcpSockets in targets

  4. Go to Build Phases > Compile sources

  5. Here remove reference to CocoaAsyncSocket Or run this command line:

    rm -rf node_modules/react-native-tcp/ios/CocoaAsyncSocket

More detail: https://github.com/Rapsssito/react-native-tcp-socket/issues/61#issuecomment-653881488

Leo N
  • 126
  • 2
  • 5
  • i run your command line but still got 79 duplicate, example: ***dvceggxlntuarreqgqsecyhizzua/Build/Products/Release-iphonesimulator/TcpSockets/libTcpSockets.a(GCDAsyncSocket.o)*** please help – famfamfam May 24 '22 at 15:16
  • In this case, we can remove manually by following the path of source code – Leo N May 25 '22 at 16:04
0

Here: Check your package.json if it has

  • react-native-tcp and react-native-tcp-socket

If yes (mine did) run:

  • npm uninstall react-native-tcp
  • cd ios
  • pod install
  • react-native start