Unable to build tensorflow-lite-select-ops.aar for tf 2.16
Have you solved this problem? Hi @zerolalala ,
The problem is not solved Hi @j-dsouza-19,

I am working on it. Please allow me some time to resolve.

Thank You > Hi @j-dsouza-19,
> 
> I am working on it. Please allow me some time to resolve.
> 
> Thank You

Thank you @LakshmiKalaKadali 
 Hi @pkgoogle,

While reproducing the error, I have encountered another error  ```File :/home/lakshmikala/tensorflow-2.16.1/./configure.py", line 536, in get_from_env_or_user_or_default var = get_input(ask_for_var)
File "/home/lakshmikala/tensorflow-2.16.1/./configure.py", line 99, in get_input answer = input(question)  # pylint: disable=bad-builtin```
Please look into the user error.
Thank You Hi @j-dsouza-19, can you share the model.tflite file which produced this error? Feel free to make it smaller with only the ops which produced the error. Alternatively, one thing you can try is using the nightly branch from source instead of that zip file. That may resolve your issue.

Thanks! 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. I do have the same issue during building v2.15.0 with select ops. What could be the problem? Hi @vitalii-vorobiov, are you following the same steps as this issue? If not please let us know your reproducible steps. If your steps are different enough than that may be a separate issue. Thanks for your help. @pkgoogle yes I was trying to build it using docker and following the same steps as described in this issue. And also I encountered the same error when I was trying to build locally on my linux machine following the next steps:
1. Clone gtihub repo
2. run ./configure for Android
3. Run bash tensorflow/lite/tools/build_aar.sh --input_models=<my_model> --target_archs=arm64-v8a Hi @vitalii-vorobiov, can you please share your input models (perhaps a reduced one which replicates the issue still)? Thanks. Hi @pkgoogle, here is the model with which I'm trying to build (attached as a file
[transformer_large.tflite.zip](https://github.com/tensorflow/tensorflow/files/14833872/transformer_large.tflite.zip)
). It was created using this repo: https://github.com/PIC4SeR/AcT Hi @vitalii-vorobiov, what error are you reaching? Judging by your replication steps, you are testing against master?

Here are my results:
```
bazel build -c opt --config=opt --cxxopt=--std=c++17 --fat_apk_cpu=arm64-v8a --define=android_dexmerger_tool=d8_dexmerger --define=android_incremental_dexing_tool=d8_dexbuilder --host_crosstool_top=@bazel_tools//tools/cpp:toolchain //tmp:tensorflow-lite
INFO: Reading 'startup' options from /usr/local/google/home/xxxxxxxxx/git/tensorflow/.bazelrc: --windows_enable_symlinks
INFO: Options provided by the client:
  Inherited 'common' options: --isatty=1 --terminal_columns=176
INFO: Reading rc options for 'build' from /usr/local/google/home/xxxxxxxxx/git/tensorflow/.bazelrc:
  Inherited 'common' options: --experimental_repo_remote_exec
INFO: Reading rc options for 'build' from /usr/local/google/home/xxxxxxxxx/git/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 --features=-force_no_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 /usr/local/google/home/xxxxxxxxx/git/tensorflow/.tf_configure.bazelrc:
  'build' options: --action_env PYTHON_BIN_PATH=/usr/local/google/home/xxxxxxxxx/miniconda3/envs/tf_debug_2dot16dot1/bin/python3 --action_env PYTHON_LIB_PATH=/usr/local/google/home/xxxxxxxxx/miniconda3/envs/tf_debug_2dot16dot1/lib/python3.12/site-packages --python_path=/usr/local/google/home/xxxxxxxxx/miniconda3/envs/tf_debug_2dot16dot1/bin/python3 --action_env CLANG_COMPILER_PATH=/usr/lib/llvm-17/bin/clang --repo_env=CC=/usr/lib/llvm-17/bin/clang --repo_env=BAZEL_COMPILER=/usr/lib/llvm-17/bin/clang --copt=-Wno-gnu-offsetof-extensions --action_env ANDROID_NDK_HOME=/usr/local/google/home/xxxxxxxxx/Android/android-ndk-r25c --action_env ANDROID_NDK_VERSION=25 --action_env ANDROID_NDK_API_LEVEL=21 --action_env ANDROID_BUILD_TOOLS_VERSION=34.0.0 --action_env ANDROID_SDK_API_LEVEL=30 --action_env ANDROID_SDK_HOME=/usr/local/google/home/xxxxxxxxx/Android/Sdk
INFO: Found applicable config definition build:short_logs in file /usr/local/google/home/xxxxxxxxx/git/tensorflow/.bazelrc: --output_filter=DONT_MATCH_ANYTHING
INFO: Found applicable config definition build:v2 in file /usr/local/google/home/xxxxxxxxx/git/tensorflow/.bazelrc: --define=tf_api_version=2 --action_env=TF2_BEHAVIOR=1
INFO: Found applicable config definition build:opt in file /usr/local/google/home/xxxxxxxxx/git/tensorflow/.tf_configure.bazelrc: --copt=-Wno-sign-compare --host_copt=-Wno-sign-compare
INFO: Found applicable config definition build:linux in file /usr/local/google/home/xxxxxxxxx/git/tensorflow/.bazelrc: --host_copt=-w --copt=-Wno-all --copt=-Wno-extra --copt=-Wno-deprecated --copt=-Wno-deprecated-declarations --copt=-Wno-ignored-attributes --copt=-Wno-array-bounds --copt=-Wunused-result --copt=-Werror=unused-result --copt=-Wswitch --copt=-Werror=switch --copt=-Wno-error=unused-but-set-variable --define=PREFIX=/usr --define=LIBDIR=$(PREFIX)/lib --define=INCLUDEDIR=$(PREFIX)/include --define=PROTOBUF_INCLUDE_PATH=$(PREFIX)/include --cxxopt=-std=c++17 --host_cxxopt=-std=c++17 --config=dynamic_kernels --experimental_guard_against_concurrent_changes
INFO: Found applicable config definition build:dynamic_kernels in file /usr/local/google/home/xxxxxxxxx/git/tensorflow/.bazelrc: --define=dynamic_loaded_kernels=true --copt=-DAUTOLOAD_DYNAMIC_KERNELS
INFO: Analyzed target //tmp:tensorflow-lite (3 packages loaded, 2413 targets configured).
INFO: Found 1 target...
ERROR: /usr/local/google/home/xxxxxxxxx/git/tensorflow/tensorflow/lite/delegates/nnapi/BUILD:14:11: Compiling tensorflow/lite/delegates/nnapi/nnapi_delegate.cc failed: (Exit 1): clang failed: error executing command (from target //tensorflow/lite/delegates/nnapi:nnapi_delegate_no_nnapi_implementation) external/androidndk/toolchains/llvm/prebuilt/linux-x86_64/bin/clang -no-canonical-prefixes '--target=aarch64-linux-android21' -fdiagnostics-color -Wa,--noexecstack -fno-exceptions '-std=gnu++17' ... (remaining 158 arguments skipped)
tensorflow/lite/delegates/nnapi/nnapi_delegate.cc:522:7: error: designated initializers are a C++20 extension [-Werror,-Wc++20-designator]
      .type = nn_type,
      ^
tensorflow/lite/delegates/nnapi/nnapi_delegate.cc:1529:45: error: designated initializers are a C++20 extension [-Werror,-Wc++20-designator]
    ANeuralNetworksOperandType operand_type{.type = nn_type};
                                            ^
tensorflow/lite/delegates/nnapi/nnapi_delegate.cc:1682:45: error: designated initializers are a C++20 extension [-Werror,-Wc++20-designator]
    ANeuralNetworksOperandType operand_type{.type = nn_type};
                                            ^
tensorflow/lite/delegates/nnapi/nnapi_delegate.cc:1701:45: error: designated initializers are a C++20 extension [-Werror,-Wc++20-designator]
    ANeuralNetworksOperandType operand_type{.type = nn_type,
                                            ^
tensorflow/lite/delegates/nnapi/nnapi_delegate.cc:1743:9: error: designated initializers are a C++20 extension [-Werror,-Wc++20-designator]
        .type = nn_type,
        ^
tensorflow/lite/delegates/nnapi/nnapi_delegate.cc:1844:17: error: designated initializers are a C++20 extension [-Werror,-Wc++20-designator]
                .channelDim = static_cast<uint32_t>(
                ^
tensorflow/lite/delegates/nnapi/nnapi_delegate.cc:6915:7: error: designated initializers are a C++20 extension [-Werror,-Wc++20-designator]
      .init = [](TfLiteContext* context, const char* buffer,
      ^
7 errors generated.
Target //tmp:tensorflow-lite failed to build
Use --verbose_failures to see the command lines of failed build steps.
INFO: Elapsed time: 21.741s, Critical Path: 16.62s
INFO: 836 processes: 59 internal, 777 local.
FAILED: Build did NOT complete successfully
``` Hi @pkgoogle, yes I'm testing this on the current master branch. When reproducing my steps I also first encountered the same error as you (error: designated initializers are a C++20 extension).

