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

Build Failed Swift.ContiguousArray<A.Element> in libCharts.a(ChartUtils.o) #822

Closed
ibrahimyolbir opened this issue Jul 30, 2021 · 1 comment

Comments

@ibrahimyolbir
Copy link

I am using react-native-charts-wrapper npm package in my project and after upgrading react native to 64.2. I changed the Podfile file like this in the upgrade because
from

target 'XXXXX' do
  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/callinvoker', :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', :modular_headers => true
  pod 'DoubleConversion', :podspec => '../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec'
  pod 'glog', :podspec => '../node_modules/react-native/third-party-podspecs/glog.podspec'
  pod 'Folly', :podspec => '../node_modules/react-native/third-party-podspecs/Folly.podspec'
  pod 'BVLinearGradient', :path => '../node_modules/react-native-linear-gradient'
  pod 'RNCharts', :path => '../node_modules/react-native-charts-wrapper'
  
  use_native_modules!

 
  flipper_pods()
  pod 'CodePush', :path => '../node_modules/react-native-code-push'
 
  post_install do |installer|
    flipper_post_install(installer)
    installer.pods_project.targets.each do |target|
      if target.name == "React"
        target.remove_from_project
      end
      if target.name == 'react-native-config'
        phase = target.project.new(Xcodeproj::Project::Object::PBXShellScriptBuildPhase)
        phase.shell_script = "cd ../../"\
                             " && RNC_ROOT=./node_modules/react-native-config/"\
                             " && export SYMROOT=$RNC_ROOT/ios/ReactNativeConfig"\
                             " && export BUILD_DIR=$RNC_ROOT/ios/ReactNativeConfig"\
                             " && ruby $RNC_ROOT/ios/ReactNativeConfig/BuildDotenvConfig.rb ${SRCROOT} ${SRCROOT}"                             
  
        target.build_phases << phase
        target.build_phases.move(phase,0)
      end
    end
    
  end
end

To this;

`require_relative '../node_modules/react-native/scripts/react_native_pods'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'
platform :ios, '10.0'
target 'XXXXX' do
  config = use_native_modules!

  use_react_native!(
    :path => config[:reactNativePath],
    # to enable hermes on iOS, change `false` to `true` and then install pods
    :hermes_enabled => false
  )
 
  # Enables Flipper.
  #
  # Note that if you have use_frameworks! enabled, Flipper will not work and
  # you should disable the next line.
  use_flipper!({'Flipper' => '0.75.1', 'Flipper-Folly' => '2.5.3', 'Flipper-RSocket' => '1.3.1'})
  post_install do |installer|
    react_native_post_install(installer)
  end
end`

then I realized that 'RNcharts' is not installed automatically and added this
pod 'RNCharts', :path => '../node_modules/react-native-charts-wrapper'


I ran react-native-run-ios and it was created without any problems. it crashes when I open the component-screen using the react-native-chart-wrapper package.***

`Undefined symbols for architecture x86_64:
  "Swift._ArrayBuffer._copyContents(initializing: Swift.UnsafeMutableBufferPointer<A>) -> 
(Swift.IndexingIterator<Swift._ArrayBuffer<A>>, Swift.Int)", referenced from:
      generic specialization <serialized, Swift._ArrayBuffer<Swift.Int8>> of 
Swift._copyCollectionToContiguousArray<A where A: Swift.Collection>(A) -> 
Swift.ContiguousArray<A.Element> in libCharts.a(ChartUtils.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)`

Screenshot 2021-07-29 at 14 26 16

Specifications
Version: "react-native-charts-wrapper": "^0.5.7"
Platform: IOS
Subsystem:

