Add a flag to fix Flex delegate linking error fix iOS

PiperOrigin-RevId: 343990557
Change-Id: I876dba09ddb675b9e678e8fc9010f4c9a0444953
This commit is contained in:
Thai Nguyen 2020-11-23 22:17:04 -08:00 committed by TensorFlower Gardener
parent 6e10cbf9e2
commit fc72a2069e

View File

@ -142,14 +142,18 @@ alongside the `TensorFlowLiteSwift` or `TensorFlowLiteObjC` CocoaPods.
pod 'TensorFlowLiteSelectTfOps', '~> 0.0.1-nightly' pod 'TensorFlowLiteSelectTfOps', '~> 0.0.1-nightly'
``` ```
After running `pod install`, you need to provide an additional linker flag to After running `pod install`, you need to provide additional linker flags to
force load the select TF ops framework into your project. In your Xcode project, force load the select TF ops framework into your project. In your Xcode project,
go to `Build Settings` -> `Other Linker Flags`, and add: go to `Build Settings` -> `Other Linker Flags`, and add:
```text ```text
-force_load $(SRCROOT)/Pods/TensorFlowLiteSelectTfOps/Frameworks/TensorFlowLiteSelectTfOps.framework/TensorFlowLiteSelectTfOps -force_load $(SRCROOT)/Pods/TensorFlowLiteSelectTfOps/Frameworks/TensorFlowLiteSelectTfOps.framework/TensorFlowLiteSelectTfOps
-u _TF_AcquireFlexDelegate
``` ```
Note that the `-u` flag is only required in the current nightly versions and the
upcoming v2.4.0 release.
You should then be able to run any models converted with the `SELECT_TF_OPS` in You should then be able to run any models converted with the `SELECT_TF_OPS` in
your iOS app. For example, you can modify the your iOS app. For example, you can modify the
[Image Classification iOS app](https://github.com/tensorflow/examples/tree/master/lite/examples/image_classification/ios) [Image Classification iOS app](https://github.com/tensorflow/examples/tree/master/lite/examples/image_classification/ios)
@ -183,13 +187,13 @@ similar steps described under the
[Xcode project settings](./build_ios.md#modify_xcode_project_settings_directly) [Xcode project settings](./build_ios.md#modify_xcode_project_settings_directly)
section in the iOS build guide. section in the iOS build guide.
After adding the framework into your app project, an additional linker flag After adding the framework into your app project, additional linker flags should
should be specified in your app project to force load the select TF ops be specified in your app project to force load the select TF ops framework. In
framework. In your Xcode project, go to `Build Settings` -> `Other Linker your Xcode project, go to `Build Settings` -> `Other Linker Flags`, and add:
Flags`, and add:
```text ```text
-force_load <path/to/your/TensorFlowLiteSelectTfOps.framework/TensorFlowLiteSelectTfOps> -force_load <path/to/your/TensorFlowLiteSelectTfOps.framework/TensorFlowLiteSelectTfOps>
-u _TF_AcquireFlexDelegate
``` ```
### C++ ### C++