am15h / tflite_flutter_plugin

TensorFlow Lite Flutter Plugin
https://pub.dev/packages/tflite_flutter
Apache License 2.0
508 stars 353 forks source link

Cant run app on IOS #18

Closed IliaKhuzhakhmetovRoonyx closed 3 years ago

IliaKhuzhakhmetovRoonyx commented 4 years ago

When i build the project i got this message:

 ld: warning: Could not find or use auto-linked library 'swiftSwiftOnoneSupport'
               ld: warning: Could not find or use auto-linked library 'swiftCoreFoundation'
               ld: warning: Could not find or use auto-linked library 'swiftCompatibility50'
               ld: warning: Could not find or use auto-linked library 'swiftObjectiveC'
               ld: warning: Could not find or use auto-linked library 'swiftUIKit'
               ld: warning: Could not find or use auto-linked library 'swiftDarwin'
               ld: warning: Could not find or use auto-linked library 'swiftQuartzCore'
               ld: warning: Could not find or use auto-linked library 'swiftCore'
               ld: warning: Could not find or use auto-linked library 'swiftCoreGraphics'
               ld: warning: Could not find or use auto-linked library 'swiftFoundation'
               ld: warning: Could not find or use auto-linked library 'swiftCoreImage'
               ld: warning: Could not find or use auto-linked library 'swiftCompatibilityDynamicReplacements'
               ld: warning: Could not find or use auto-linked library 'swiftMetal'
               ld: warning: Could not find or use auto-linked library 'swiftDispatch'
               ld: warning: Could not find or use auto-linked library 'swiftCoreMedia'
               ld: warning: Could not find or use auto-linked library 'swiftCoreAudio'
               Undefined symbols for architecture arm64:
                 "value witness table for Builtin.UnknownObject", referenced from:
                     full type metadata for tflite_flutter.SwiftTfliteFlutter in libtflite_flutter.a(SwiftTfliteFlutter.o)
                 "__swift_FORCE_LOAD_$_swiftCompatibilityDynamicReplacements", referenced from:
                     __swift_FORCE_LOAD_$_swiftCompatibilityDynamicReplacements_$_tflite_flutter in libtflite_flutter.a(SwiftTfliteFlutter.o)
                    (maybe you meant: __swift_FORCE_LOAD_$_swiftCompatibilityDynamicReplacements_$_tflite_flutter)
                 "_swift_allocObject", referenced from:
                     @objc tflite_flutter.SwiftTfliteFlutter.handle(_: __C.FlutterMethodCall, result: (Any?) -> ()) -> () in libtflite_flutter.a(SwiftTfliteFlutter.o)
                 "static (extension in Foundation):Swift.String._unconditionallyBridgeFromObjectiveC(__C.NSString?) -> Swift.String", referenced from:
                     tflite_flutter.SwiftTfliteFlutter.handle(_: __C.FlutterMethodCall, result: (Any?) -> ()) -> () in libtflite_flutter.a(SwiftTfliteFlutter.o)
                 "_swift_unknownObjectRelease", referenced from:
                     static tflite_flutter.SwiftTfliteFlutter.register(with: __C.FlutterPluginRegistrar) -> () in libtflite_flutter.a(SwiftTfliteFlutter.o)
                     @nonobjc __C.FlutterMethodChannel.__allocating_init(name: Swift.String, binaryMessenger: __C.FlutterBinaryMessenger) -> __C.FlutterMethodChannel in libtflite_flutter.a(SwiftTfliteFlutter.o)
                     @objc static tflite_flutter.SwiftTfliteFlutter.register(with: __C.FlutterPluginRegistrar) -> () in libtflite_flutter.a(SwiftTfliteFlutter.o)
                     reabstraction thunk helper from @escaping @callee_unowned @convention(block) (@unowned Swift.AnyObject?) -> () to @escaping @callee_guaranteed (@in_guaranteed Any?) -> () in libtflite_flutter.a(SwiftTfliteFlutter.o)
                 "_swift_release", referenced from:
                     tflite_flutter.SwiftTfliteFlutter.handle(_: __C.FlutterMethodCall, result: (Any?) -> ()) -> () in libtflite_flutter.a(SwiftTfliteFlutter.o)
                     ___swift_destroy_boxed_opaque_existential_0 in libtflite_flutter.a(SwiftTfliteFlutter.o)
                     @objc tflite_flutter.SwiftTfliteFlutter.handle(_: __C.FlutterMethodCall, result: (Any?) -> ()) -> () in libtflite_flutter.a(SwiftTfliteFlutter.o)
                 "_swift_deallocObject", referenced from:
                     l_objectdestroy in libtflite_flutter.a(SwiftTfliteFlutter.o)
                 "_swift_retain", referenced from:
                     tflite_flutter.SwiftTfliteFlutter.handle(_: __C.FlutterMethodCall, result: (Any?) -> ()) -> () in libtflite_flutter.a(SwiftTfliteFlutter.o)
                 "_swift_unknownObjectRetain", referenced from:
                     @objc static tflite_flutter.SwiftTfliteFlutter.register(with: __C.FlutterPluginRegistrar) -> () in libtflite_flutter.a(SwiftTfliteFlutter.o)
                 "Swift._bridgeAnythingToObjectiveC<A>(A) -> Swift.AnyObject", referenced from:
                     reabstraction thunk helper from @escaping @callee_unowned @convention(block) (@unowned Swift.AnyObject?) -> () to @escaping @callee_guaranteed (@in_guaranteed Any?) -> () in libtflite_flutter.a(SwiftTfliteFlutter.o)
                 "(extension in Foundation):Swift.String._bridgeToObjectiveC() -> __C.NSString", referenced from:
                     @nonobjc __C.FlutterMethodChannel.__allocating_init(name: Swift.String, binaryMessenger: __C.FlutterBinaryMessenger) -> __C.FlutterMethodChannel in libtflite_flutter.a(SwiftTfliteFlutter.o)
                 "_swift_getObjCClassFromMetadata", referenced from:
                     @nonobjc __C.FlutterMethodChannel.__allocating_init(name: Swift.String, binaryMessenger: __C.FlutterBinaryMessenger) -> __C.FlutterMethodChannel in libtflite_flutter.a(SwiftTfliteFlutter.o)
                 "static Swift.String.+ infix(Swift.String, Swift.String) -> Swift.String", referenced from:
                     tflite_flutter.SwiftTfliteFlutter.handle(_: __C.FlutterMethodCall, result: (Any?) -> ()) -> () in libtflite_flutter.a(SwiftTfliteFlutter.o)
                 "type metadata for Swift.String", referenced from:
                     tflite_flutter.SwiftTfliteFlutter.handle(_: __C.FlutterMethodCall, result: (Any?) -> ()) -> () in libtflite_flutter.a(SwiftTfliteFlutter.o)
                 "__swift_FORCE_LOAD_$_swiftCompatibility50", referenced from:
                     __swift_FORCE_LOAD_$_swiftCompatibility50_$_tflite_flutter in libtflite_flutter.a(SwiftTfliteFlutter.o)
                    (maybe you meant: __swift_FORCE_LOAD_$_swiftCompatibility50_$_tflite_flutter)
                 "_swift_bridgeObjectRelease", referenced from:
                     @nonobjc __C.FlutterMethodChannel.__allocating_init(name: Swift.String, binaryMessenger: __C.FlutterBinaryMessenger) -> __C.FlutterMethodChannel in libtflite_flutter.a(SwiftTfliteFlutter.o)
                     tflite_flutter.SwiftTfliteFlutter.handle(_: __C.FlutterMethodCall, result: (Any?) -> ()) -> () in libtflite_flutter.a(SwiftTfliteFlutter.o)
                 "_swift_getObjCClassMetadata", referenced from:
                     type metadata accessor for __C.FlutterMethodChannel in libtflite_flutter.a(SwiftTfliteFlutter.o)
                     @objc static tflite_flutter.SwiftTfliteFlutter.register(with: __C.FlutterPluginRegistrar) -> () in libtflite_flutter.a(SwiftTfliteFlutter.o)
                 "_swift_getInitializedObjCClass", referenced from:
                     type metadata accessor for __C.FlutterMethodChannel in libtflite_flutter.a(SwiftTfliteFlutter.o)
                     type metadata accessor for tflite_flutter.SwiftTfliteFlutter in libtflite_flutter.a(SwiftTfliteFlutter.o)
                     tflite_flutter.SwiftTfliteFlutter.handle(_: __C.FlutterMethodCall, result: (Any?) -> ()) -> () in libtflite_flutter.a(SwiftTfliteFlutter.o)
                 "Swift.String.init(_builtinStringLiteral: Builtin.RawPointer, utf8CodeUnitCount: Builtin.Word, isASCII: Builtin.Int1) -> Swift.String", referenced from:
                     static tflite_flutter.SwiftTfliteFlutter.register(with: __C.FlutterPluginRegistrar) -> () in libtflite_flutter.a(SwiftTfliteFlutter.o)
                     tflite_flutter.SwiftTfliteFlutter.handle(_: __C.FlutterMethodCall, result: (Any?) -> ()) -> () in libtflite_flutter.a(SwiftTfliteFlutter.o)
               ld: symbol(s) not found for architecture arm64