`
ERROR: /home/chao/Desktop/TFBuild/tensorflow/tensorflow/lite/delegates/nnapi/BUILD:14:11: Compiling tensorflow/lite/delegates/nnapi/nnapi_delegate.cc failed: (Exit 1): clang failed: error executing command (from target //tensorflow/lite/delegates/nnapi:nnapi_delegate_no_nnapi_implementation) external/androidndk/toolchains/llvm/prebuilt/linux-x86_64/bin/clang -no-canonical-prefixes '--target=aarch64-linux-android21' -fdiagnostics-color -Wa,--noexecstack -fno-exceptions '-std=gnu++17' ... (remaining 157 arguments skipped)
tensorflow/lite/delegates/nnapi/nnapi_delegate.cc:522:7: error: designated initializers are a C++20 extension [-Werror,-Wc++20-designator]
      .type = nn_type,
      ^
tensorflow/lite/delegates/nnapi/nnapi_delegate.cc:1529:45: error: designated initializers are a C++20 extension [-Werror,-Wc++20-designator]
    ANeuralNetworksOperandType operand_type{.type = nn_type};
                                            ^
tensorflow/lite/delegates/nnapi/nnapi_delegate.cc:1682:45: error: designated initializers are a C++20 extension [-Werror,-Wc++20-designator]
    ANeuralNetworksOperandType operand_type{.type = nn_type};
                                            ^
tensorflow/lite/delegates/nnapi/nnapi_delegate.cc:1701:45: error: designated initializers are a C++20 extension [-Werror,-Wc++20-designator]
    ANeuralNetworksOperandType operand_type{.type = nn_type,
                                            ^
tensorflow/lite/delegates/nnapi/nnapi_delegate.cc:1743:9: error: designated initializers are a C++20 extension [-Werror,-Wc++20-designator]
        .type = nn_type,
        ^
tensorflow/lite/delegates/nnapi/nnapi_delegate.cc:1844:17: error: designated initializers are a C++20 extension [-Werror,-Wc++20-designator]
                .channelDim = static_cast<uint32_t>(
                ^
tensorflow/lite/delegates/nnapi/nnapi_delegate.cc:6915:7: error: designated initializers are a C++20 extension [-Werror,-Wc++20-designator]
      .init = [](TfLiteContext* context, const char* buffer,
      ^
7 errors generated.
Target //tmp:tensorflow-lite failed to build
Use --verbose_failures to see the command lines of failed build steps.
INFO: Elapsed time: 94.614s, Critical Path: 24.10s
INFO: 540 processes: 21 internal, 519 local.
FAILED: Build did NOT complete successfully
`

I fixed this issue just by replacing the C++ initializers syntax as follows:
old: 

`ANeuralNetworksOperandType nn_operand_type{
      .type = nn_type,
      .dimensionCount = tensor_rank,
      .dimensions = tensor_dims,
      .scale = scale,
      .zeroPoint = zero_point,
  };`

new:

`ANeuralNetworksOperandType nn_operand_type{
      nn_type,
      tensor_rank,
      tensor_dims,
      scale,
      zero_point,
  };`

For the ./configure action I only selected to configure ./WORKSPACE for Android builds. I've used NDK version 25.08775105, min Android NDK API level 21, Android SDK API level 34, and Android build tools version 34.0.0.

After fixing the issue with C++20 initializers you will be able to reach this error with protobufs while trying to build select-tf-ops:

