Selectively build TFLite for IOS failure
Hi @heguanyu Thanks for reporting the issue.

Can you please provide the steps followed along with the toy model to reproduce the issue.

Thanks.
 Hi @pjpratik , please find the toy model attached. 

Reproduce is simple

1. Fetch tensorflow repo
2. Run ./configure and enable iOS while disable all others. 
3. Copy the model into repo's directory
4. bash tensorflow/lite/ios/build_frameworks.sh --input_models=toy_tflite_model_20230308.tflite --target_archs=x86_64,armv7,arm64

And will see the error like 
Starting local Bazel server and connecting to it...
INFO: Options provided by the client:
  Inherited 'common' options: --isatty=1 --terminal_columns=280
INFO: Reading rc options for 'build' from /Users/ghe/projects/tensorflow/.bazelrc:
  Inherited 'common' options: --experimental_repo_remote_exec
INFO: Reading rc options for 'build' from /Users/ghe/projects/tensorflow/.bazelrc:
  'build' options: --define framework_shared_object=true --define tsl_protobuf_header_only=true --define=use_fast_cpp_protos=true --define=allow_oversize_protos=true --spawn_strategy=standalone -c opt --announce_rc --define=grpc_no_ares=true --noincompatible_remove_legacy_whole_archive --enable_platform_specific_config --define=with_xla_support=true --config=short_logs --config=v2 --define=no_aws_support=true --define=no_hdfs_support=true --experimental_cc_shared_library --experimental_link_static_libraries_once=false --incompatible_enforce_config_setting_visibility
INFO: Reading rc options for 'build' from /Users/ghe/projects/tensorflow/.tf_configure.bazelrc:
  'build' options: --action_env PYTHON_BIN_PATH=/Applications/Xcode.app/Contents/Developer/usr/bin/python3 --action_env PYTHON_LIB_PATH=/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/site-packages --python_path=/Applications/Xcode.app/Contents/Developer/usr/bin/python3
INFO: Reading rc options for 'build' from /Users/ghe/projects/tensorflow/.bazelrc:
  'build' options: --deleted_packages=tensorflow/compiler/mlir/tfrt,tensorflow/compiler/mlir/tfrt/benchmarks,tensorflow/compiler/mlir/tfrt/jit/python_binding,tensorflow/compiler/mlir/tfrt/jit/transforms,tensorflow/compiler/mlir/tfrt/python_tests,tensorflow/compiler/mlir/tfrt/tests,tensorflow/compiler/mlir/tfrt/tests/ir,tensorflow/compiler/mlir/tfrt/tests/analysis,tensorflow/compiler/mlir/tfrt/tests/jit,tensorflow/compiler/mlir/tfrt/tests/lhlo_to_tfrt,tensorflow/compiler/mlir/tfrt/tests/lhlo_to_jitrt,tensorflow/compiler/mlir/tfrt/tests/tf_to_corert,tensorflow/compiler/mlir/tfrt/tests/tf_to_tfrt_data,tensorflow/compiler/mlir/tfrt/tests/saved_model,tensorflow/compiler/mlir/tfrt/transforms/lhlo_gpu_to_tfrt_gpu,tensorflow/core/runtime_fallback,tensorflow/core/runtime_fallback/conversion,tensorflow/core/runtime_fallback/kernel,tensorflow/core/runtime_fallback/opdefs,tensorflow/core/runtime_fallback/runtime,tensorflow/core/runtime_fallback/util,tensorflow/core/tfrt/eager,tensorflow/core/tfrt/eager/backends/cpu,tensorflow/core/tfrt/eager/backends/gpu,tensorflow/core/tfrt/eager/core_runtime,tensorflow/core/tfrt/eager/cpp_tests/core_runtime,tensorflow/core/tfrt/gpu,tensorflow/core/tfrt/run_handler_thread_pool,tensorflow/core/tfrt/runtime,tensorflow/core/tfrt/saved_model,tensorflow/core/tfrt/graph_executor,tensorflow/core/tfrt/saved_model/tests,tensorflow/core/tfrt/tpu,tensorflow/core/tfrt/utils