am15h commented 4 years ago

Hi @IliaKhuzhakhmetovRoonyx, please share the output of flutter doctor. Also, can you please try to run it on an iOS simulator and share the log.

fgadea commented 4 years ago

Hi, same problem here, I can't compile for iOS:

Running pod install...
Running Xcode build...
Xcode build done.                                           28.1s
Failed to build iOS app
Error output from Xcode build:
↳
    ** BUILD FAILED **

Xcode's output:
↳
    ld: warning: Could not find or use auto-linked library 'swiftCoreGraphics'
    ld: warning: Could not find or use auto-linked library 'swiftDarwin'
    ld: warning: Could not find or use auto-linked library 'swiftUIKit'
    ld: warning: Could not find or use auto-linked library 'swiftFoundation'
    ld: warning: Could not find or use auto-linked library 'swiftMetal'
    ld: warning: Could not find or use auto-linked library 'swiftObjectiveC'
    ld: warning: Could not find or use auto-linked library 'swiftCoreFoundation'
    ld: warning: Could not find or use auto-linked library 'swiftCompatibility50'
    ld: warning: Could not find or use auto-linked library 'swiftCoreImage'
    ld: warning: Could not find or use auto-linked library 'swiftCompatibilityDynamicReplacements'
    ld: warning: Could not find or use auto-linked library 'swiftDispatch'
    ld: warning: Could not find or use auto-linked library 'swiftCoreMedia'
    ld: warning: Could not find or use auto-linked library 'swiftQuartzCore'
    ld: warning: Could not find or use auto-linked library 'swiftCore'
    ld: warning: Could not find or use auto-linked library 'swiftCoreAudio'
    ld: warning: Could not find or use auto-linked library 'swiftSwiftOnoneSupport'
    Undefined symbols for architecture arm64:
      "value witness table for Builtin.UnknownObject", referenced from:
          full type metadata for tflite_flutter.SwiftTfliteFlutter in libtflite_flutter.a(SwiftTfliteFlutter.o)
      "__swift_FORCE_LOAD_$_swiftCompatibilityDynamicReplacements", referenced from:
          __swift_FORCE_LOAD_$_swiftCompatibilityDynamicReplacements_$_tflite_flutter in libtflite_flutter.a(SwiftTfliteFlutter.o)
         (maybe you meant: __swift_FORCE_LOAD_$_swiftCompatibilityDynamicReplacements_$_tflite_flutter)
      "_swift_allocObject", referenced from:
          @objc tflite_flutter.SwiftTfliteFlutter.handle(_: __C.FlutterMethodCall, result: (Any?) -> ()) -> () in libtflite_flutter.a(SwiftTfliteFlutter.o)
      "static (extension in Foundation):Swift.String._unconditionallyBridgeFromObjectiveC(__C.NSString?) -> Swift.String", referenced from:
          tflite_flutter.SwiftTfliteFlutter.handle(_: __C.FlutterMethodCall, result: (Any?) -> ()) -> () in libtflite_flutter.a(SwiftTfliteFlutter.o)
      "_swift_unknownObjectRelease", referenced from:
          static tflite_flutter.SwiftTfliteFlutter.register(with: __C.FlutterPluginRegistrar) -> () in libtflite_flutter.a(SwiftTfliteFlutter.o)
          @nonobjc __C.FlutterMethodChannel.__allocating_init(name: Swift.String, binaryMessenger: __C.FlutterBinaryMessenger) -> __C.FlutterMethodChannel in libtflite_flutter.a(SwiftTfliteFlutter.o)
          @objc static tflite_flutter.SwiftTfliteFlutter.register(with: __C.FlutterPluginRegistrar) -> () in libtflite_flutter.a(SwiftTfliteFlutter.o)
          reabstraction thunk helper from @escaping @callee_unowned @convention(block) (@unowned Swift.AnyObject?) -> () to @escaping @callee_guaranteed (@in_guaranteed Any?) -> () in libtflite_flutter.a(SwiftTfliteFlutter.o)
      "_swift_release", referenced from:
          tflite_flutter.SwiftTfliteFlutter.handle(_: __C.FlutterMethodCall, result: (Any?) -> ()) -> () in libtflite_flutter.a(SwiftTfliteFlutter.o)
          ___swift_destroy_boxed_opaque_existential_0 in libtflite_flutter.a(SwiftTfliteFlutter.o)
          @objc tflite_flutter.SwiftTfliteFlutter.handle(_: __C.FlutterMethodCall, result: (Any?) -> ()) -> () in libtflite_flutter.a(SwiftTfliteFlutter.o)
      "_swift_deallocObject", referenced from:
          l_objectdestroy in libtflite_flutter.a(SwiftTfliteFlutter.o)
      "_swift_retain", referenced from:
          tflite_flutter.SwiftTfliteFlutter.handle(_: __C.FlutterMethodCall, result: (Any?) -> ()) -> () in libtflite_flutter.a(SwiftTfliteFlutter.o)
      "_swift_unknownObjectRetain", referenced from:
          @objc static tflite_flutter.SwiftTfliteFlutter.register(with: __C.FlutterPluginRegistrar) -> () in libtflite_flutter.a(SwiftTfliteFlutter.o)
      "Swift._bridgeAnythingToObjectiveC<A>(A) -> Swift.AnyObject", referenced from:
          reabstraction thunk helper from @escaping @callee_unowned @convention(block) (@unowned Swift.AnyObject?) -> () to @escaping @callee_guaranteed (@in_guaranteed Any?) -> () in libtflite_flutter.a(SwiftTfliteFlutter.o)
      "(extension in Foundation):Swift.String._bridgeToObjectiveC() -> __C.NSString", referenced from:
          @nonobjc __C.FlutterMethodChannel.__allocating_init(name: Swift.String, binaryMessenger: __C.FlutterBinaryMessenger) -> __C.FlutterMethodChannel in libtflite_flutter.a(SwiftTfliteFlutter.o)
      "_swift_getObjCClassFromMetadata", referenced from:
          @nonobjc __C.FlutterMethodChannel.__allocating_init(name: Swift.String, binaryMessenger: __C.FlutterBinaryMessenger) -> __C.FlutterMethodChannel in libtflite_flutter.a(SwiftTfliteFlutter.o)
      "static Swift.String.+ infix(Swift.String, Swift.String) -> Swift.String", referenced from:
          tflite_flutter.SwiftTfliteFlutter.handle(_: __C.FlutterMethodCall, result: (Any?) -> ()) -> () in libtflite_flutter.a(SwiftTfliteFlutter.o)
      "type metadata for Swift.String", referenced from:
          tflite_flutter.SwiftTfliteFlutter.handle(_: __C.FlutterMethodCall, result: (Any?) -> ()) -> () in libtflite_flutter.a(SwiftTfliteFlutter.o)
      "__swift_FORCE_LOAD_$_swiftCompatibility50", referenced from:
          __swift_FORCE_LOAD_$_swiftCompatibility50_$_tflite_flutter in libtflite_flutter.a(SwiftTfliteFlutter.o)
         (maybe you meant: __swift_FORCE_LOAD_$_swiftCompatibility50_$_tflite_flutter)
      "_swift_bridgeObjectRelease", referenced from:
          @nonobjc __C.FlutterMethodChannel.__allocating_init(name: Swift.String, binaryMessenger: __C.FlutterBinaryMessenger) -> __C.FlutterMethodChannel in libtflite_flutter.a(SwiftTfliteFlutter.o)
          tflite_flutter.SwiftTfliteFlutter.handle(_: __C.FlutterMethodCall, result: (Any?) -> ()) -> () in libtflite_flutter.a(SwiftTfliteFlutter.o)
      "_swift_getObjCClassMetadata", referenced from:
          type metadata accessor for __C.FlutterMethodChannel in libtflite_flutter.a(SwiftTfliteFlutter.o)
          @objc static tflite_flutter.SwiftTfliteFlutter.register(with: __C.FlutterPluginRegistrar) -> () in libtflite_flutter.a(SwiftTfliteFlutter.o)
      "_swift_getInitializedObjCClass", referenced from:
          type metadata accessor for __C.FlutterMethodChannel in libtflite_flutter.a(SwiftTfliteFlutter.o)
          type metadata accessor for tflite_flutter.SwiftTfliteFlutter in libtflite_flutter.a(SwiftTfliteFlutter.o)
          tflite_flutter.SwiftTfliteFlutter.handle(_: __C.FlutterMethodCall, result: (Any?) -> ()) -> () in libtflite_flutter.a(SwiftTfliteFlutter.o)
      "Swift.String.init(_builtinStringLiteral: Builtin.RawPointer, utf8CodeUnitCount: Builtin.Word, isASCII: Builtin.Int1) -> Swift.String", referenced from:
          static tflite_flutter.SwiftTfliteFlutter.register(with: __C.FlutterPluginRegistrar) -> () in libtflite_flutter.a(SwiftTfliteFlutter.o)
          tflite_flutter.SwiftTfliteFlutter.handle(_: __C.FlutterMethodCall, result: (Any?) -> ()) -> () in libtflite_flutter.a(SwiftTfliteFlutter.o)
    ld: symbol(s) not found for architecture arm64
    clang: error: linker command failed with exit code 1 (use -v to see invocation)
    note: Using new build system
    note: Building targets in parallel
    note: Planning build
    note: Constructing build description