❯ react-native info
info Fetching system and libraries information...
(node:55086) Warning: Accessing non-existent property 'padLevels' of module exports inside circular dependency
(Use node --trace-warnings ... to show where the warning was created)
System:
OS: macOS 11.3.1
CPU: (8) x64 Intel(R) Core(TM) i7-6700HQ CPU @ 2.60GHz
Memory: 2.27 GB / 16.00 GB
Shell: 5.8 - /bin/zsh
Binaries:
Node: 16.5.0 - /usr/local/bin/node
Yarn: 1.22.10 - /usr/local/bin/yarn
npm: 7.19.1 - /usr/local/bin/npm
Watchman: 2021.06.07.00 - /usr/local/bin/watchman
Managers:
CocoaPods: 1.10.1 - /Users/ibrahimyolbir/.rvm/gems/ruby-2.7.1/bin/pod
SDKs:
iOS SDK:
Platforms: iOS 14.5, DriverKit 20.4, macOS 11.3, tvOS 14.5, watchOS 7.4
Android SDK:
API Levels: 28, 29, 30
Build Tools: 28.0.3, 29.0.0, 29.0.1, 29.0.2, 29.0.3
System Images: android-27 | Google Play Intel x86 Atom, android-29 | Google APIs Intel x86 Atom, android-29 | Google Play Intel x86 Atom, android-30 | Google Play Intel x86 Atom
Android NDK: Not Found
IDEs:
Android Studio: 4.2 AI-202.7660.26.42.7486908
Xcode: 12.5/12E262 - /usr/bin/xcodebuild
Languages:
Java: 1.8.0_242 - /usr/bin/javac
npmPackages:
@react-native-community/cli: Not Found
react: 17.0.1 => 17.0.1
react-native: 0.64.2 => 0.64.2
react-native-macos: Not Found
npmGlobalPackages:
react-native: Not Found
@ibrahimyolbir
Copy link
Author

This comment was my solution facebook/react-native#31179 (comment)

This requires you to remove both references to "$(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)" from your project.pbxproj file. You need to have a Swift bridging header and also an empty swift file in your target. I had only the bridging header and not an actual Swift file, which used to work fine, but for some reason didn't suffice any more. I explicitly added an empty Swift file, and that fixed all linking issues. It looks like adding that file simply helped set ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES to YES. You could also try setting this directly.

But after that i get another errorrs like

     (maybe you meant: __swift_FORCE_LOAD_$_swiftCompatibility51_$_lottie_react_native, __swift_FORCE_LOAD_$_swiftCompatibility51_$_Charts , __swift_FORCE_LOAD_$_swiftCompatibility51_$_Lottie , __swift_FORCE_LOAD_$_swiftCompatibility51_$_RNCharts , __swift_FORCE_LOAD_$_swiftCompatibility51_$_YogaKit , __swift_FORCE_LOAD_$_swiftCompatibility51_$_SwiftyJSON )
  "__swift_FORCE_LOAD_$_swiftCompatibility50", referenced from:
      __swift_FORCE_LOAD_$_swiftCompatibility50_$_Charts in libCharts.a(AnimatedViewPortJob.o)
      __swift_FORCE_LOAD_$_swiftCompatibility50_$_Charts in libCharts.a(Animator.o)
      __swift_FORCE_LOAD_$_swiftCompatibility50_$_Charts in libCharts.a(AxisBase.o)
      __swift_FORCE_LOAD_$_swiftCompatibility50_$_Charts in libCharts.a(AxisRendererBase.o)
      __swift_FORCE_LOAD_$_swiftCompatibility50_$_Charts in libCharts.a(BarChartDataEntry.o)
      __swift_FORCE_LOAD_$_swiftCompatibility50_$_Charts in libCharts.a(BarChartDataSet.o)
      __swift_FORCE_LOAD_$_swiftCompatibility50_$_Charts in libCharts.a(BarChartRenderer.o)
      ...
     (maybe you meant: __swift_FORCE_LOAD_$_swiftCompatibility50_$_Lottie, __swift_FORCE_LOAD_$_swiftCompatibility50_$_SwiftyJSON , __swift_FORCE_LOAD_$_swiftCompatibility50_$_lottie_react_native , __swift_FORCE_LOAD_$_swiftCompatibility50_$_RNCharts , __swift_FORCE_LOAD_$_swiftCompatibility50_$_YogaKit , __swift_FORCE_LOAD_$_swiftCompatibility50_$_Charts )
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)


Showing All Errors Only
Undefined symbol: __swift_FORCE_LOAD_$_swiftCompatibilityDynamicReplacements

Undefined symbol: __swift_FORCE_LOAD_$_swiftCompatibility51

Undefined symbol: __swift_FORCE_LOAD_$_swiftCompatibility50

and solved by this comment zalando/SwiftMonkey#80 (comment)

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

No branches or pull requests

1 participant