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

MLVisionTextModel duplicate symbols with React Native #487

Closed
zsajjad opened this issue Jul 10, 2018 · 8 comments
Closed

MLVisionTextModel duplicate symbols with React Native #487

zsajjad opened this issue Jul 10, 2018 · 8 comments
Assignees

Comments

@zsajjad
Copy link

zsajjad commented Jul 10, 2018

I'm building an app with React Native that I've already "ejected" into its own native app project for iOS. I'm interested in using the new Firebase ML Kit Vision Text Detector for recognizing text in images using the on-device model, and I'm willing to write my own NativeModule wrapper for it (since it's so new, I don't see any existing wrappers in projects like react-native-firebase).

So, I used Cocoapods to bring in the Firebase dependencies, but when I try to compile the new workspace, I get the following linker error:

duplicate symbol __ZN3fLB28FLAGS_nosymbolize_stacktraceE in:
    /Users/zainsajjad/Desktop/development/ios/Pods/GoogleMobileVision/TextDetector/Frameworks/TextDetector.framework/TextDetector(examine_stack_b03c119c7358b452600b1afd20ca186c.o)
    /Users/zainsajjad/Library/Developer/Xcode/DerivedData/app-hfkgohktkkwcwocawuqzpgjzslrk/Build/Products/Debug-iphonesimulator/libReact.a(utilities.o)
duplicate symbol __ZN3fLB26FLAGS_symbolize_stacktraceE in:
    /Users/zainsajjad/Desktop/development/ios/Pods/GoogleMobileVision/TextDetector/Frameworks/TextDetector.framework/TextDetector(examine_stack_b03c119c7358b452600b1afd20ca186c.o)
    /Users/zainsajjad/Library/Developer/Xcode/DerivedData/app-hfkgohktkkwcwocawuqzpgjzslrk/Build/Products/Debug-iphonesimulator/libReact.a(utilities.o)
duplicate symbol __ZN3fLB18FLAGS_nolog_prefixE in:
    /Users/zainsajjad/Desktop/development/ios/Pods/GoogleMobileVision/TextDetector/Frameworks/TextDetector.framework/TextDetector(logging_2072041cb58f7b92d4eb8dae33e75a0d.o)
    /Users/zainsajjad/Library/Developer/Xcode/DerivedData/app-hfkgohktkkwcwocawuqzpgjzslrk/Build/Products/Debug-iphonesimulator/libReact.a(logging.o)
duplicate symbol __ZN3fLB16FLAGS_log_prefixE in:
    /Users/zainsajjad/Desktop/development/ios/Pods/GoogleMobileVision/TextDetector/Frameworks/TextDetector.framework/TextDetector(logging_2072041cb58f7b92d4eb8dae33e75a0d.o)
    /Users/zainsajjad/Library/Developer/Xcode/DerivedData/app-hfkgohktkkwcwocawuqzpgjzslrk/Build/Products/Debug-iphonesimulator/libReact.a(logging.o)
duplicate symbol __ZN3fLI9FLAGS_novE in:
    /Users/zainsajjad/Library/Developer/Xcode/DerivedData/app-hfkgohktkkwcwocawuqzpgjzslrk/Build/Products/Debug-iphonesimulator/libReact.a(vlog_is_on.o)
    /Users/zainsajjad/Desktop/development/ios/Pods/GoogleMobileVision/TextDetector/Frameworks/TextDetector.framework/TextDetector(vlog_is_on_ec23571a5409c45b7e2ca681c18af4cb.o)
duplicate symbol __ZN3fLI7FLAGS_vE in:
    /Users/zainsajjad/Library/Developer/Xcode/DerivedData/app-hfkgohktkkwcwocawuqzpgjzslrk/Build/Products/Debug-iphonesimulator/libReact.a(vlog_is_on.o)
    /Users/zainsajjad/Desktop/development/ios/Pods/GoogleMobileVision/TextDetector/Frameworks/TextDetector.framework/TextDetector(vlog_is_on_ec23571a5409c45b7e2ca681c18af4cb.o)