Could not build the precompiled application for the device.

Here is my flutter doctor:

/Users/felipegadeallopis/development/flutter/bin/flutter doctor --verbose
[✓] Flutter (Channel master, 1.21.0-10.0.pre.135, on Mac OS X 10.15.4 19E287, locale en-ES)
    • Flutter version 1.21.0-10.0.pre.135 at /Users/felipegadeallopis/development/flutter
    • Framework revision 654022aecb (5 hours ago), 2020-08-18 03:01:02 +0300
    • Engine revision b9243713a0
    • Dart version 2.10.0 (build 2.10.0-36.0.dev)

[✓] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
    • Android SDK at /Users/felipegadeallopis/Library/Android/sdk
    • Platform android-28, build-tools 28.0.3
    • Java binary at: /Users/felipegadeallopis/Library/Application Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/193.6626763/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6222593)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 11.6)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 11.6, Build version 11E708
    • CocoaPods version 1.8.4

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 4.0)
    • Android Studio at /Users/felipegadeallopis/Library/Application Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/193.6626763/Android Studio.app/Contents
    • Flutter plugin version 48.0.2
    • Dart plugin version 193.7361
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6222593)

[✓] VS Code (version 1.47.2)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.13.2

[✓] Connected device (3 available)
    • iPhone de FELIPE (mobile) • 00008020-001C24D93E08002E • ios            • iOS 13.5.1
    • Web Server (web)          • web-server                • web-javascript • Flutter Tools
    • Chrome (web)              • chrome                    • web-javascript • Google Chrome 84.0.4147.125