`ERROR: /home/chao/Desktop/TFBuild/tensorflow/tmp/BUILD:19:28: Linking tmp/libtensorflowlite_flex_jni.so failed: (Exit 1): clang failed: error executing command (from target //tmp:libtensorflowlite_flex_jni.so) external/androidndk/toolchains/llvm/prebuilt/linux-x86_64/bin/clang @bazel-out/android-arm64-v8a-opt/bin/tmp/libtensorflowlite_flex_jni.so-2.params
ld.lld: error: undefined symbol: google::protobuf::Message::DebugString() const
>>> referenced by function_ops.cc
>>>               bazel-out/android-arm64-v8a-opt/bin/tmp/_objs/custom_tensorflowlite_flex_flex_delegate_tensorflow_lib/0/function_ops.pic.o:(std::__ndk1::__function::__func<tensorflow::$_0, std::__ndk1::allocator<tensorflow::$_0>, absl::lts_20230802::Status (tensorflow::shape_inference::InferenceContext*)>::operator()(tensorflow::shape_inference::InferenceContext*&&))
>>> referenced by function_ops.cc
>>>               bazel-out/android-arm64-v8a-opt/bin/tmp/_objs/custom_tensorflowlite_flex_flex_delegate_tensorflow_lib/0/function_ops.pic.o:(std::__ndk1::__function::__func<tensorflow::$_0, std::__ndk1::allocator<tensorflow::$_0>, absl::lts_20230802::Status (tensorflow::shape_inference::InferenceContext*)>::operator()(tensorflow::shape_inference::InferenceContext*&&))
>>> referenced by function_ops.cc
>>>               bazel-out/android-arm64-v8a-opt/bin/tmp/_objs/custom_tensorflowlite_flex_flex_delegate_tensorflow_lib/0/function_ops.pic.o:(std::__ndk1::__function::__func<tensorflow::$_0, std::__ndk1::allocator<tensorflow::$_0>, absl::lts_20230802::Status (tensorflow::shape_inference::InferenceContext*)>::operator()(tensorflow::shape_inference::InferenceContext*&&))
>>> referenced 28 more times

ld.lld: error: undefined symbol: google::protobuf::internal::kGlobalEmptyTable
>>> referenced by partitioned_function_ops.cc
>>>               bazel-out/android-arm64-v8a-opt/bin/tmp/_objs/custom_tensorflowlite_flex_flex_delegate_tensorflow_lib/partitioned_function_ops.pic.o:(google::protobuf::Map<std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> >, tensorflow::AttrValue>::Map(google::protobuf::Map<std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> >, tensorflow::AttrValue> const&))
>>> referenced by partitioned_function_ops.cc
>>>               bazel-out/android-arm64-v8a-opt/bin/tmp/_objs/custom_tensorflowlite_flex_flex_delegate_tensorflow_lib/partitioned_function_ops.pic.o:(google::protobuf::Map<std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> >, tensorflow::AttrValue>::Map(google::protobuf::Map<std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> >, tensorflow::AttrValue> const&))
>>> referenced by optimized_function_graph_info.cc
>>>               bazel-out/android-arm64-v8a-opt/bin/tensorflow/core/_objs/portable_tensorflow_lib_lite/optimized_function_graph_info.pic.o:(google::protobuf::Map<std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> >, std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> > >::Map<std::__ndk1::__hash_map_const_iterator<std::__ndk1::__hash_const_iterator<std::__ndk1::__hash_node<std::__ndk1::__hash_value_type<std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> >, std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> > >, void*>*> > >(std::__ndk1::__hash_map_const_iterator<std::__ndk1::__hash_const_iterator<std::__ndk1::__hash_node<std::__ndk1::__hash_value_type<std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> >, std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> > >, void*>*> > const&, std::__ndk1::__hash_map_const_iterator<std::__ndk1::__hash_const_iterator<std::__ndk1::__hash_node<std::__ndk1::__hash_value_type<std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> >, std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> > >, void*>*> > const&))
>>> referenced 207 more times

ld.lld: error: undefined symbol: google::protobuf::Arena::AllocateAlignedWithHookForArray(unsigned long, std::type_info const*)
>>> referenced by partitioned_function_ops.cc
>>>               bazel-out/android-arm64-v8a-opt/bin/tmp/_objs/custom_tensorflowlite_flex_flex_delegate_tensorflow_lib/partitioned_function_ops.pic.o:(google::protobuf::Arena::AllocateAlignedWithHookForArray(unsigned long, unsigned long, std::type_info const*))
>>> referenced by partitioned_function_ops.cc
>>>               bazel-out/android-arm64-v8a-opt/bin/tmp/_objs/custom_tensorflowlite_flex_flex_delegate_tensorflow_lib/partitioned_function_ops.pic.o:(google::protobuf::Arena::AllocateAlignedWithHookForArray(unsigned long, unsigned long, std::type_info const*))
>>> referenced by kernel.cc
>>>               bazel-out/android-arm64-v8a-opt/bin/tensorflow/lite/delegates/flex/_objs/delegate_only_runtime/kernel.pic.o:(std::__ndk1::pair<google::protobuf::Map<std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> >, tensorflow::AttrValue>::InnerMap::iterator_base<google::protobuf::MapPair<std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> >, tensorflow::AttrValue> >, bool> google::protobuf::Map<std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> >, tensorflow::AttrValue>::InnerMap::TryEmplaceInternal<char const (&) [25]>(char const (&) [25]))

ld.lld: error: undefined symbol: google::protobuf::internal::ThreadSafeArena::AddCleanup(void*, void (*)(void*))
>>> referenced by partitioned_function_ops.cc
>>>               bazel-out/android-arm64-v8a-opt/bin/tmp/_objs/custom_tensorflowlite_flex_flex_delegate_tensorflow_lib/partitioned_function_ops.pic.o:(void google::protobuf::Arena::RegisterDestructorInternal<std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> > >(std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> >*, google::protobuf::Arena*, std::__ndk1::integral_constant<bool, false>))
>>> referenced by kernel.cc
>>>               bazel-out/android-arm64-v8a-opt/bin/tensorflow/lite/delegates/flex/_objs/delegate_only_runtime/kernel.pic.o:(std::__ndk1::pair<google::protobuf::Map<std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> >, tensorflow::AttrValue>::InnerMap::iterator_base<google::protobuf::MapPair<std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> >, tensorflow::AttrValue> >, bool> google::protobuf::Map<std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> >, tensorflow::AttrValue>::InnerMap::TryEmplaceInternal<char const (&) [25]>(char const (&) [25]))
>>> referenced by [feature.pb.cc](http://feature.pb.cc/)
>>>               bazel-out/android-arm64-v8a-opt/bin/tensorflow/core/example/_objs/example_protos_cc_impl/feature.pb.pic.o:(tensorflow::Features::Features(google::protobuf::Arena*, bool))
>>> referenced 71 more times

ld.lld: error: undefined symbol: google::protobuf::Arena::AllocateAlignedWithCleanup(unsigned long, std::type_info const*)
>>> referenced by partitioned_function_ops.cc
>>>               bazel-out/android-arm64-v8a-opt/bin/tmp/_objs/custom_tensorflowlite_flex_flex_delegate_tensorflow_lib/partitioned_function_ops.pic.o:(google::protobuf::Map<std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> >, tensorflow::AttrValue>::InnerMap::TreeConvert(unsigned long))
>>> referenced by feature_util.cc
>>>               bazel-out/android-arm64-v8a-opt/bin/tensorflow/core/_objs/portable_tensorflow_lib_lite/feature_util.pic.o:(google::protobuf::Map<std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> >, tensorflow::FeatureList>::InnerMap::TreeConvert(unsigned long))
>>> referenced by function.cc
>>>               bazel-out/android-arm64-v8a-opt/bin/tensorflow/core/_objs/portable_tensorflow_lib_lite/0/function.pic.o:(google::protobuf::internal::StringTypeHandler::New(google::protobuf::Arena*, std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> >&&))
>>> referenced 59 more times

ld.lld: error: undefined symbol: google::protobuf::internal::RepeatedPtrFieldBase::AddOutOfLineHelper(void*)
>>> referenced by save_restore_tensor.cc
>>>               bazel-out/android-arm64-v8a-opt/bin/tmp/_objs/custom_tensorflowlite_flex_flex_delegate_tensorflow_lib/save_restore_tensor.pic.o:(google::protobuf::RepeatedPtrField<tensorflow::SavedSliceMeta>::TypeHandler::Type* google::protobuf::internal::RepeatedPtrFieldBase::Add<google::protobuf::RepeatedPtrField<tensorflow::SavedSliceMeta>::TypeHandler>(google::protobuf::RepeatedPtrField<tensorflow::SavedSliceMeta>::TypeHandler::Type const*))
>>> referenced by save_restore_tensor.cc
>>>               bazel-out/android-arm64-v8a-opt/bin/tmp/_objs/custom_tensorflowlite_flex_flex_delegate_tensorflow_lib/save_restore_tensor.pic.o:(google::protobuf::RepeatedPtrField<tensorflow::TensorSliceProto>::TypeHandler::Type* google::protobuf::internal::RepeatedPtrFieldBase::Add<google::protobuf::RepeatedPtrField<tensorflow::TensorSliceProto>::TypeHandler>(google::protobuf::RepeatedPtrField<tensorflow::TensorSliceProto>::TypeHandler::Type const*))
>>> referenced by compression_utils.cc
>>>               bazel-out/android-arm64-v8a-opt/bin/tmp/_objs/custom_tensorflowlite_flex_flex_delegate_tensorflow_lib/compression_utils.pic.o:(google::protobuf::RepeatedPtrField<tensorflow::data::CompressedComponentMetadata>::TypeHandler::Type* google::protobuf::internal::RepeatedPtrFieldBase::Add<google::protobuf::RepeatedPtrField<tensorflow::data::CompressedComponentMetadata>::TypeHandler>(google::protobuf::RepeatedPtrField<tensorflow::data::CompressedComponentMetadata>::TypeHandler::Type const*))
>>> referenced 85 more times

ld.lld: error: undefined symbol: google::protobuf::RepeatedField<unsigned long>::Reserve(int)
>>> referenced by save_restore_tensor.cc
>>>               bazel-out/android-arm64-v8a-opt/bin/tmp/_objs/custom_tensorflowlite_flex_flex_delegate_tensorflow_lib/save_restore_tensor.pic.o:(void google::protobuf::RepeatedField<unsigned long>::Add<unsigned long const*>(unsigned long const*, unsigned long const*))
>>> referenced by save_restore_tensor.cc
>>>               bazel-out/android-arm64-v8a-opt/bin/tmp/_objs/custom_tensorflowlite_flex_flex_delegate_tensorflow_lib/save_restore_tensor.pic.o:(google::protobuf::RepeatedField<unsigned long>::FastAdderImpl<0, true>::Add(unsigned long))

ld.lld: error: undefined symbol: google::protobuf::RepeatedField<long>::Reserve(int)
>>> referenced by save_restore_tensor.cc
>>>               bazel-out/android-arm64-v8a-opt/bin/tmp/_objs/custom_tensorflowlite_flex_flex_delegate_tensorflow_lib/save_restore_tensor.pic.o:(void google::protobuf::RepeatedField<long>::Add<long const*>(long const*, long const*))
>>> referenced by save_restore_tensor.cc
>>>               bazel-out/android-arm64-v8a-opt/bin/tmp/_objs/custom_tensorflowlite_flex_flex_delegate_tensorflow_lib/save_restore_tensor.pic.o:(google::protobuf::RepeatedField<long>::FastAdderImpl<0, true>::Add(long))

ld.lld: error: undefined symbol: google::protobuf::RepeatedField<unsigned int>::Reserve(int)
>>> referenced by save_restore_tensor.cc
>>>               bazel-out/android-arm64-v8a-opt/bin/tmp/_objs/custom_tensorflowlite_flex_flex_delegate_tensorflow_lib/save_restore_tensor.pic.o:(void google::protobuf::RepeatedField<unsigned int>::Add<unsigned int const*>(unsigned int const*, unsigned int const*))
>>> referenced by save_restore_tensor.cc
>>>               bazel-out/android-arm64-v8a-opt/bin/tmp/_objs/custom_tensorflowlite_flex_flex_delegate_tensorflow_lib/save_restore_tensor.pic.o:(google::protobuf::RepeatedField<unsigned int>::FastAdderImpl<0, true>::Add(unsigned int))

ld.lld: error: undefined symbol: google::protobuf::RepeatedField<int>::Reserve(int)
>>> referenced by save_restore_tensor.cc
>>>               bazel-out/android-arm64-v8a-opt/bin/tmp/_objs/custom_tensorflowlite_flex_flex_delegate_tensorflow_lib/save_restore_tensor.pic.o:(void google::protobuf::RepeatedField<int>::Add<unsigned short const*>(unsigned short const*, unsigned short const*))
>>> referenced by save_restore_tensor.cc
>>>               bazel-out/android-arm64-v8a-opt/bin/tmp/_objs/custom_tensorflowlite_flex_flex_delegate_tensorflow_lib/save_restore_tensor.pic.o:(google::protobuf::RepeatedField<int>::FastAdderImpl<0, true>::Add(int))
>>> referenced by save_restore_tensor.cc
>>>               bazel-out/android-arm64-v8a-opt/bin/tmp/_objs/custom_tensorflowlite_flex_flex_delegate_tensorflow_lib/save_restore_tensor.pic.o:(void google::protobuf::RepeatedField<int>::Add<short const*>(short const*, short const*))
>>> referenced 5 more times

ld.lld: error: undefined symbol: google::protobuf::RepeatedField<float>::Reserve(int)
>>> referenced by save_restore_tensor.cc
>>>               bazel-out/android-arm64-v8a-opt/bin/tmp/_objs/custom_tensorflowlite_flex_flex_delegate_tensorflow_lib/save_restore_tensor.pic.o:(void google::protobuf::RepeatedField<float>::Add<float const*>(float const*, float const*))
>>> referenced by save_restore_tensor.cc
>>>               bazel-out/android-arm64-v8a-opt/bin/tmp/_objs/custom_tensorflowlite_flex_flex_delegate_tensorflow_lib/save_restore_tensor.pic.o:(google::protobuf::RepeatedField<float>::FastAdderImpl<0, true>::Add(float))

ld.lld: error: undefined symbol: google::protobuf::RepeatedField<double>::Reserve(int)
>>> referenced by save_restore_tensor.cc
>>>               bazel-out/android-arm64-v8a-opt/bin/tmp/_objs/custom_tensorflowlite_flex_flex_delegate_tensorflow_lib/save_restore_tensor.pic.o:(void google::protobuf::RepeatedField<double>::Add<double const*>(double const*, double const*))
>>> referenced by save_restore_tensor.cc
>>>               bazel-out/android-arm64-v8a-opt/bin/tmp/_objs/custom_tensorflowlite_flex_flex_delegate_tensorflow_lib/save_restore_tensor.pic.o:(google::protobuf::RepeatedField<double>::FastAdderImpl<0, true>::Add(double))

ld.lld: error: undefined symbol: google::protobuf::RepeatedField<bool>::Reserve(int)
>>> referenced by save_restore_tensor.cc
>>>               bazel-out/android-arm64-v8a-opt/bin/tmp/_objs/custom_tensorflowlite_flex_flex_delegate_tensorflow_lib/save_restore_tensor.pic.o:(void google::protobuf::RepeatedField<bool>::Add<bool const*>(bool const*, bool const*))
>>> referenced by save_restore_tensor.cc
>>>               bazel-out/android-arm64-v8a-opt/bin/tmp/_objs/custom_tensorflowlite_flex_flex_delegate_tensorflow_lib/save_restore_tensor.pic.o:(google::protobuf::RepeatedField<bool>::FastAdderImpl<0, true>::Add(bool))

ld.lld: error: undefined symbol: google::protobuf::MessageLite::AppendToString(std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> >*) const
>>> referenced by tensor_list.cc
>>>               bazel-out/android-arm64-v8a-opt/bin/tmp/_objs/custom_tensorflowlite_flex_flex_delegate_tensorflow_lib/tensor_list.pic.o:(tensorflow::TensorList::Encode(tensorflow::VariantTensorData*) const)
>>> referenced by tensor_coding.cc
>>>               bazel-out/android-arm64-v8a-opt/bin/tensorflow/core/_objs/portable_tensorflow_lib_lite/tensor_coding.pic.o:(tensorflow::port::StringListEncoderImpl::Append(google::protobuf::MessageLite const&))

ld.lld: error: undefined symbol: google::protobuf::MessageLite::ParseFromString(std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> > const&)
>>> referenced by tensor_list.cc
>>>               bazel-out/android-arm64-v8a-opt/bin/tmp/_objs/custom_tensorflowlite_flex_flex_delegate_tensorflow_lib/tensor_list.pic.o:(tensorflow::TensorList::Decode(tensorflow::VariantTensorData const&))
>>> referenced by compression_utils.cc
>>>               bazel-out/android-arm64-v8a-opt/bin/tmp/_objs/custom_tensorflowlite_flex_flex_delegate_tensorflow_lib/compression_utils.pic.o:(tensorflow::data::UncompressElement(tensorflow::data::CompressedElement const&, std::__ndk1::vector<tensorflow::Tensor, std::__ndk1::allocator<tensorflow::Tensor> >*))
>>> referenced by compression_utils.cc
>>>               bazel-out/android-arm64-v8a-opt/bin/tmp/_objs/custom_tensorflowlite_flex_flex_delegate_tensorflow_lib/compression_utils.pic.o:(bool tensorflow::DecodeVariantImpl<tensorflow::data::CompressedElement>(tensorflow::VariantTensorData, tensorflow::TypeResolver<tensorflow::data::CompressedElement, false, false, true>, tensorflow::data::CompressedElement*))
>>> referenced 8 more times

ld.lld: error: undefined symbol: google::protobuf::MessageLite::SerializeToArray(void*, int) const
>>> referenced by compression_utils.cc
>>>               bazel-out/android-arm64-v8a-opt/bin/tmp/_objs/custom_tensorflowlite_flex_flex_delegate_tensorflow_lib/compression_utils.pic.o:(tensorflow::data::CompressElement(std::__ndk1::vector<tensorflow::Tensor, std::__ndk1::allocator<tensorflow::Tensor> > const&, tensorflow::data::CompressedElement*))

ld.lld: error: undefined symbol: google::protobuf::RepeatedField<unsigned long>::Add(unsigned long const&)
>>> referenced by compression_utils.cc
>>>               bazel-out/android-arm64-v8a-opt/bin/tmp/_objs/custom_tensorflowlite_flex_flex_delegate_tensorflow_lib/compression_utils.pic.o:(tensorflow::data::CompressedComponentMetadata::_internal_add_uncompressed_bytes(unsigned long))
>>> referenced by [tensor.pb_text.cc](http://tensor.pb_text.cc/)
>>>               bazel-out/android-arm64-v8a-opt/bin/tensorflow/core/_objs/portable_tensorflow_lib_lite/tensor.pb_text.pic.o:(tensorflow::TensorProto::_internal_add_uint64_val(unsigned long))
>>> referenced by graph_debug_info_builder.cc
>>>               bazel-out/android-arm64-v8a-opt/bin/tensorflow/core/_objs/portable_tensorflow_lib_lite/graph_debug_info_builder.pic.o:(tensorflow::GraphDebugInfo_StackTrace::_internal_add_frame_id(unsigned long))
>>> referenced 1 more times

ld.lld: error: undefined symbol: google::protobuf::internal::ArenaStringPtr::Mutable(google::protobuf::Arena*)
>>> referenced by compression_utils.cc
>>>               bazel-out/android-arm64-v8a-opt/bin/tmp/_objs/custom_tensorflowlite_flex_flex_delegate_tensorflow_lib/compression_utils.pic.o:(tensorflow::data::CompressedElement::_internal_mutable_data())
>>> referenced by dataset_utils.cc
>>>               bazel-out/android-arm64-v8a-opt/bin/tmp/_objs/custom_tensorflowlite_flex_flex_delegate_tensorflow_lib/dataset_utils.pic.o:(tensorflow::NodeDef::_internal_mutable_device())
>>> referenced by [attr_value.pb_text.cc](http://attr_value.pb_text.cc/)
>>>               bazel-out/android-arm64-v8a-opt/bin/tensorflow/core/_objs/portable_tensorflow_lib_lite/attr_value.pb_text.pic.o:(tensorflow::AttrValue::_internal_mutable_s())
>>> referenced 64 more times

ld.lld: error: undefined symbol: google::protobuf::Message::GetTypeName() const
>>> referenced by compression_utils.cc
>>>               bazel-out/android-arm64-v8a-opt/bin/tmp/_objs/custom_tensorflowlite_flex_flex_delegate_tensorflow_lib/compression_utils.pic.o:(tensorflow::Variant::Value<tensorflow::data::CompressedElement>::TypeName() const)
>>> referenced by compression_utils.cc
>>>               bazel-out/android-arm64-v8a-opt/bin/tmp/_objs/custom_tensorflowlite_flex_flex_delegate_tensorflow_lib/compression_utils.pic.o:(void tensorflow::EncodeVariant<tensorflow::data::CompressedElement>(tensorflow::data::CompressedElement const&, tensorflow::VariantTensorData*))
>>> referenced by compression_utils.cc
>>>               bazel-out/android-arm64-v8a-opt/bin/tmp/_objs/custom_tensorflowlite_flex_flex_delegate_tensorflow_lib/compression_utils.pic.o:(void tensorflow::EncodeVariant<tensorflow::data::CompressedElement>(tensorflow::data::CompressedElement const&, std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> >*))
>>> referenced 287 more times

ld.lld: error: undefined symbol: google::protobuf::MessageLite::SerializeToString(std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> >*) const
>>> referenced by compression_utils.cc
>>>               bazel-out/android-arm64-v8a-opt/bin/tmp/_objs/custom_tensorflowlite_flex_flex_delegate_tensorflow_lib/compression_utils.pic.o:(void tensorflow::EncodeVariantImpl<tensorflow::data::CompressedElement>(tensorflow::data::CompressedElement const&, tensorflow::TypeResolver<tensorflow::data::CompressedElement, false, false, true>, tensorflow::VariantTensorData*))
>>> referenced by variant.cc
>>>               bazel-out/android-arm64-v8a-opt/bin/tensorflow/core/_objs/portable_tensorflow_lib_lite/variant.pic.o:(void tensorflow::EncodeVariant<tensorflow::VariantTensorDataProto>(tensorflow::VariantTensorDataProto const&, std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> >*))
>>> referenced by variant_tensor_data.cc
>>>               bazel-out/android-arm64-v8a-opt/bin/tensorflow/core/_objs/portable_tensorflow_lib_lite/variant_tensor_data.pic.o:(tensorflow::VariantTensorData::SerializeToString(std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> >*))
>>> referenced 3 more times

ld.lld: error: too many errors emitted, stopping now (use -error-limit=0 to see all errors)
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Target //tmp:tensorflow-lite-select-tf-ops failed to build
Use --verbose_failures to see the command lines of failed build steps.
INFO: Elapsed time: 8650.876s, Critical Path: 460.98s
INFO: 15523 processes: 346 internal, 15177 local.
FAILED: Build did NOT complete successfully` Hi @vitalii-vorobiov, we probably need to fix both but changing the source might make things unstable, we need to at least fix the original issue so I will say we will focus on that first (Though if you want to make a PR on your own we definitely won't stop you either)

Summary of reproduce steps:
```sh
git clone https://github.com/tensorflow/tensorflow.git
cd tensorflow
./configure
```
> For the ./configure action I only selected to configure ./WORKSPACE for Android builds. I've used NDK version 25.08775105, min Android NDK API level 21, Android SDK API level 34, and Android build tools version 34.0.0.

input model: [transformer_large.tflite.zip](https://github.com/tensorflow/tensorflow/files/14833872/transformer_large.tflite.zip)
```sh
bash tensorflow/lite/tools/build_aar.sh --input_models=<path/to/model> --target_archs=arm64-v8a
```
produces the above issues

Hi @terryheo, can you please take a look? Thanks. @pkgoogle thanks for looking into the issue. By the way, do you know what stable version (branch, commit hash) I can use in order to build select-tf-ops for both Android and IOS without any errors or issues? Hi @vitalii-vorobiov, I would try with r2.15 and go backwards until you have something stable... there may be some weird interactions with iOS and xcode if you go too far back though.
### Issue type

Build/Install

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

No

### Source

source

### TensorFlow version

TF 2.16.1

### Custom code

No

### OS platform and distribution

Ubuntu 20.04

### Mobile device

Android

### Python version

3.11

### Bazel version

_No response_

### GCC/compiler version

_No response_

### CUDA/cuDNN version

_No response_

### GPU model and memory

_No response_

### Current behavior?

Getting build errors when building tensorflow lite 2.16.

```
ERROR: /host_dir/tensorflow-2.16.1/tmp/BUILD:19:28: Linking tmp/libtensorflowlite_flex_jni.so failed: (Exit 1): clang failed: error executing command (from target //tmp:libtensorflowlite_flex_jni.so) external/androidndk/toolchains/llvm/prebuilt/linux-x86_64/bin/clang @bazel-out/android-armeabi-v7a-opt/bin/tmp/libtensorflowlite_flex_jni.so-2.params
ld.lld: error: undefined symbol: google::protobuf::Message::DebugString() const
>>> referenced by function_ops.cc
>>>               bazel-out/android-armeabi-v7a-opt/bin/tmp/_objs/custom_tensorflowlite_flex_flex_delegate_tensorflow_lib/0/function_ops.pic.o:(std::__ndk1::__function::__func<tensorflow::$_0, std::__ndk1::allocator<tensorflow::$_0>, absl::lts_20230802::Status (tensorflow::shape_inference::InferenceContext*)>::operator()(tensorflow::shape_inference::InferenceContext*&&))
>>> referenced by function_ops.cc
>>>               bazel-out/android-armeabi-v7a-opt/bin/tmp/_objs/custom_tensorflowlite_flex_flex_delegate_tensorflow_lib/0/function_ops.pic.o:(std::__ndk1::__function::__func<tensorflow::$_0, std::__ndk1::allocator<tensorflow::$_0>, absl::lts_20230802::Status (tensorflow::shape_inference::InferenceContext*)>::operator()(tensorflow::shape_inference::InferenceContext*&&))
>>> referenced by function_ops.cc
>>>               bazel-out/android-armeabi-v7a-opt/bin/tmp/_objs/custom_tensorflowlite_flex_flex_delegate_tensorflow_lib/0/function_ops.pic.o:(std::__ndk1::__function::__func<tensorflow::$_0, std::__ndk1::allocator<tensorflow::$_0>, absl::lts_20230802::Status (tensorflow::shape_inference::InferenceContext*)>::operator()(tensorflow::shape_inference::InferenceContext*&&))
>>> referenced 36 more times

ld.lld: error: undefined symbol: google::protobuf::internal::kGlobalEmptyTable
>>> referenced by partitioned_function_ops.cc
>>>               bazel-out/android-armeabi-v7a-opt/bin/tmp/_objs/custom_tensorflowlite_flex_flex_delegate_tensorflow_lib/partitioned_function_ops.pic.o:(google::protobuf::Map<std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> >, tensorflow::AttrValue>::Map(google::protobuf::Map<std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> >, tensorflow::AttrValue> const&))
>>> referenced by optimized_function_graph_info.cc
>>>               bazel-out/android-armeabi-v7a-opt/bin/tensorflow/core/_objs/portable_tensorflow_lib_lite/optimized_function_graph_info.pic.o:(google::protobuf::Map<std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> >, std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> > >::Map<std::__ndk1::__hash_map_const_iterator<std::__ndk1::__hash_const_iterator<std::__ndk1::__hash_node<std::__ndk1::__hash_value_type<std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> >, std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> > >, void*>*> > >(std::__ndk1::__hash_map_const_iterator<std::__ndk1::__hash_const_iterator<std::__ndk1::__hash_node<std::__ndk1::__hash_value_type<std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> >, std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> > >, void*>*> > const&, std::__ndk1::__hash_map_const_iterator<std::__ndk1::__hash_const_iterator<std::__ndk1::__hash_node<std::__ndk1::__hash_value_type<std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> >, std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> > >, void*>*> > const&))
>>> referenced by optimized_function_graph_info.cc
>>>               bazel-out/android-armeabi-v7a-opt/bin/tensorflow/core/_objs/portable_tensorflow_lib_lite/optimized_function_graph_info.pic.o:(google::protobuf::Map<std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> >, std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> > >::Map(google::protobuf::Map<std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> >, std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> > > const&))
>>> referenced 125 more times

ld.lld: error: undefined symbol: google::protobuf::Arena::AllocateAlignedWithHookForArray(unsigned int, std::type_info const*)
>>> referenced by partitioned_function_ops.cc
>>>               bazel-out/android-armeabi-v7a-opt/bin/tmp/_objs/custom_tensorflowlite_flex_flex_delegate_tensorflow_lib/partitioned_function_ops.pic.o:(google::protobuf::Arena::AllocateAlignedWithHookForArray(unsigned int, unsigned int, std::type_info const*))
>>> referenced by partitioned_function_ops.cc
>>>               bazel-out/android-armeabi-v7a-opt/bin/tmp/_objs/custom_tensorflowlite_flex_flex_delegate_tensorflow_lib/partitioned_function_ops.pic.o:(google::protobuf::Arena::AllocateAlignedWithHookForArray(unsigned int, unsigned int, std::type_info const*))
>>> referenced by kernel.cc
>>>               bazel-out/android-armeabi-v7a-opt/bin/tensorflow/lite/delegates/flex/_objs/delegate_only_runtime/kernel.pic.o:(std::__ndk1::pair<google::protobuf::Map<std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> >, tensorflow::AttrValue>::InnerMap::iterator_base<google::protobuf::MapPair<std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> >, tensorflow::AttrValue> >, bool> google::protobuf::Map<std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> >, tensorflow::AttrValue>::InnerMap::TryEmplaceInternal<char const (&) [25]>(char const (&) [25]))

ld.lld: error: undefined symbol: google::protobuf::internal::ThreadSafeArena::AddCleanup(void*, void (*)(void*))
>>> referenced by partitioned_function_ops.cc
>>>               bazel-out/android-armeabi-v7a-opt/bin/tmp/_objs/custom_tensorflowlite_flex_flex_delegate_tensorflow_lib/partitioned_function_ops.pic.o:(void google::protobuf::Arena::RegisterDestructorInternal<std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> > >(std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> >*, google::protobuf::Arena*, std::__ndk1::integral_constant<bool, false>))
>>> referenced by kernel.cc
>>>               bazel-out/android-armeabi-v7a-opt/bin/tensorflow/lite/delegates/flex/_objs/delegate_only_runtime/kernel.pic.o:(std::__ndk1::pair<google::protobuf::Map<std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> >, tensorflow::AttrValue>::InnerMap::iterator_base<google::protobuf::MapPair<std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> >, tensorflow::AttrValue> >, bool> google::protobuf::Map<std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> >, tensorflow::AttrValue>::InnerMap::TryEmplaceInternal<char const (&) [25]>(char const (&) [25]))
>>> referenced by feature.pb.cc
>>>               bazel-out/android-armeabi-v7a-opt/bin/tensorflow/core/example/_objs/example_protos_cc_impl/feature.pb.pic.o:(tensorflow::Features::Features(google::protobuf::Arena*, bool))
>>> referenced 71 more times

ld.lld: error: undefined symbol: google::protobuf::Arena::AllocateAlignedWithCleanup(unsigned int, std::type_info const*)
>>> referenced by partitioned_function_ops.cc
>>>               bazel-out/android-armeabi-v7a-opt/bin/tmp/_objs/custom_tensorflowlite_flex_flex_delegate_tensorflow_lib/partitioned_function_ops.pic.o:(google::protobuf::Map<std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> >, tensorflow::AttrValue>::InnerMap::TreeConvert(unsigned int))
>>> referenced by feature_util.cc
>>>               bazel-out/android-armeabi-v7a-opt/bin/tensorflow/core/_objs/portable_tensorflow_lib_lite/feature_util.pic.o:(google::protobuf::Map<std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> >, tensorflow::Feature>::InnerMap::TreeConvert(unsigned int))
>>> referenced by function.cc
>>>               bazel-out/android-armeabi-v7a-opt/bin/tensorflow/core/_objs/portable_tensorflow_lib_lite/0/function.pic.o:(google::protobuf::internal::StringTypeHandler::New(google::protobuf::Arena*, std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> >&&))
>>> referenced 59 more times

ld.lld: error: undefined symbol: google::protobuf::internal::RepeatedPtrFieldBase::AddOutOfLineHelper(void*)
>>> referenced by save_restore_tensor.cc
>>>               bazel-out/android-armeabi-v7a-opt/bin/tmp/_objs/custom_tensorflowlite_flex_flex_delegate_tensorflow_lib/save_restore_tensor.pic.o:(google::protobuf::RepeatedPtrField<tensorflow::SavedSliceMeta>::TypeHandler::Type* google::protobuf::internal::RepeatedPtrFieldBase::Add<google::protobuf::RepeatedPtrField<tensorflow::SavedSliceMeta>::TypeHandler>(google::protobuf::RepeatedPtrField<tensorflow::SavedSliceMeta>::TypeHandler::Type const*))
>>> referenced by save_restore_tensor.cc
>>>               bazel-out/android-armeabi-v7a-opt/bin/tmp/_objs/custom_tensorflowlite_flex_flex_delegate_tensorflow_lib/save_restore_tensor.pic.o:(google::protobuf::RepeatedPtrField<tensorflow::TensorSliceProto>::TypeHandler::Type* google::protobuf::internal::RepeatedPtrFieldBase::Add<google::protobuf::RepeatedPtrField<tensorflow::TensorSliceProto>::TypeHandler>(google::protobuf::RepeatedPtrField<tensorflow::TensorSliceProto>::TypeHandler::Type const*))
>>> referenced by compression_utils.cc
>>>               bazel-out/android-armeabi-v7a-opt/bin/tmp/_objs/custom_tensorflowlite_flex_flex_delegate_tensorflow_lib/compression_utils.pic.o:(google::protobuf::RepeatedPtrField<tensorflow::data::CompressedComponentMetadata>::TypeHandler::Type* google::protobuf::internal::RepeatedPtrFieldBase::Add<google::protobuf::RepeatedPtrField<tensorflow::data::CompressedComponentMetadata>::TypeHandler>(google::protobuf::RepeatedPtrField<tensorflow::data::CompressedComponentMetadata>::TypeHandler::Type const*))
>>> referenced 85 more times

ld.lld: error: undefined symbol: google::protobuf::RepeatedField<unsigned long long>::Reserve(int)
>>> referenced by save_restore_tensor.cc
>>>               bazel-out/android-armeabi-v7a-opt/bin/tmp/_objs/custom_tensorflowlite_flex_flex_delegate_tensorflow_lib/save_restore_tensor.pic.o:(void google::protobuf::RepeatedField<unsigned long long>::Add<unsigned long long const*>(unsigned long long const*, unsigned long long const*))
>>> referenced by save_restore_tensor.cc
>>>               bazel-out/android-armeabi-v7a-opt/bin/tmp/_objs/custom_tensorflowlite_flex_flex_delegate_tensorflow_lib/save_restore_tensor.pic.o:(google::protobuf::RepeatedField<unsigned long long>::FastAdderImpl<0, true>::Add(unsigned long long))

ld.lld: error: undefined symbol: google::protobuf::RepeatedField<long long>::Reserve(int)
>>> referenced by save_restore_tensor.cc
>>>               bazel-out/android-armeabi-v7a-opt/bin/tmp/_objs/custom_tensorflowlite_flex_flex_delegate_tensorflow_lib/save_restore_tensor.pic.o:(void google::protobuf::RepeatedField<long long>::Add<long long const*>(long long const*, long long const*))
>>> referenced by save_restore_tensor.cc
>>>               bazel-out/android-armeabi-v7a-opt/bin/tmp/_objs/custom_tensorflowlite_flex_flex_delegate_tensorflow_lib/save_restore_tensor.pic.o:(google::protobuf::RepeatedField<long long>::FastAdderImpl<0, true>::Add(long long))

ld.lld: error: undefined symbol: google::protobuf::RepeatedField<unsigned int>::Reserve(int)
>>> referenced by save_restore_tensor.cc
>>>               bazel-out/android-armeabi-v7a-opt/bin/tmp/_objs/custom_tensorflowlite_flex_flex_delegate_tensorflow_lib/save_restore_tensor.pic.o:(void google::protobuf::RepeatedField<unsigned int>::Add<unsigned int const*>(unsigned int const*, unsigned int const*))
>>> referenced by save_restore_tensor.cc
>>>               bazel-out/android-armeabi-v7a-opt/bin/tmp/_objs/custom_tensorflowlite_flex_flex_delegate_tensorflow_lib/save_restore_tensor.pic.o:(google::protobuf::RepeatedField<unsigned int>::FastAdderImpl<0, true>::Add(unsigned int))

ld.lld: error: undefined symbol: google::protobuf::RepeatedField<int>::Reserve(int)
>>> referenced by save_restore_tensor.cc
>>>               bazel-out/android-armeabi-v7a-opt/bin/tmp/_objs/custom_tensorflowlite_flex_flex_delegate_tensorflow_lib/save_restore_tensor.pic.o:(void google::protobuf::RepeatedField<int>::Add<unsigned short const*>(unsigned short const*, unsigned short const*))
>>> referenced by save_restore_tensor.cc
>>>               bazel-out/android-armeabi-v7a-opt/bin/tmp/_objs/custom_tensorflowlite_flex_flex_delegate_tensorflow_lib/save_restore_tensor.pic.o:(google::protobuf::RepeatedField<int>::FastAdderImpl<0, true>::Add(int))
>>> referenced by save_restore_tensor.cc
>>>               bazel-out/android-armeabi-v7a-opt/bin/tmp/_objs/custom_tensorflowlite_flex_flex_delegate_tensorflow_lib/save_restore_tensor.pic.o:(void google::protobuf::RepeatedField<int>::Add<short const*>(short const*, short const*))
>>> referenced 8 more times

ld.lld: error: undefined symbol: google::protobuf::RepeatedField<float>::Reserve(int)
>>> referenced by save_restore_tensor.cc
>>>               bazel-out/android-armeabi-v7a-opt/bin/tmp/_objs/custom_tensorflowlite_flex_flex_delegate_tensorflow_lib/save_restore_tensor.pic.o:(void google::protobuf::RepeatedField<float>::Add<float const*>(float const*, float const*))
>>> referenced by save_restore_tensor.cc
>>>               bazel-out/android-armeabi-v7a-opt/bin/tmp/_objs/custom_tensorflowlite_flex_flex_delegate_tensorflow_lib/save_restore_tensor.pic.o:(google::protobuf::RepeatedField<float>::FastAdderImpl<0, true>::Add(float))

ld.lld: error: undefined symbol: google::protobuf::RepeatedField<double>::Reserve(int)
>>> referenced by save_restore_tensor.cc
>>>               bazel-out/android-armeabi-v7a-opt/bin/tmp/_objs/custom_tensorflowlite_flex_flex_delegate_tensorflow_lib/save_restore_tensor.pic.o:(void google::protobuf::RepeatedField<double>::Add<double const*>(double const*, double const*))
>>> referenced by save_restore_tensor.cc
>>>               bazel-out/android-armeabi-v7a-opt/bin/tmp/_objs/custom_tensorflowlite_flex_flex_delegate_tensorflow_lib/save_restore_tensor.pic.o:(google::protobuf::RepeatedField<double>::FastAdderImpl<0, true>::Add(double))

ld.lld: error: undefined symbol: google::protobuf::RepeatedField<bool>::Reserve(int)
>>> referenced by save_restore_tensor.cc
>>>               bazel-out/android-armeabi-v7a-opt/bin/tmp/_objs/custom_tensorflowlite_flex_flex_delegate_tensorflow_lib/save_restore_tensor.pic.o:(void google::protobuf::RepeatedField<bool>::Add<bool const*>(bool const*, bool const*))
>>> referenced by save_restore_tensor.cc
>>>               bazel-out/android-armeabi-v7a-opt/bin/tmp/_objs/custom_tensorflowlite_flex_flex_delegate_tensorflow_lib/save_restore_tensor.pic.o:(google::protobuf::RepeatedField<bool>::FastAdderImpl<0, true>::Add(bool))

ld.lld: error: undefined symbol: google::protobuf::MessageLite::AppendToString(std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> >*) const
>>> referenced by tensor_list.cc
>>>               bazel-out/android-armeabi-v7a-opt/bin/tmp/_objs/custom_tensorflowlite_flex_flex_delegate_tensorflow_lib/tensor_list.pic.o:(tensorflow::TensorList::Encode(tensorflow::VariantTensorData*) const)
>>> referenced by tensor_coding.cc
>>>               bazel-out/android-armeabi-v7a-opt/bin/tensorflow/core/_objs/portable_tensorflow_lib_lite/tensor_coding.pic.o:(tensorflow::port::StringListEncoderImpl::Append(google::protobuf::MessageLite const&))

ld.lld: error: undefined symbol: google::protobuf::MessageLite::ParseFromString(std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> > const&)
>>> referenced by tensor_list.cc
>>>               bazel-out/android-armeabi-v7a-opt/bin/tmp/_objs/custom_tensorflowlite_flex_flex_delegate_tensorflow_lib/tensor_list.pic.o:(tensorflow::TensorList::Decode(tensorflow::VariantTensorData const&))
>>> referenced by compression_utils.cc
>>>               bazel-out/android-armeabi-v7a-opt/bin/tmp/_objs/custom_tensorflowlite_flex_flex_delegate_tensorflow_lib/compression_utils.pic.o:(tensorflow::data::UncompressElement(tensorflow::data::CompressedElement const&, std::__ndk1::vector<tensorflow::Tensor, std::__ndk1::allocator<tensorflow::Tensor> >*))
>>> referenced by compression_utils.cc
>>>               bazel-out/android-armeabi-v7a-opt/bin/tmp/_objs/custom_tensorflowlite_flex_flex_delegate_tensorflow_lib/compression_utils.pic.o:(bool tensorflow::DecodeVariantImpl<tensorflow::data::CompressedElement>(tensorflow::VariantTensorData, tensorflow::TypeResolver<tensorflow::data::CompressedElement, false, false, true>, tensorflow::data::CompressedElement*))
>>> referenced 11 more times

ld.lld: error: undefined symbol: google::protobuf::MessageLite::SerializeToArray(void*, int) const
>>> referenced by compression_utils.cc
>>>               bazel-out/android-armeabi-v7a-opt/bin/tmp/_objs/custom_tensorflowlite_flex_flex_delegate_tensorflow_lib/compression_utils.pic.o:(tensorflow::data::CompressElement(std::__ndk1::vector<tensorflow::Tensor, std::__ndk1::allocator<tensorflow::Tensor> > const&, tensorflow::data::CompressedElement*))

ld.lld: error: undefined symbol: google::protobuf::RepeatedField<unsigned long long>::Add(unsigned long long const&)
>>> referenced by compression_utils.cc
>>>               bazel-out/android-armeabi-v7a-opt/bin/tmp/_objs/custom_tensorflowlite_flex_flex_delegate_tensorflow_lib/compression_utils.pic.o:(tensorflow::data::CompressedComponentMetadata::_internal_add_uncompressed_bytes(unsigned long long))
>>> referenced by tensor.pb_text.cc
>>>               bazel-out/android-armeabi-v7a-opt/bin/tensorflow/core/_objs/portable_tensorflow_lib_lite/tensor.pb_text.pic.o:(tensorflow::TensorProto::_internal_add_uint64_val(unsigned long long))
>>> referenced by graph_debug_info_builder.cc
>>>               bazel-out/android-armeabi-v7a-opt/bin/tensorflow/core/_objs/portable_tensorflow_lib_lite/graph_debug_info_builder.pic.o:(tensorflow::GraphDebugInfo_StackTrace::_internal_add_frame_id(unsigned long long))
>>> referenced 1 more times

ld.lld: error: undefined symbol: google::protobuf::internal::ArenaStringPtr::Mutable(google::protobuf::Arena*)
>>> referenced by compression_utils.cc
>>>               bazel-out/android-armeabi-v7a-opt/bin/tmp/_objs/custom_tensorflowlite_flex_flex_delegate_tensorflow_lib/compression_utils.pic.o:(tensorflow::data::CompressedElement::_internal_mutable_data())
>>> referenced by dataset_utils.cc
>>>               bazel-out/android-armeabi-v7a-opt/bin/tmp/_objs/custom_tensorflowlite_flex_flex_delegate_tensorflow_lib/dataset_utils.pic.o:(tensorflow::NodeDef::_internal_mutable_device())
>>> referenced by attr_value.pb_text.cc
>>>               bazel-out/android-armeabi-v7a-opt/bin/tensorflow/core/_objs/portable_tensorflow_lib_lite/attr_value.pb_text.pic.o:(tensorflow::AttrValue::_internal_mutable_s())
>>> referenced 66 more times

ld.lld: error: undefined symbol: google::protobuf::Message::GetTypeName() const
>>> referenced by compression_utils.cc
>>>               bazel-out/android-armeabi-v7a-opt/bin/tmp/_objs/custom_tensorflowlite_flex_flex_delegate_tensorflow_lib/compression_utils.pic.o:(tensorflow::Variant::Value<tensorflow::data::CompressedElement>::TypeName() const)
>>> referenced by compression_utils.cc
>>>               bazel-out/android-armeabi-v7a-opt/bin/tmp/_objs/custom_tensorflowlite_flex_flex_delegate_tensorflow_lib/compression_utils.pic.o:(void tensorflow::EncodeVariant<tensorflow::data::CompressedElement>(tensorflow::data::CompressedElement const&, tensorflow::VariantTensorData*))
>>> referenced by compression_utils.cc
>>>               bazel-out/android-armeabi-v7a-opt/bin/tmp/_objs/custom_tensorflowlite_flex_flex_delegate_tensorflow_lib/compression_utils.pic.o:(void tensorflow::EncodeVariant<tensorflow::data::CompressedElement>(tensorflow::data::CompressedElement const&, std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> >*))
>>> referenced 290 more times

ld.lld: error: undefined symbol: google::protobuf::MessageLite::SerializeToString(std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> >*) const
>>> referenced by compression_utils.cc
>>>               bazel-out/android-armeabi-v7a-opt/bin/tmp/_objs/custom_tensorflowlite_flex_flex_delegate_tensorflow_lib/compression_utils.pic.o:(void tensorflow::EncodeVariantImpl<tensorflow::data::CompressedElement>(tensorflow::data::CompressedElement const&, tensorflow::TypeResolver<tensorflow::data::CompressedElement, false, false, true>, tensorflow::VariantTensorData*))
>>> referenced by variant.cc
>>>               bazel-out/android-armeabi-v7a-opt/bin/tensorflow/core/_objs/portable_tensorflow_lib_lite/variant.pic.o:(.text._ZN10tensorflow13EncodeVariantINS_22VariantTensorDataProtoEEEvRKT_PNSt6__ndk112basic_stringIcNS5_11char_traitsIcEENS5_9allocatorIcEEEE+0x0)
>>> referenced by variant_tensor_data.cc
>>>               bazel-out/android-armeabi-v7a-opt/bin/tensorflow/core/_objs/portable_tensorflow_lib_lite/variant_tensor_data.pic.o:(tensorflow::VariantTensorData::SerializeToString(std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> >*))
>>> referenced 3 more times

ld.lld: error: too many errors emitted, stopping now (use -error-limit=0 to see all errors)
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Target //tmp:tensorflow-lite-select-tf-ops failed to build
Use --verbose_failures to see the command lines of failed build steps.
INFO: Elapsed time: 1652.863s, Critical Path: 470.96s
INFO: 17918 processes: 1284 internal, 16634 local.
FAILED: Build did NOT complete successfully
```

### Standalone code to reproduce the issue

```shell
- Using docker setup from this tutorial https://www.tensorflow.org/lite/android/lite_build

wget https://github.com/tensorflow/tensorflow/archive/refs/tags/v2.16.1.zip
unzip v2.16.1.zip
cd tensorflow-v2.16.1/tensorflow/lite/tools
docker build . -t tflite-builder -f tflite-android.Dockerfile
cd ../../../
docker run -it -v $PWD:/host_dir tflite-builder bash
sdkmanager \
  "build-tools;${ANDROID_BUILD_TOOLS_VERSION}" \
  "platform-tools" \
  "platforms;android-${ANDROID_API_LEVEL}"
./configure
tensorflow/lite/tools/build_aar.sh \
  --input_models=/host_dir/model.tflite \
   --target_archs=arm64-v8a,armeabi-v7a
```
```


### Relevant log output

_No response_