Reduce TensorFlow Lite binary size(Build custom C/C++ shared libraries on android) For the models with the Select TF ops fail.
@Qinlong275 Please ensure your models are compatible with the Select TF ops feature. Register any custom ops with the selective build system. Make sure to use Bazel to build an AAR file containing the selective TensorFlow Lite library and include the AAR in your Android project. Please let us know if it works?

Thank you! > @Qinlong275 Please ensure your models are compatible with the Select TF ops feature. Register any custom ops with the selective build system. Make sure to use Bazel to build an AAR file containing the selective TensorFlow Lite library and include the AAR in your Android project. Please let us know if it works?
> 
> Thank you!
 I just follw the link https://www.tensorflow.org/lite/guide/reduce_binary_size, want to build the reduce libtensorflowlite_flex.so, use these code:
load(
    "@org_tensorflow//tensorflow/lite/delegates/flex:build_def.bzl",
    "tflite_flex_shared_library"
)

# Shared lib target for convenience, pulls in the standard set of TensorFlow
# ops and kernels. The output library name is platform dependent:
#   - Linux/Android: `libtensorflowlite_flex.so`
#   - Mac: `libtensorflowlite_flex.dylib`
#   - Windows: `libtensorflowlite_flex.dll`
tflite_flex_shared_library(
  name = "tensorflowlite_flex",
  models = [
      ":FRCRN_model.tflite",
  ],
)

bazel build -c opt --cxxopt='--std=c++17' \
      --config=android_arm \
      --config=monolithic \
      --host_crosstool_top=@bazel_tools//tools/cpp:toolchain \
      //tmp:tensorflowlite_flex

And my model is transfer with select op use the link https://www.tensorflow.org/lite/guide/ops_select?hl=zh-cn:
import tensorflow as tf

converter = tf.lite.TFLiteConverter.from_saved_model(saved_model_dir)
converter.target_spec.supported_ops = [
  tf.lite.OpsSet.TFLITE_BUILTINS, # enable TensorFlow Lite ops.
  tf.lite.OpsSet.SELECT_TF_OPS # enable TensorFlow ops.
]
tflite_model = converter.convert()
open("converted_model.tflite", "wb").write(tflite_model)

 Hi @Qinlong275, can you share your /tmp/BUILD file? It's created here as part of the instructions: https://www.tensorflow.org/lite/guide/reduce_binary_size#advanced_usages_build_custom_cc_shared_libraries > 你好@Qinlong275，你能分享你的 /tmp/BUILD 文件吗？它是作为说明的一部分在此处创建的： https: [//www.tensorflow.org/lite/guide/reduce_binary_size#advanced_usages_build_custom_cc_shared_libraries](https://www.tensorflow.org/lite/guide/reduce_binary_size#advanced_usages_build_custom_cc_shared_libraries)
[Uploading tmp.zip…]()

 This issue is stale because it has been open for 7 days with no activity. It will be closed if no further activity occurs. Thank you. This issue was closed because it has been inactive for 7 days since being marked as stale. Please reopen if you'd like to work on this further. Are you satisfied with the resolution of your issue?
<a href="https://docs.google.com/forms/d/e/1FAIpQLSfaP12TRhd9xSxjXZjcZFNXPGk4kc1-qMdv3gc6bEP90vY1ew/viewform?entry.85265664=Yes&entry.2137816233=https://github.com/tensorflow/tensorflow/issues/62692">Yes</a>
<a href="https://docs.google.com/forms/d/e/1FAIpQLSfaP12TRhd9xSxjXZjcZFNXPGk4kc1-qMdv3gc6bEP90vY1ew/viewform?entry.85265664=No&entry.2137816233=https://github.com/tensorflow/tensorflow/issues/62692">No</a>

### Issue type

Bug

### Have you reproduced the bug with TensorFlow Nightly?

No

### Source

source

### TensorFlow version

tflite 2.12.0

### Custom code

Yes

### OS platform and distribution

_No response_

### Mobile device

_No response_

### Python version

_No response_

### Bazel version

6.3.2-homebrew

### GCC/compiler version

_No response_

### CUDA/cuDNN version

_No response_

### GPU model and memory

_No response_

### Current behavior?

I follow the document(https://www.tensorflow.org/lite/guide/reduce_binary_size), want to build the reduce android tensorflowlite_flex so. But occur some error.

Repository rule _tf_http_archive defined at:
  /Users/qinlong/android/tensorflow/third_party/repo.bzl:89:35: in <toplevel>
INFO: Repository boringssl instantiated at:
  /Users/qinlong/android/tensorflow/WORKSPACE:15:14: in <toplevel>
  /Users/qinlong/android/tensorflow/tensorflow/workspace2.bzl:938:21: in workspace
  /Users/qinlong/android/tensorflow/tensorflow/workspace2.bzl:562:20: in _tf_repositories
  /Users/qinlong/android/tensorflow/third_party/repo.bzl:136:21: in tf_http_archive
Repository rule _tf_http_archive defined at:
  /Users/qinlong/android/tensorflow/third_party/repo.bzl:89:35: in <toplevel>
ERROR: /private/var/tmp/_bazel_qinlong/4d0b12327583c8b4e37f0824509a394f/external/llvm-project/llvm/BUILD.bazel:154:11: Illegal ambiguous match on configurable attribute "defines" in @llvm-project//llvm:config:
@llvm-project//llvm:macos_arm64
@bazel_tools//src/conditions:darwin
Multiple matches are not allowed unless one is unambiguously more specialized or they resolve to the same value. See https://bazel.build/reference/be/functions#select.
ERROR: Analysis of target '//tmp:tensorflowlite_flex' failed; build aborted: 
INFO: Elapsed time: 1.323s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (1 packages loaded, 87 targets con\
figured)
    Fetching https://storage.googleapis.com/.../archive/2.1.0.tar.gz
    Fetching https://storage.googleapis.com/...sqlite-amalgamation-3390400.zip
    Fetching https://storage.googleapis.com/.../cython/archive/3.0.0a10.tar.gz
    Fetching https://storage.googleapis.com/.../source/d/dill/dill-0.3.4.zip
    Fetching https://storage.googleapis.com/.../refs/tags/131.1.0.tar.gz
    Fetching https://storage.googleapis.com/.../download/curl-7.85.0.tar.gz
    Fetching https://storage.googleapis.com/...6a0fb8ca9b1bf60c3b283ce8.tar.gz

### Standalone code to reproduce the issue

```shell
bazel build -c opt --cxxopt='--std=c++17' \
      --config=android_arm64 \
      --config=monolithic \
      --host_crosstool_top=@bazel_tools//tools/cpp:toolchain \
      //tmp:tensorflowlite_flex
```


### Relevant log output

_No response_