• No issues found!

Do you know some solution?

am15h commented 4 years ago

Thanks @fgadea for reporting and attaching logs. I don't have ios setup with me right now, so can't assure a quick resolution. I will try to arrange something and get it resolved. Is it failing on both actual device and simulator?

fgadea commented 4 years ago

Thanks @fgadea for reporting and attaching logs. I don't have ios setup with me right now, so can't assure a quick resolution. I will try to arrange something and get it resolved. Is it failing on both actual device and simulator?

Hi, @am15h, thanks for your reply. Yes, it fails on both devices, the error log is the same on both

am15h commented 4 years ago

Thanks for confirming. I think I now know what the issue is, the TensorFlowLiteC.framework is not being correctly exported and linked when using the package from pub.dev. However, if you clone the TFLite Flutter Plugin and try running Text Classification it will work. Temporarily, If your developmental process is getting blocked I suggest you clone TFLite Flutter Plugin and use path in pubspec.yaml.

Please stay tuned. This will be fixed at priority.

fgadea commented 4 years ago

Thanks for confirming. I think I now know what the issue is, the TensorFlowLiteC.framework is not being correctly exported and linked when using the package from pub.dev. However, if you clone the TFLite Flutter Plugin and try running Text Classification it will work. Temporarily, If your developmental process is getting blocked I suggest you clone TFLite Flutter Plugin and use path in pubspec.yaml.

