You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
iOS Build is failing (duplicate symbols for architecture x86_64) #114
This issue should serve as a starting point for others who have the same problem. I hope I can save you from a lot of headache. Original Issue: Rapsssito/react-native-tcp-socket#61 (comment)
Steps to reproduce
The issue appears if you try to compile a react native project for iOS, which uses rn-nodefiy. To be more specific the cause of the problem seems to come from react-native-tcp and react-native-udp.
It seems that it also does not matter if you use a new M1 Mac or an older Intel based Mac. Also it does not matter if you use npm or yarn
Create a new react native project npx react-native init AwesomeTSProject --template react-native-template-typescript
At this point your iOS version should still build correctly.
Here remove reference to CocoaAsyncSocket (this should be the first entry in the list)
in this case you also need to do the same for react-native-udp
It seems like you need to redo this procedure every time you add new dependencies to your project
Reacted by Tina, Behemoth, Paul Colandrea, Dario, Steve Rodriguez, Seyed Mohammad Asadi, Shashank, Onuwa Nnachi Isaac, billyduong88, damdafayton and 1 more
Go to xcode
into project navigator, click on Pods folder
then select TcpSockets in targets
Go to Build Phases > Compile sources
Here remove reference to CocoaAsyncSocket (this should be the first entry in the list)
in this case you also need to do the same for react-native-udp
this is correct solution.
Reacted by CryptoX, Nicolás Riccardi and Kailash Uniyal
Reacted by Tina, phamhien2102, Kevin Gracia Orejuela and AyshaFidhakp
I just tried to install this package and I do have the same issue.
Here is part of the error logs :
duplicate symbol 'OBJC_IVAR$_GCDAsyncUdpSocket.cachedLocalPort4' in:
/Users/florent/Library/Developer/Xcode/DerivedData/Hermes-dxhzvnkbnyrabocodwsqwfpatpub/Build/Products/Debug-iphonesimulator/CocoaAsyncSocket/libCocoaAsyncSocket.a(GCDAsyncUdpSocket.o)
/Users/florent/Desktop/Bocoloco/git_florent_reactnative/HermesNative/florent_reactnative_hermes/node_modules/react-native-thermal-receipt-printer/ios/PrinterSDK/libPrinterSDK.a(GCDAsyncUdpSocket.o)
duplicate symbol 'OBJC_IVAR$_GCDAsyncUdpSocket.cachedLocalAddress4' in:
/Users/florent/Library/Developer/Xcode/DerivedData/Hermes-dxhzvnkbnyrabocodwsqwfpatpub/Build/Products/Debug-iphonesimulator/CocoaAsyncSocket/libCocoaAsyncSocket.a(GCDAsyncUdpSocket.o)
/Users/florent/Desktop/Bocoloco/git_florent_reactnative/HermesNative/florent_reactnative_hermes/node_modules/react-native-thermal-receipt-printer/ios/PrinterSDK/libPrinterSDK.a(GCDAsyncUdpSocket.o)
duplicate symbol 'OBJC_IVAR$_GCDAsyncUdpSocket.writeStream4' in:
/Users/florent/Library/Developer/Xcode/DerivedData/Hermes-dxhzvnkbnyrabocodwsqwfpatpub/Build/Products/Debug-iphonesimulator/CocoaAsyncSocket/libCocoaAsyncSocket.a(GCDAsyncUdpSocket.o)
/Users/florent/Desktop/Bocoloco/git_florent_reactnative/HermesNative/florent_reactnative_hermes/node_modules/react-native-thermal-receipt-printer/ios/PrinterSDK/libPrinterSDK.a(GCDAsyncUdpSocket.o)
duplicate symbol 'OBJC_IVAR$_GCDAsyncUdpSocket.readStream4' in:
/Users/florent/Library/Developer/Xcode/DerivedData/Hermes-dxhzvnkbnyrabocodwsqwfpatpub/Build/Products/Debug-iphonesimulator/CocoaAsyncSocket/libCocoaAsyncSocket.a(GCDAsyncUdpSocket.o)
/Users/florent/Desktop/Bocoloco/git_florent_reactnative/HermesNative/florent_reactnative_hermes/node_modules/react-native-thermal-receipt-printer/ios/PrinterSDK/libPrinterSDK.a(GCDAsyncUdpSocket.o)
ld: 137 duplicate symbols for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
It seems to have some kind if conflict with the react-native-thermal-receipt-printer module.
When I check on the Pods targe / react-native-tcp-sockets / compile sources , there is nothing like CocoaAsyncSocket, but I can found it in the dependency.
@Florent75 There is a troubleshoot section in the docs about removing Flipper. If you are still having that issue after commenting out all the flipper reference in your Podfile and AppDelegate.m, then you mostly likely still have Flipper in your Pods folder. Run pod deintegrate and pod install.
Go to xcode into project navigator, click on Pods folder then select TcpSockets in targets Go to Build Phases > Compile sources Here remove reference to CocoaAsyncSocket (this should be the first entry in the list) in this case you also need to do the same for react-native-udp
Activity
soring323 commentedon Feb 8, 2022
Credit to @Jiope
Go to xcode
into project navigator, click on Pods folder
then select TcpSockets in targets
Go to Build Phases > Compile sources
Here remove reference to CocoaAsyncSocket (this should be the first entry in the list)
in this case you also need to do the same for react-native-udp
this is correct solution.
Florent75 commentedon Mar 7, 2022
Hi there,
I just tried to install this package and I do have the same issue.
Here is part of the error logs :
duplicate symbol 'OBJC_IVAR$_GCDAsyncUdpSocket.cachedLocalPort4' in:
/Users/florent/Library/Developer/Xcode/DerivedData/Hermes-dxhzvnkbnyrabocodwsqwfpatpub/Build/Products/Debug-iphonesimulator/CocoaAsyncSocket/libCocoaAsyncSocket.a(GCDAsyncUdpSocket.o)
/Users/florent/Desktop/Bocoloco/git_florent_reactnative/HermesNative/florent_reactnative_hermes/node_modules/react-native-thermal-receipt-printer/ios/PrinterSDK/libPrinterSDK.a(GCDAsyncUdpSocket.o)
duplicate symbol 'OBJC_IVAR$_GCDAsyncUdpSocket.cachedLocalAddress4' in:
/Users/florent/Library/Developer/Xcode/DerivedData/Hermes-dxhzvnkbnyrabocodwsqwfpatpub/Build/Products/Debug-iphonesimulator/CocoaAsyncSocket/libCocoaAsyncSocket.a(GCDAsyncUdpSocket.o)
/Users/florent/Desktop/Bocoloco/git_florent_reactnative/HermesNative/florent_reactnative_hermes/node_modules/react-native-thermal-receipt-printer/ios/PrinterSDK/libPrinterSDK.a(GCDAsyncUdpSocket.o)
duplicate symbol 'OBJC_IVAR$_GCDAsyncUdpSocket.writeStream4' in:
/Users/florent/Library/Developer/Xcode/DerivedData/Hermes-dxhzvnkbnyrabocodwsqwfpatpub/Build/Products/Debug-iphonesimulator/CocoaAsyncSocket/libCocoaAsyncSocket.a(GCDAsyncUdpSocket.o)
/Users/florent/Desktop/Bocoloco/git_florent_reactnative/HermesNative/florent_reactnative_hermes/node_modules/react-native-thermal-receipt-printer/ios/PrinterSDK/libPrinterSDK.a(GCDAsyncUdpSocket.o)
duplicate symbol 'OBJC_IVAR$_GCDAsyncUdpSocket.readStream4' in:
/Users/florent/Library/Developer/Xcode/DerivedData/Hermes-dxhzvnkbnyrabocodwsqwfpatpub/Build/Products/Debug-iphonesimulator/CocoaAsyncSocket/libCocoaAsyncSocket.a(GCDAsyncUdpSocket.o)
/Users/florent/Desktop/Bocoloco/git_florent_reactnative/HermesNative/florent_reactnative_hermes/node_modules/react-native-thermal-receipt-printer/ios/PrinterSDK/libPrinterSDK.a(GCDAsyncUdpSocket.o)
ld: 137 duplicate symbols for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
It seems to have some kind if conflict with the react-native-thermal-receipt-printer module.
When I check on the Pods targe / react-native-tcp-sockets / compile sources , there is nothing like CocoaAsyncSocket, but I can found it in the dependency.
Do you have any clues on how o fix it ?
Regards
Rc85 commentedon Sep 7, 2022
@Florent75 There is a troubleshoot section in the docs about removing Flipper. If you are still having that issue after commenting out all the flipper reference in your Podfile and AppDelegate.m, then you mostly likely still have Flipper in your Pods folder. Run pod deintegrate and pod install.
chachaxw commentedon Sep 29, 2022
It works for me, amazing🤩
nriccar commentedon Jul 12, 2023
Any way of doing this promatically from podfile or a patch-package so that we don't have to manually remove CocoaAsyncSocket after each pod install?
Kailash23 commentedon Apr 24, 2024
Facing the same issue
CocoaAsyncSocket compile source keep adding again after pod install