INFO: Found applicable config definition build:short_logs in file /Users/ghe/projects/tensorflow/.bazelrc: --output_filter=DONT_MATCH_ANYTHING
INFO: Found applicable config definition build:v2 in file /Users/ghe/projects/tensorflow/.bazelrc: --define=tf_api_version=2 --action_env=TF2_BEHAVIOR=1
INFO: Found applicable config definition build:ios in file /Users/ghe/projects/tensorflow/.bazelrc: --apple_platform_type=ios --apple_bitcode=embedded --copt=-fembed-bitcode --copt=-Wno-c++11-narrowing --noenable_platform_specific_config --copt=-w --cxxopt=-std=c++17 --host_cxxopt=-std=c++17 --define=with_xla_support=false
WARNING: --verbose_explanations has no effect when --explain=<file> is not enabled
INFO: Analyzed target //tensorflow/lite/ios/tmp:TensorFlowLiteC_framework (138 packages loaded, 7435 targets configured).
INFO: Found 1 target...
ERROR: /Users/xx/projects/tensorflow/tensorflow/lite/ios/tmp/BUILD:4:24: Compiling tensorflow/lite/ios/tmp/custom_c_api_registration_registration.cc failed: undeclared inclusion(s) in rule '//tensorflow/lite/ios/tmp:custom_c_api_create_op_resolver':
this rule is missing dependency declarations for the following files included by 'tensorflow/lite/ios/tmp/custom_c_api_registration_registration.cc':
  'tensorflow/lite/core/shims/builtin_ops_list.inc'
Target //tensorflow/lite/ios/tmp:TensorFlowLiteC_framework failed to build
INFO: Elapsed time: 12.037s, Critical Path: 5.02s
INFO: 15 processes: 11 internal, 4 local.
FAILED: Build did NOT complete successfully

[toy_tflite_model_20230308.tflite.zip](https://github.com/tensorflow/tensorflow/files/10925472/toy_tflite_model_20230308.tflite.zip)
 @heguanyu Thanks for the information

I was able to reproduce this issue on Mac M1 with Bazel 5.3.0. Please find the screenshot below.

<img width="784" alt="Screenshot 2023-03-09 at 4 50 06 PM" src="https://user-images.githubusercontent.com/118897289/224008908-90afea11-2ada-4a54-a707-f5be9288733a.png">

@sachinprasadhs Could you please look into this issue? Thanks. @yishuangP is this a known issue? > @yishuangP is this a known issue?

This is not a known issue. Will take a look. We need to update tensorflow/lite/ios/build_frameworks.sh, it is outdated. In the meantime, can you try building each framework manually? For example,  the c framework https://github.com/tensorflow/tensorflow/blob/master/tensorflow/lite/ios/BUILD.apple#L102, and the selected ops framework:https://github.com/tensorflow/tensorflow/blob/master/tensorflow/lite/ios/BUILD.apple#L153 Hi, update on this, submitting a change to fix this. In the meantime if you wanna build selective build, can you try adding the following snippet here https://github.com/tensorflow/tensorflow/blob/master/tensorflow/lite/ios/build_frameworks.sh#L88:
```
'    deps = ['
'        "//tensorflow/lite/core/shims:builtin_ops_list",'
'    ],'
``` > Hi, update on this, submitting a change to fix this. In the meantime if you wanna build selective build, can you try adding the following snippet here https://github.com/tensorflow/tensorflow/blob/master/tensorflow/lite/ios/build_frameworks.sh#L88:
> 
> ```
> '    deps = ['
> '        "//tensorflow/lite/core/shims:builtin_ops_list",'
> '    ],'
> ```

Hi @yishuangP I tried adding the deps in build_frameworks.sh line 88, and the same build script shows a different error as below:

ghe-mn2:tensorflow ghe:master]$ bash tensorflow/lite/ios/build_frameworks.sh --input_models=toy_tflite_model_20230308.tflite --target_archs=x86_64,armv7,arm64
INFO: Options provided by the client:
  Inherited 'common' options: --isatty=1 --terminal_columns=317
INFO: Reading rc options for 'build' from /Users/ghe/projects/tensorflow/.bazelrc:
  Inherited 'common' options: --experimental_repo_remote_exec