Please stay tuned. This will be fixed at priority.

Thanks @am15h , this was a solution for now 👍 I hope you solve the problem as soon you can 👍

mselmanyildirim commented 4 years ago

Hi, We are having trouble with building on IOS though succesfully building in Android. I'm not sure if the issue is same, but the output is as follows:

    ld: targeted OS version does not support use of thread local variables in
    _ZNK6tflite13eigen_support12_GLOBAL_N_122EigenThreadPoolWrapper15CurrentTh
    readIdEv for architecture x86_64
    clang: error: linker command failed with exit code 1 (use -v to see
    invocation)
    note: Using new build system
    note: Building targets in parallel
    note: Planning build
    note: Constructing build description

Could not build the application for the simulator.
Error launching application on iPhone SE (2nd generation).
am15h commented 4 years ago

@mselmanyildirim Really sorry, I missed your message. Can you share the flutter doctor -v and can you try workaround suggested here. https://github.com/am15h/tflite_flutter_plugin/issues/18#issuecomment-675654165.

mselmanyildirim commented 4 years ago

@mselmanyildirim Really sorry, I missed your message. Can you share the flutter doctor -v and can you try workaround suggested here. #18 (comment).

No worries @am15h . Aforementioned workaround wasn't enough alone for me. I needed to change IOS deployment target via XCode user interface, from version 8.0 to 11.0. Other packages I used didn't need such an arrangement. I'm not familiar with package design, but maybe this arrangement can be included in the package itself? Side note: We use a CI/CD tool called codemagic, so above arrangements also needed to be done programmatically and included in the project repo. To achieve this, I added the following line to Podfile: platform :ios, '11.0' Also I added following line to both debug.xcconfig and release.xcconfig files: IPHONEOS_DEPLOYMENT_TARGET = 11 It took me much time to figure out these small configurations, so it may be helpful for someone using CI/CD tools. Anyway, thanks for the effort on this package and kind interests @am15h =)

