Duplicate symbols in cocoa-pods libraries when building for iOS

1.7k Views Asked by At

Xcode throws the following linker error:

duplicate symbol '_kSessionVariantKey' in:
    /Users/apple/Library/Developer/Xcode/DerivedData/SmallcaseIos-fntvhvlzlxqompcrpbimpmiwsjiq/Build/Products/Debug-iphonesimulator/CleverTap-iOS-SDK/libCleverTap-iOS-SDK.a(CTABTestUtils.o)
    /Users/apple/Library/Developer/Xcode/DerivedData/SmallcaseIos-fntvhvlzlxqompcrpbimpmiwsjiq/Build/Products/Debug-iphonesimulator/Mixpanel/libMixpanel.a(MPABTestDesignerConnection.o)
duplicate symbol '_OBJC_IVAR_$__MPRunLoopThread._waitGroup' in:
    /Users/apple/Library/Developer/Xcode/DerivedData/SmallcaseIos-fntvhvlzlxqompcrpbimpmiwsjiq/Build/Products/Debug-iphonesimulator/CleverTap-iOS-SDK/libCleverTap-iOS-SDK.a(CTWebSocket.o)
    /Users/apple/Library/Developer/Xcode/DerivedData/SmallcaseIos-fntvhvlzlxqompcrpbimpmiwsjiq/Build/Products/Debug-iphonesimulator/Mixpanel/libMixpanel.a(MPWebSocket.o)
duplicate symbol '_OBJC_IVAR_$__MPRunLoopThread._runLoop' in:
    /Users/apple/Library/Developer/Xcode/DerivedData/SmallcaseIos-fntvhvlzlxqompcrpbimpmiwsjiq/Build/Products/Debug-iphonesimulator/CleverTap-iOS-SDK/libCleverTap-iOS-SDK.a(CTWebSocket.o)
    /Users/apple/Library/Developer/Xcode/DerivedData/SmallcaseIos-fntvhvlzlxqompcrpbimpmiwsjiq/Build/Products/Debug-iphonesimulator/Mixpanel/libMixpanel.a(MPWebSocket.o)
duplicate symbol '_OBJC_CLASS_$__MPRunLoopThread' in:
    /Users/apple/Library/Developer/Xcode/DerivedData/SmallcaseIos-fntvhvlzlxqompcrpbimpmiwsjiq/Build/Products/Debug-iphonesimulator/CleverTap-iOS-SDK/libCleverTap-iOS-SDK.a(CTWebSocket.o)
    /Users/apple/Library/Developer/Xcode/DerivedData/SmallcaseIos-fntvhvlzlxqompcrpbimpmiwsjiq/Build/Products/Debug-iphonesimulator/Mixpanel/libMixpanel.a(MPWebSocket.o)
duplicate symbol '_OBJC_METACLASS_$__MPRunLoopThread' in:
    /Users/apple/Library/Developer/Xcode/DerivedData/SmallcaseIos-fntvhvlzlxqompcrpbimpmiwsjiq/Build/Products/Debug-iphonesimulator/CleverTap-iOS-SDK/libCleverTap-iOS-SDK.a(CTWebSocket.o)
    /Users/apple/Library/Developer/Xcode/DerivedData/SmallcaseIos-fntvhvlzlxqompcrpbimpmiwsjiq/Build/Products/Debug-iphonesimulator/Mixpanel/libMixpanel.a(MPWebSocket.o)
ld: 5 duplicate symbols for architecture x86_64

clang: error: linker command failed with exit code 1 (use -v to see invocation)

It seems like there are duplicate symbols in libCleverTap-iOS-SDK.a and libMixpanel.a.

I'm on RN-0.61 and both the libraries are auto linked. The pod-file is using use_modular_headers! because some dependencies need it.

Both the libraries were linked and used to work fine before I put in use_modular_headers!.

I can't seem to figure out what I'm doing wrong.

podfile -

# Uncomment the next line to define a global platform for your project
platform :ios, '10.0'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'

target 'SmallcaseIos' do
  # react pods
  pod 'FBLazyVector', :path => "../node_modules/react-native/Libraries/FBLazyVector"
  pod 'FBReactNativeSpec', :path => "../node_modules/react-native/Libraries/FBReactNativeSpec"
  pod 'RCTRequired', :path => "../node_modules/react-native/Libraries/RCTRequired"
  pod 'RCTTypeSafety', :path => "../node_modules/react-native/Libraries/TypeSafety"
  pod 'React', :path => '../node_modules/react-native/'
  pod 'React-Core', :path => '../node_modules/react-native/'
  pod 'React-CoreModules', :path => '../node_modules/react-native/React/CoreModules'
  pod 'React-Core/DevSupport', :path => '../node_modules/react-native/'
  pod 'React-RCTActionSheet', :path => '../node_modules/react-native/Libraries/ActionSheetIOS'
  pod 'React-RCTAnimation', :path => '../node_modules/react-native/Libraries/NativeAnimation'
  pod 'React-RCTBlob', :path => '../node_modules/react-native/Libraries/Blob'
  pod 'React-RCTImage', :path => '../node_modules/react-native/Libraries/Image'
  pod 'React-RCTLinking', :path => '../node_modules/react-native/Libraries/LinkingIOS'
  pod 'React-RCTNetwork', :path => '../node_modules/react-native/Libraries/Network'
  pod 'React-RCTSettings', :path => '../node_modules/react-native/Libraries/Settings'
  pod 'React-RCTText', :path => '../node_modules/react-native/Libraries/Text'
  pod 'React-RCTVibration', :path => '../node_modules/react-native/Libraries/Vibration'
  pod 'React-Core/RCTWebSocket', :path => '../node_modules/react-native/'

  pod 'React-cxxreact', :path => '../node_modules/react-native/ReactCommon/cxxreact'
  pod 'React-jsi', :path => '../node_modules/react-native/ReactCommon/jsi'
  pod 'React-jsiexecutor', :path => '../node_modules/react-native/ReactCommon/jsiexecutor'
  pod 'React-jsinspector', :path => '../node_modules/react-native/ReactCommon/jsinspector'
  pod 'ReactCommon/jscallinvoker', :path => "../node_modules/react-native/ReactCommon"
  pod 'ReactCommon/turbomodule/core', :path => "../node_modules/react-native/ReactCommon"
  pod 'Yoga', :path => '../node_modules/react-native/ReactCommon/yoga'

  pod 'DoubleConversion', :podspec => '../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec', :modular_headers => false
  pod 'glog', :podspec => '../node_modules/react-native/third-party-podspecs/glog.podspec', :modular_headers => false
  pod 'Folly', :podspec => '../node_modules/react-native/third-party-podspecs/Folly.podspec', :modular_headers => false

  # Pods for SmallcaseIos
  use_modular_headers!
  pod 'SwiftyJSON', '3.1.4'
  pod 'Charts', '3.3.0'
  pod 'Branch', '0.27.1'

  use_native_modules!
end

post_install do |installer|
  installer.pods_project.targets.each do |target|
    target.build_configurations.each do |config|
      config.build_settings['SWIFT_VERSION'] = '5.0'
    end
  end
end
1

There are 1 best solutions below

0
On

it's very simple process go to file => workspace setting => build system and click on that and select it to "Legacy Build System" and press done then clear the build and run again it's work.