INFO: Reading rc options for 'build' from /Users/ghe/projects/tensorflow/.bazelrc:
  'build' options: --define framework_shared_object=true --define tsl_protobuf_header_only=true --define=use_fast_cpp_protos=true --define=allow_oversize_protos=true --spawn_strategy=standalone -c opt --announce_rc --define=grpc_no_ares=true --noincompatible_remove_legacy_whole_archive --enable_platform_specific_config --define=with_xla_support=true --config=short_logs --config=v2 --define=no_aws_support=true --define=no_hdfs_support=true --experimental_cc_shared_library --experimental_link_static_libraries_once=false --incompatible_enforce_config_setting_visibility
INFO: Reading rc options for 'build' from /Users/ghe/projects/tensorflow/.tf_configure.bazelrc:
  'build' options: --action_env PYTHON_BIN_PATH=/Applications/Xcode.app/Contents/Developer/usr/bin/python3 --action_env PYTHON_LIB_PATH=/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/site-packages --python_path=/Applications/Xcode.app/Contents/Developer/usr/bin/python3
INFO: Reading rc options for 'build' from /Users/ghe/projects/tensorflow/.bazelrc:
  'build' options: --deleted_packages=tensorflow/compiler/mlir/tfrt,tensorflow/compiler/mlir/tfrt/benchmarks,tensorflow/compiler/mlir/tfrt/jit/python_binding,tensorflow/compiler/mlir/tfrt/jit/transforms,tensorflow/compiler/mlir/tfrt/python_tests,tensorflow/compiler/mlir/tfrt/tests,tensorflow/compiler/mlir/tfrt/tests/ir,tensorflow/compiler/mlir/tfrt/tests/analysis,tensorflow/compiler/mlir/tfrt/tests/jit,tensorflow/compiler/mlir/tfrt/tests/lhlo_to_tfrt,tensorflow/compiler/mlir/tfrt/tests/lhlo_to_jitrt,tensorflow/compiler/mlir/tfrt/tests/tf_to_corert,tensorflow/compiler/mlir/tfrt/tests/tf_to_tfrt_data,tensorflow/compiler/mlir/tfrt/tests/saved_model,tensorflow/compiler/mlir/tfrt/transforms/lhlo_gpu_to_tfrt_gpu,tensorflow/core/runtime_fallback,tensorflow/core/runtime_fallback/conversion,tensorflow/core/runtime_fallback/kernel,tensorflow/core/runtime_fallback/opdefs,tensorflow/core/runtime_fallback/runtime,tensorflow/core/runtime_fallback/util,tensorflow/core/tfrt/eager,tensorflow/core/tfrt/eager/backends/cpu,tensorflow/core/tfrt/eager/backends/gpu,tensorflow/core/tfrt/eager/core_runtime,tensorflow/core/tfrt/eager/cpp_tests/core_runtime,tensorflow/core/tfrt/gpu,tensorflow/core/tfrt/run_handler_thread_pool,tensorflow/core/tfrt/runtime,tensorflow/core/tfrt/saved_model,tensorflow/core/tfrt/graph_executor,tensorflow/core/tfrt/saved_model/tests,tensorflow/core/tfrt/tpu,tensorflow/core/tfrt/utils