mselmanyildirim commented 4 years ago

Flutter doctor output may be pretty standard in codemagic, so it may not help for debugging, I guess. I can supply if still needed, though.

oscolabs commented 4 years ago

any idea when this will be resolved? I still cannot use it for the same reasons shared above from my predecessors. It would be awesome to upload custom tf models into flutter, if this plug-in can provide that solution...

bazinac commented 4 years ago

Hi, I am using this plugin successfully on iOS14, with no issues. I am on current flutter beta. So there is a way how it can work. Maybe share flutter doctor -v and describe how you build project. Does it build fine without plugin?

oscolabs commented 4 years ago

Hi @bazinac, thank you for your response.

Yeah the build works perfectly fine without tflite_flutter_plugin. It is only when I use the package that I am getting errors: `CocoaPods' output: ↳ Preparing

Analyzing dependencies

Inspecting targets to integrate
  Using `ARCHS` setting to build architectures of target `Pods-Runner`: (``)

Finding Podfile changes
  A tflite_flutter
  - Flutter
  - audioplayers
  - cloud_firestore
  - cloud_firestore_web
  - firebase_auth
  - firebase_auth_web
  - firebase_core
  - firebase_core_web
  - firebase_storage
  - flutter_plugin_android_lifecycle
  - google_sign_in
  - google_sign_in_web
  - image_picker
  - local_auth
  - package_info
  - path_provider
  - path_provider_linux
  - path_provider_macos
  - path_provider_windows
  - shared_preferences
  - shared_preferences_linux
  - shared_preferences_macos
  - shared_preferences_web
  - shared_preferences_windows
  - sqflite

Fetching external sources
-> Fetching podspec for `Flutter` from `Flutter`
-> Fetching podspec for `audioplayers` from `.symlinks/plugins/audioplayers/ios`
-> Fetching podspec for `cloud_firestore` from `.symlinks/plugins/cloud_firestore/ios`
-> Fetching podspec for `cloud_firestore_web` from `.symlinks/plugins/cloud_firestore_web/ios`
-> Fetching podspec for `firebase_auth` from `.symlinks/plugins/firebase_auth/ios`
-> Fetching podspec for `firebase_auth_web` from `.symlinks/plugins/firebase_auth_web/ios`
-> Fetching podspec for `firebase_core` from `.symlinks/plugins/firebase_core/ios`
-> Fetching podspec for `firebase_core_web` from `.symlinks/plugins/firebase_core_web/ios`
-> Fetching podspec for `firebase_storage` from `.symlinks/plugins/firebase_storage/ios`
-> Fetching podspec for `flutter_plugin_android_lifecycle` from `.symlinks/plugins/flutter_plugin_android_lifecycle/ios`
-> Fetching podspec for `google_sign_in` from `.symlinks/plugins/google_sign_in/ios`
-> Fetching podspec for `google_sign_in_web` from `.symlinks/plugins/google_sign_in_web/ios`
-> Fetching podspec for `image_picker` from `.symlinks/plugins/image_picker/ios`
-> Fetching podspec for `local_auth` from `.symlinks/plugins/local_auth/ios`
-> Fetching podspec for `package_info` from `.symlinks/plugins/package_info/ios`
-> Fetching podspec for `path_provider` from `.symlinks/plugins/path_provider/ios`
-> Fetching podspec for `path_provider_linux` from `.symlinks/plugins/path_provider_linux/ios`
-> Fetching podspec for `path_provider_macos` from `.symlinks/plugins/path_provider_macos/ios`
-> Fetching podspec for `path_provider_windows` from `.symlinks/plugins/path_provider_windows/ios`
-> Fetching podspec for `shared_preferences` from `.symlinks/plugins/shared_preferences/ios`
-> Fetching podspec for `shared_preferences_linux` from `.symlinks/plugins/shared_preferences_linux/ios`
-> Fetching podspec for `shared_preferences_macos` from `.symlinks/plugins/shared_preferences_macos/ios`
-> Fetching podspec for `shared_preferences_web` from `.symlinks/plugins/shared_preferences_web/ios`
-> Fetching podspec for `shared_preferences_windows` from `.symlinks/plugins/shared_preferences_windows/ios`
-> Fetching podspec for `sqflite` from `.symlinks/plugins/sqflite/ios`
-> Fetching podspec for `tflite_flutter` from `.symlinks/plugins/tflite_flutter/ios`

Resolving dependencies of `Podfile`
  CDN: trunk Relative path: CocoaPods-version.yml exists! Returning local because checking is only perfomed in repo update
[!] CocoaPods could not find compatible versions for pod "tflite_flutter":
  In Podfile:
    tflite_flutter (from `.symlinks/plugins/tflite_flutter/ios`)

Specs satisfying the `tflite_flutter (from `.symlinks/plugins/tflite_flutter/ios`)` dependency were found, but they required a higher minimum deployment target.

/Library/Ruby/Gems/2.6.0/gems/molinillo-0.6.6/lib/molinillo/resolution.rb:328:in `raise_error_unless_state'
/Library/Ruby/Gems/2.6.0/gems/molinillo-0.6.6/lib/molinillo/resolution.rb:310:in `block in unwind_for_conflict'
/Library/Ruby/Gems/2.6.0/gems/molinillo-0.6.6/lib/molinillo/resolution.rb:308:in `tap'
/Library/Ruby/Gems/2.6.0/gems/molinillo-0.6.6/lib/molinillo/resolution.rb:308:in `unwind_for_conflict'
/Library/Ruby/Gems/2.6.0/gems/molinillo-0.6.6/lib/molinillo/resolution.rb:684:in `attempt_to_activate'
/Library/Ruby/Gems/2.6.0/gems/molinillo-0.6.6/lib/molinillo/resolution.rb:254:in `process_topmost_state'
/Library/Ruby/Gems/2.6.0/gems/molinillo-0.6.6/lib/molinillo/resolution.rb:182:in `resolve'
/Library/Ruby/Gems/2.6.0/gems/molinillo-0.6.6/lib/molinillo/resolver.rb:43:in `resolve'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.3/lib/cocoapods/resolver.rb:94:in `resolve'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.3/lib/cocoapods/installer/analyzer.rb:1065:in `block in resolve_dependencies'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.3/lib/cocoapods/user_interface.rb:64:in `section'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.3/lib/cocoapods/installer/analyzer.rb:1063:in `resolve_dependencies'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.3/lib/cocoapods/installer/analyzer.rb:124:in `analyze'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.3/lib/cocoapods/installer.rb:410:in `analyze'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.3/lib/cocoapods/installer.rb:235:in `block in resolve_dependencies'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.3/lib/cocoapods/user_interface.rb:64:in `section'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.3/lib/cocoapods/installer.rb:234:in `resolve_dependencies'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.3/lib/cocoapods/installer.rb:156:in `install!'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.3/lib/cocoapods/command/install.rb:52:in `run'
/Library/Ruby/Gems/2.6.0/gems/claide-1.0.3/lib/claide/command.rb:334:in `run'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.3/lib/cocoapods/command.rb:52:in `run'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.3/bin/pod:55:in `<top (required)>'
/usr/local/bin/pod:23:in `load'
/usr/local/bin/pod:23:in `<main>'