duplicate symbol __ZN3fLS13FLAGS_vmoduleE in:
    /Users/zainsajjad/Library/Developer/Xcode/DerivedData/app-hfkgohktkkwcwocawuqzpgjzslrk/Build/Products/Debug-iphonesimulator/libReact.a(vlog_is_on.o)
    /Users/zainsajjad/Desktop/development/ios/Pods/GoogleMobileVision/TextDetector/Frameworks/TextDetector.framework/TextDetector(vlog_is_on_ec23571a5409c45b7e2ca681c18af4cb.o)
ld: 7 duplicate symbols for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

This issue appears when I add 'Firebase/MLVisionTextModel' in podspecs.
In case I don't add this as a dependency, it returns an empty array on the images having a good amount of text!

@morganchen12

This comment has been minimized.

@morganchen12 morganchen12 self-assigned this Jul 10, 2018
@morganchen12
Copy link
Contributor

Update: it looks like GMV and React Native have a shared c++ dependency that's causing these symbol collisions. It's unlikely that there are good workarounds for this on your end, so you'll probably have to wait for a Firebase (or RN) fix.

I'll keep this issue updated.

@zsajjad
Copy link
Author

zsajjad commented Jul 11, 2018

I am trying to publish a wrapper for MLKit Vision for React Native. Here is the podspec.

I also tried

  s.dependency     'Firebase/Core'
  s.dependency     'Firebase/MLVision'
  s.dependency     'Firebase/MLVisionTextModel'

My Project's Podfile looks like this:

platform :ios, '11.3'

target 'myApp' do
  rn_path = '../node_modules/react-native'
  rn_maps_path = '../node_modules/react-native-maps'

  # See http://facebook.github.io/react-native/docs/integration-with-existing-apps.html#configuring-cocoapods-dependencies
  pod 'yoga', path: "#{rn_path}/ReactCommon/yoga/yoga.podspec"
  pod 'React', path: rn_path, subspecs: [
    'Core',
    'CxxBridge',
    'DevSupport',
    'RCTActionSheet',
    'RCTAnimation',
    'RCTGeolocation',
    'RCTImage',
    'RCTLinkingIOS',
    'RCTNetwork',
    'RCTSettings',
    'RCTText',
    'RCTVibration',
    'RCTWebSocket',
  ]

  pod 'RNTextDetector', path: '../node_modules/react-native-text-detector/ios'
  pod 'react-native-camera', path: '../node_modules/react-native-camera'
  pod 'lottie-ios', :path => '../node_modules/lottie-ios'
  pod 'lottie-react-native', :path => '../node_modules/lottie-react-native'
  pod 'react-native-maps', path: rn_maps_path
  pod 'react-native-google-maps', path: rn_maps_path 

  # React Native third party dependencies podspecs
  pod 'DoubleConversion', :podspec => "#{rn_path}/third-party-podspecs/DoubleConversion.podspec"
  pod 'glog', :podspec => "#{rn_path}/third-party-podspecs/glog.podspec"
  pod 'Folly', :podspec => "#{rn_path}/third-party-podspecs/Folly.podspec"

  # react-native-maps dependencies
  pod 'GoogleMaps'
  pod 'Google-Maps-iOS-Utils'
end

post_install do |installer|
  installer.pods_project.targets.each do |target|
    if target.name == 'react-native-google-maps'
      target.build_configurations.each do |config|
        config.build_settings['CLANG_ENABLE_MODULES'] = 'No'
      end
    end
    if target.name == "React"
      target.remove_from_project
    end
  end
end

@rmusetti81

This comment has been minimized.

@morganchen12

This comment has been minimized.

@joan-domingo
Copy link

Hi @zsajjad ! I had the exact same issue using react native and I solved enabling the dead code stripping in xcode for debug. You can enable it in Target > Build Settings > search for "Dead code stripping". For now seems to work fine.

@zsajjad
Copy link
Author

zsajjad commented Aug 27, 2018

I made my own package that uses firebase ml vision on android and CoreML+TesseractOCR on ios!

@zsajjad
Copy link
Author

zsajjad commented Sep 22, 2018

@joan-domingo's solution works fine.
For people looking here, you can use react-native-text-detector firebase branch as a wrapper around firebase ML Kit Vision.

@zsajjad zsajjad closed this as completed Sep 22, 2018
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

4 participants