INFO: Found applicable config definition build:short_logs in file /Users/ghe/projects/tensorflow/.bazelrc: --output_filter=DONT_MATCH_ANYTHING
INFO: Found applicable config definition build:v2 in file /Users/ghe/projects/tensorflow/.bazelrc: --define=tf_api_version=2 --action_env=TF2_BEHAVIOR=1
INFO: Found applicable config definition build:ios in file /Users/ghe/projects/tensorflow/.bazelrc: --apple_platform_type=ios --apple_bitcode=embedded --copt=-fembed-bitcode --copt=-Wno-c++11-narrowing --noenable_platform_specific_config --copt=-w --cxxopt=-std=c++17 --host_cxxopt=-std=c++17 --define=with_xla_support=false
WARNING: Download from https://storage.googleapis.com/mirror.tensorflow.org/github.com/llvm/llvm-project/archive/a2802dd24f62c14ae00d1691bb19a20d130ec68d.tar.gz failed: class java.io.FileNotFoundException GET returned 404 Not Found
WARNING: Download from https://storage.googleapis.com/mirror.tensorflow.org/github.com/tensorflow/runtime/archive/4df50417fbbaec08d3f61c5d837bdb3b3f1915ae.tar.gz failed: class java.io.FileNotFoundException GET returned 404 Not Found
ERROR: Traceback (most recent call last):
	File "/Users/ghe/projects/tensorflow/tensorflow/lite/ios/tmp/BUILD", line 4, column 24, in <toplevel>
		tflite_custom_c_library(
	File "/Users/ghe/projects/tensorflow/tensorflow/lite/build_def.bzl", line 630, column 26, in tflite_custom_c_library
		native.cc_library(
Error in cc_library: cc_library(...) got multiple values for parameter 'deps'
ERROR: Skipping '//tensorflow/lite/ios/tmp:TensorFlowLiteC_framework': no such target '//tensorflow/lite/ios/tmp:TensorFlowLiteC_framework': target 'TensorFlowLiteC_framework' not declared in package 'tensorflow/lite/ios/tmp' defined by /Users/ghe/projects/tensorflow/tensorflow/lite/ios/tmp/BUILD
WARNING: Target pattern parsing failed.
ERROR: no such target '//tensorflow/lite/ios/tmp:TensorFlowLiteC_framework': target 'TensorFlowLiteC_framework' not declared in package 'tensorflow/lite/ios/tmp' defined by /Users/ghe/projects/tensorflow/tensorflow/lite/ios/tmp/BUILD
INFO: Elapsed time: 0.056s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (1 packages loaded) 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/59853">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/59853">No</a>
 Hi Guanyu, my change is merged. Can you try again? I've verified it on my side. Hi @yishuangP I tried updated the repo and run the command again, but seeing the error of missing TensorFlowLiteC_framework

**target 'TensorFlowLiteC_framework' not declared in package 'tensorflow/lite/ios/tmp' defined by /Users/ghe/projects/tensorflow/tensorflow/lite/ios/tmp/BUILD**


```
ghe-mn2:tensorflow ghe:master]$ bash tensorflow/lite/ios/build_frameworks.sh --input_models=toy_tflite_model_20230308.tflite --target_archs=x86_64,armv7,arm64
INFO: Options provided by the client:
  Inherited 'common' options: --isatty=1 --terminal_columns=314
INFO: Reading rc options for 'build' from /Users/ghe/projects/tensorflow/.bazelrc:
  Inherited 'common' options: --experimental_repo_remote_exec
INFO: Reading rc options for 'build' from /Users/ghe/projects/tensorflow/.bazelrc:
  'build' options: --define framework_shared_object=true --define tsl_protobuf_header_only=true --define=use_fast_cpp_protos=true --define=allow_oversize_protos=true --spawn_strategy=standalone -c opt --announce_rc --define=grpc_no_ares=true --noincompatible_remove_legacy_whole_archive --enable_platform_specific_config --define=with_xla_support=true --config=short_logs --config=v2 --define=no_aws_support=true --define=no_hdfs_support=true --experimental_cc_shared_library --experimental_link_static_libraries_once=false --incompatible_enforce_config_setting_visibility
INFO: Reading rc options for 'build' from /Users/ghe/projects/tensorflow/.tf_configure.bazelrc:
  'build' options: --action_env PYTHON_BIN_PATH=/Library/Developer/CommandLineTools/usr/bin/python3 --action_env PYTHON_LIB_PATH= /Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/site-packages --python_path=/Library/Developer/CommandLineTools/usr/bin/python3
INFO: Reading rc options for 'build' from /Users/ghe/projects/tensorflow/.bazelrc:
  'build' options: --deleted_packages=tensorflow/compiler/mlir/tfrt,tensorflow/compiler/mlir/tfrt/benchmarks,tensorflow/compiler/mlir/tfrt/jit/python_binding,tensorflow/compiler/mlir/tfrt/jit/transforms,tensorflow/compiler/mlir/tfrt/python_tests,tensorflow/compiler/mlir/tfrt/tests,tensorflow/compiler/mlir/tfrt/tests/ir,tensorflow/compiler/mlir/tfrt/tests/analysis,tensorflow/compiler/mlir/tfrt/tests/jit,tensorflow/compiler/mlir/tfrt/tests/lhlo_to_tfrt,tensorflow/compiler/mlir/tfrt/tests/lhlo_to_jitrt,tensorflow/compiler/mlir/tfrt/tests/tf_to_corert,tensorflow/compiler/mlir/tfrt/tests/tf_to_tfrt_data,tensorflow/compiler/mlir/tfrt/tests/saved_model,tensorflow/compiler/mlir/tfrt/transforms/lhlo_gpu_to_tfrt_gpu,tensorflow/core/runtime_fallback,tensorflow/core/runtime_fallback/conversion,tensorflow/core/runtime_fallback/kernel,tensorflow/core/runtime_fallback/opdefs,tensorflow/core/runtime_fallback/runtime,tensorflow/core/runtime_fallback/util,tensorflow/core/tfrt/eager,tensorflow/core/tfrt/eager/backends/cpu,tensorflow/core/tfrt/eager/backends/gpu,tensorflow/core/tfrt/eager/core_runtime,tensorflow/core/tfrt/eager/cpp_tests/core_runtime,tensorflow/core/tfrt/gpu,tensorflow/core/tfrt/run_handler_thread_pool,tensorflow/core/tfrt/runtime,tensorflow/core/tfrt/saved_model,tensorflow/core/tfrt/graph_executor,tensorflow/core/tfrt/saved_model/tests,tensorflow/core/tfrt/tpu,tensorflow/core/tfrt/utils
INFO: Found applicable config definition build:short_logs in file /Users/ghe/projects/tensorflow/.bazelrc: --output_filter=DONT_MATCH_ANYTHING
INFO: Found applicable config definition build:v2 in file /Users/ghe/projects/tensorflow/.bazelrc: --define=tf_api_version=2 --action_env=TF2_BEHAVIOR=1
INFO: Found applicable config definition build:ios in file /Users/ghe/projects/tensorflow/.bazelrc: --apple_platform_type=ios --apple_bitcode=embedded --copt=-fembed-bitcode --copt=-Wno-c++11-narrowing --noenable_platform_specific_config --copt=-w --cxxopt=-std=c++17 --host_cxxopt=-std=c++17 --define=with_xla_support=false
ERROR: Traceback (most recent call last):
	File "/Users/ghe/projects/tensorflow/tensorflow/lite/ios/tmp/BUILD", line 4, column 24, in <toplevel>
		tflite_custom_c_library(
	File "/Users/ghe/projects/tensorflow/tensorflow/lite/build_def.bzl", line 630, column 26, in tflite_custom_c_library
		native.cc_library(
Error in cc_library: cc_library(...) got multiple values for parameter 'deps'
ERROR: Skipping '//tensorflow/lite/ios/tmp:TensorFlowLiteC_framework': no such target '//tensorflow/lite/ios/tmp:TensorFlowLiteC_framework': target 'TensorFlowLiteC_framework' not declared in package 'tensorflow/lite/ios/tmp' defined by /Users/ghe/projects/tensorflow/tensorflow/lite/ios/tmp/BUILD
WARNING: Target pattern parsing failed.
ERROR: no such target '//tensorflow/lite/ios/tmp:TensorFlowLiteC_framework': target 'TensorFlowLiteC_framework' not declared in package 'tensorflow/lite/ios/tmp' defined by /Users/ghe/projects/tensorflow/tensorflow/lite/ios/tmp/BUILD
INFO: Elapsed time: 0.082s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (1 packages loaded)
``` That is very weird. The `TensorFlowLiteC_framework` is supposed to be generated by this function https://github.com/tensorflow/tensorflow/blob/7fc287d1aa879420885098e03197f1c5fe09990f/tensorflow/lite/ios/build_frameworks.sh#L80 and writes it to the build file here https://github.com/tensorflow/tensorflow/blob/master/tensorflow/lite/ios/build_frameworks.sh#L110. In this case, can you try creating the BUILD file in the tmp directly manually? You just need to copy the content from build_frameworks.sh Hi @yishuangP ,

I checked the BUILD file in tmp directory, and its content looks identical to the one in shell script, can you check if its contents are correct?

```
load("@build_bazel_rules_apple//apple:ios.bzl", "ios_static_framework")
load("//tensorflow/lite:build_def.bzl", "tflite_custom_c_library")
load("//tensorflow/lite/ios:ios.bzl", "TFL_MINIMUM_OS_VERSION")
tflite_custom_c_library(
    name = "custom_c_api",
    deps = [
        "//tensorflow/lite/core/shims:builtin_ops_list",
    ],
    models=["toy_tflite_model_20230308.tflite",],
)
ios_static_framework(
    name = "TensorFlowLiteC_framework",
    hdrs = [
        "//tensorflow/lite/c:c_api_types.h",
        "//tensorflow/lite/ios:common.h",
        "//tensorflow/lite/ios:c_api.h",
        "//tensorflow/lite/ios:xnnpack_delegate.h",
    ],
    bundle_name = "TensorFlowLiteC",
    minimum_os_version = TFL_MINIMUM_OS_VERSION,
    deps = [
        ":custom_c_api",
        "//tensorflow/lite/delegates/xnnpack:xnnpack_delegate",
    ],
)
``` Yes, can you try building the TensorFlowLiteC_framework and see if it works? I think your model also has flex ops right? So you also need TensorFlowLiteSelectTfOps_frameworkhttps://github.com/tensorflow/tensorflow/blob/db7a2b3b3c01ba2039b8bb0e78b4a4e85b83e672/tensorflow/lite/ios/build_frameworks.sh#L120. 

What confuses me is that why this script doesn't automatically generate the BUILD files for you. It should and I can verify it on my side. Can you try replacing BUILD with BUILD.apple? Hi @heguanyu sorry I just realized you'll need to use `tflite_custom_cc_library` instead of `tflite_custom_c_library`. I'm sending out another PR for review. Hi @yishuangP Thanks for the update! After changing to `tflite_custom_cc_library` in build_frameworks.sh, the above error is gone, but now seeing these errors:

```
ERROR: /Users/ghe/projects/tensorflow/tensorflow/BUILD:1128:21: declared output 'tensorflow/libtensorflow_framework.2.dylib' was not created by genrule. This is probably because the genrule actually didn't create this output, or because the output was a directory and the genrule was run remotely (note that only the contents of declared file outputs are copied from genrules run remotely)
ERROR: /Users/ghe/projects/tensorflow/tensorflow/BUILD:1128:21: Executing genrule //tensorflow:libtensorflow_framework.2.dylib_sym [for host] failed: not all outputs were created or valid
realpath: illegal option -- -
usage: realpath [-q] [path ...]
Target //tensorflow/lite/ios/tmp:TensorFlowLiteSelectTfOps_framework failed to build
Use --verbose_failures to see the command lines of failed build steps.
INFO: Elapsed time: 1132.618s, Critical Path: 66.45s
INFO: 12518 processes: 3574 internal, 8944 local.
FAILED: Build did NOT complete successfully
``` Just pulled the latest version from git, still seeing the `'tensorflow/libtensorflow_framework.2.dylib' was not created by genrule` error

```
ERROR: /Users/ghe/projects/tensorflow/tensorflow/BUILD:1128:21: declared output 'tensorflow/libtensorflow_framework.2.dylib' was not created by genrule. This is probably because the genrule actually didn't create this output, or because the output was a directory and the genrule was run remotely (note that only the contents of declared file outputs are copied from genrules run remotely)
ERROR: /Users/ghe/projects/tensorflow/tensorflow/BUILD:1128:21: Executing genrule //tensorflow:libtensorflow_framework.2.dylib_sym [for host] failed: not all outputs were created or valid
realpath: illegal option -- -
usage: realpath [-q] [path ...]
Target //tensorflow/lite/ios/tmp:TensorFlowLiteSelectTfOps_framework failed to build
Use --verbose_failures to see the command lines of failed build steps.
INFO: Elapsed time: 591.530s, Critical Path: 121.72s
INFO: 2120 processes: 20 internal, 2100 local.
FAILED: Build did NOT complete successfully
``` `This is probably because the genrule actually didn't create this output, or because the output was a directory and the genrule was run remotely (note that only the contents of declared file outputs are copied from genrules run remotely)`
Hmm what's the python version you have? We have an internal job that runs this script and the job is working fine. It uses python 3.9.9. I think this error is related to some configuration issue. @yishuangP I'm using 3.9.6 Let me update to 3.9.9 and try again. Is there anything I need to configure when running ./configure file? I only select "yes" for iOS question, all others are "No".  > @yishuangP I'm using 3.9.6 Let me update to 3.9.9 and try again. Is there anything I need to configure when running ./configure file? I only select "yes" for iOS question, all others are "No".

I think that is enough. Let me know if you run into any issues. @yishuangP Unfortunately updating the python to 3.9.16 doesn't solve the problem. (I was not able to update to 3.9.9 specifically via homebrew)  Hi guanyu, this seems a tooling issue on tensorflow side. Could you help file a separate issue for this? Sure will do. thanks for looking into ios build part! @yishuangP I filed a separate ticket https://github.com/tensorflow/tensorflow/issues/60088  can you help assign it to the correct team to look into it? Thank you! Thanks for filing the issue! Hey guys, stuck with the same problem, but trying to build an android ndk c tflite lib
completely followed the reduce the binary size page instructions, tmp/BUILD file is the same
NDK: 19.2.5345600, Python 3.9, every bazel var was set

```
ERROR: /home/sait/tf_short/tensorflow/tmp/BUILD:7:24: Compiling tmp/selectively_built_c_lib_registration_registration.cc failed: undeclared inclusion(s) in rule '//tmp:selectively_built_c_lib_create_op_resolver':
this rule is missing dependency declarations for the following files included by 'tmp/selectively_built_c_lib_registration_registration.cc':
  'tensorflow/lite/core/shims/builtin_ops_list.inc'
Target //tmp:tensorflowlite_c failed to build
Use --verbose_failures to see the command lines of failed build steps.
INFO: Elapsed time: 20.528s, Critical Path: 8.48s
INFO: 92 processes: 8 internal, 84 local.
FAILED: Build did NOT complete successfully
```

when added "//tensorflow/lite/core/shims:builtin_ops_list", to deps
```
ERROR: /home/sait/tf_short/tensorflow/tmp/BUILD:21:24: in cc_binary rule //tmp:libtensorflowlite_c.so: target '//tensorflow/lite/core/shims:builtin_ops_list' is not visible from target '//tmp:libtensorflowlite_c.so'. Check the visibility declaration of the former target if you think the dependency is legitimate
ERROR: /home/sait/tf_short/tensorflow/tmp/BUILD:21:24: Analysis of target '//tmp:libtensorflowlite_c.so' failed
ERROR: Analysis of target '//tmp:tensorflowlite_c' failed; build aborted: 
INFO: Elapsed time: 0.088s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (1 packages loaded, 5 targets configured)
```

bazel line is:
`bazel build -c opt --cxxopt=--std=c++17 --config=android_arm64   //tmp:tensorflowlite_c`

micro update: 
tried adding aforementioned dep line into almost every cc_library thing in different BUILD files (mostly with word "resolver" in it, still doesnt work :(





 Hi @heguanyu I was successfully able to build the TFLite framework after merges from @yishuangP. Please refer the screenshot here. FYI I have python 3.10.8 installed and it works fine.

<img width="744" alt="Screenshot 2023-03-24 at 9 48 04 PM" src="https://user-images.githubusercontent.com/118897289/227582964-f88c8ef7-34d5-4a92-b6e4-4da122e699dd.png">
 update: downgraded to 2.11.0, everything worked! 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.
<details><summary>Click to expand!</summary> 
 
 ### Issue Type

Bug

### Have you reproduced the bug with TF nightly?

Yes

### Source

source

### Tensorflow Version

2.11.0

### Custom Code

No

### OS Platform and Distribution

MacOS Monterey 12.6.2

### Mobile device

N/A

### Python version

3.9

### Bazel version

5.3.0

### GCC/Compiler version

14.0.0

### CUDA/cuDNN version

_No response_

### GPU model and memory

N/A

### Current Behaviour?

```shell
I tried building a selective TFL framework following this guide(https://www.tensorflow.org/lite/guide/build_ios#selectively_build_tflite_frameworks). The model I fed into the command only uses builtin and select ops. However this command returns error. 

ERROR: /Users/xx/projects/tensorflow/tensorflow/lite/ios/tmp/BUILD:4:24: Compiling tensorflow/lite/ios/tmp/custom_c_api_registration_registration.cc failed: undeclared inclusion(s) in rule '//tensorflow/lite/ios/tmp:custom_c_api_create_op_resolver':
this rule is missing dependency declarations for the following files included by 'tensorflow/lite/ios/tmp/custom_c_api_registration_registration.cc':
  'tensorflow/lite/core/shims/builtin_ops_list.inc'

I tried adding shims:builtin_ops_list but it is not helping and keep failing.
```


### Standalone code to reproduce the issue

```shell
The original code is not working
```


### Relevant log output

_No response_</details>