Error output from CocoaPods: ↳

[!] Automatically assigning platform `iOS` with version `8.0` on target `Runner` because no platform was specified. Please specify a platform for this target in your Podfile. See `https://guides.cocoapods.org/syntax/podfile.html#platform`.

Error running pod install Error launching application on iPhone 11.`

`(base) stephenkim@Stephens-MBP-3 doggo_app-master4 % flutter doctor -v [✓] Flutter (Channel stable, 1.22.1, on Mac OS X 10.15.4 19E287, locale en-US) • Flutter version 1.22.1 at /Users/stephenkim/Developer/flutter • Framework revision f30b7f4db9 (5 days ago), 2020-10-08 10:06:30 -0700 • Engine revision 75bef9f6c8 • Dart version 2.10.1

[!] Android toolchain - develop for Android devices (Android SDK version 29.0.3) • Android SDK at /Users/stephenkim/Library/Android/sdk • Platform android-30, build-tools 29.0.3 • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6222593) ✗ Android license status unknown. Run flutter doctor --android-licenses to accept the SDK licenses. See https://flutter.dev/docs/get-started/install/macos#android-setup for more details.

[✓] Xcode - develop for iOS and macOS (Xcode 12.0.1) • Xcode at /Applications/Xcode.app/Contents/Developer • Xcode 12.0.1, Build version 12A7300 • CocoaPods version 1.9.3

[!] Android Studio (version 4.1) • Android Studio at /Applications/Android Studio.app/Contents ✗ Flutter plugin not installed; this adds Flutter specific functionality. ✗ Dart plugin not installed; this adds Dart specific functionality. • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6222593)

[✓] Connected device (1 available)
• iPhone 11 (mobile) • CB9F5742-F49A-42B3-A5C6-A26EB97E0465 • ios • com.apple.CoreSimulator.SimRuntime.iOS-14-0 (simulator)

! Doctor found issues in 2 categories. `

am15h commented 4 years ago

@oscolabs Please try this https://github.com/am15h/tflite_flutter_plugin/issues/18#issuecomment-698379542

oscolabs commented 4 years ago

@am15h this indeed worked for me. Thank you. @mselmanyildirim you are a lifesaver, sending you good vibes for helping us all fix this issue.

puzzleleaf commented 4 years ago

I have experienced the same issue and I am using it well now. I hope it helps others. (https://github.com/PuzzleLeaf/flutter_tensorflow_lite_us_products_classifier)

As I set and use the contents of PodFile as below, it is working well.

# Uncomment this line to define a global platform for your project
# platform :ios, '9.0'

# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true'

project 'Runner', {
  'Debug' => :debug,
  'Profile' => :release,
  'Release' => :release,
}

def flutter_root
  generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__)
  unless File.exist?(generated_xcode_build_settings_path)
    raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first"
  end

  File.foreach(generated_xcode_build_settings_path) do |line|
    matches = line.match(/FLUTTER_ROOT\=(.*)/)
    return matches[1].strip if matches
  end
  raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get"
end

require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)

flutter_ios_podfile_setup

target 'Runner' do
  use_frameworks!
  use_modular_headers!

  flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
end

post_install do |installer|
  installer.pods_project.targets.each do |target|
    flutter_additional_ios_build_settings(target)
  end
end
MATTYGILO commented 3 years ago

@mselmanyildirim Really sorry, I missed your message. Can you share the flutter doctor -v and can you try workaround suggested here. #18 (comment).

No worries @am15h . Aforementioned workaround wasn't enough alone for me. I needed to change IOS deployment target via XCode user interface, from version 8.0 to 11.0. Other packages I used didn't need such an arrangement. I'm not familiar with package design, but maybe this arrangement can be included in the package itself? Side note: We use a CI/CD tool called codemagic, so above arrangements also needed to be done programmatically and included in the project repo. To achieve this, I added the following line to Podfile: platform :ios, '11.0' Also I added following line to both debug.xcconfig and release.xcconfig files: IPHONEOS_DEPLOYMENT_TARGET = 11 It took me much time to figure out these small configurations, so it may be helpful for someone using CI/CD tools. Anyway, thanks for the effort on this package and kind interests @am15h =)

This doesn't work for me

am15h commented 3 years ago

I am still unable to figure out a stable fix to this issue, due to both inaccessibility of my ios setup and my limited experience with iOS.

Tagging @yyoon to this thread, who was also a contributor to this project and helped with the initial setup for ios last year.

@yyoon it would be very helpful if you can suggest a stable fix for:

  1. Ability to include TensorFlowLiteC.framework externally similar to what is currently being done on Android (placing .so files in the app level directory is possible on android but for iOS, the TensorFlowLiteC.framework had to be included in plugin level directory.. Initially, I missed that binaries should never be published to pub.dev, and I was using path import in CI rather than downloading the package from pub.
  2. Stable fix for removing the version conflict from the Podfile, as mentioned in https://github.com/am15h/tflite_flutter_plugin/issues/18#issuecomment-698379542 and https://github.com/am15h/tflite_flutter_plugin/issues/18#issuecomment-721151247
am15h commented 3 years ago

Currently, the standard way to setup this package on iOS platform is mentioned in readme. This seems to be working fine for all the ios users since past few months.

Closing this issue for now, please feel free to re-open if someone faces any issue with the mentioned setup approach.

dreamflasher commented 3 years ago

@mselmanyildirim How did you make codemagic find TensorFlowLiteC.framework?

mselmanyildirim commented 2 years ago

@mselmanyildirim How did you make codemagic find TensorFlowLiteC.framework?

Sorry for the very late response. I didn't check the page, until I had an issue with building, again 😉
As indicated above, TensorFlowLiteC.framework binary is no more included in the repository. For people who are using codemagic, thus having no option to manually add the prebuilt binary into pub-cache, one option is to make a local copy of the package in your repo, put the binary inside this folder, refer the local package in your pubspec.yaml and commit changes. I admit that this is not the most elegant way. Instead I've prepared a custom script and put it inside the pre-build script section in the codemagic workflow settings. This script is run just before the build stage and it downloads and extracts the TensorFlowLiteC.framework into its place in pub-cache folder. The script I use is as follows:

wget https://github.com/am15h/tflite_flutter_plugin/releases/download/v0.5.0/TensorFlowLiteC.framework.zip
tar -xvf TensorFlowLiteC.framework.zip -C $FLUTTER_ROOT/.pub-cache/hosted/pub.dartlang.org/tflite_flutter-0.9.0/ios/
faisalmushtaq007 commented 1 year ago

I am working on an app and now when i tried to run app on ios it gave me this error. Failed to build iOS app Could not build the precompiled application for the device. Error (Xcode): Framework not found tflite_flutter