tensorflow / tensorflow/tensorflow

use ''build_aar.sh" to generate the tensorflow-lite.aar failure

Open
#93,520 2 comments 0 reactions 1 assignee View on GitHub

@aravindmurali22 is already working on this.

Since Dec 26, 2025.

type:build/install
Dominant language
C++
Stars
200k
Forks
76.9k
Avg merge
2d 3h
Merged PRs (30d)
433

Description

Issue type

Build/Install

Have you reproduced the bug with TensorFlow Nightly?

No

Source

source

TensorFlow version

2.19.0

Custom code

Yes

OS platform and distribution

Ubuntu 22.04 LTS

Mobile device

No response

Python version

3.10.12

Bazel version

6.5.0

GCC/compiler version

No response

CUDA/cuDNN version

No response

GPU model and memory

No response

Current behavior?

build success and generate the tensorflow-lite.aar file and the tensorflow-lite-select-tf-ops.aar file

Standalone code to reproduce the issue
root@parallels-Parallels-Virtual-Platform:/tensorflow-2.19.0# bash tensorflow/lite/tools/build_aar.sh  --input_models=model/walletBillModel.tflite --target_archs=arm64-v8a,armeabi-v7a
+++ dirname tensorflow/lite/tools/build_aar.sh
Relevant log output
root@parallels-Parallels-Virtual-Platform:/tensorflow-2.19.0# bash tensorflow/lite/tools/build_aar.sh  --input_models=model/walletBillModel.tflite --target_archs=arm64-v8a,armeabi-v7a
+++ dirname tensorflow/lite/tools/build_aar.sh
++ cd tensorflow/lite/tools
++ pwd
+ SCRIPT_DIR=/tensorflow-2.19.0/tensorflow/lite/tools
++ cd /tensorflow-2.19.0/tensorflow/lite/tools/../../../
++ pwd
+ ROOT_DIR=/tensorflow-2.19.0
+ TARGET_ARCHS=x86,x86_64,arm64-v8a,armeabi-v7a
+ '[' '!' -z ']'
+ '[' 2 -gt 4 ']'
+ for i in "$@"
+ case $i in
+ FLAG_MODELS=model/walletBillModel.tflite
+ shift
+ for i in "$@"
+ case $i in
+ TARGET_ARCHS=arm64-v8a,armeabi-v7a
+ shift
+ cd /tensorflow-2.19.0
+ '[' '!' -f /tensorflow-2.19.0/.tf_configure.bazelrc ']'
+ grep -q ANDROID_SDK_HOME /tensorflow-2.19.0/.tf_configure.bazelrc
+ '[' -z model/walletBillModel.tflite ']'
+ TMP_DIR=/tensorflow-2.19.0/tmp/
+ rm -rf /tensorflow-2.19.0/tmp/
+ mkdir -p /tensorflow-2.19.0/tmp/
+ MODEL_NAMES=
++ echo model/walletBillModel.tflite
++ sed 's/,/ /g'
+ for model in $(echo ${FLAG_MODELS} | sed "s/,/ /g")
+ cp model/walletBillModel.tflite /tensorflow-2.19.0/tmp/
++ basename model/walletBillModel.tflite
+ MODEL_NAMES=,walletBillModel.tflite
+ TFLITE_OPS_SRCS=
++ echo
++ sed 's/,/ /g'
+ generate_tflite_aar
+ pushd /tensorflow-2.19.0/tmp/
+ message=('load("//tensorflow/lite:build_def.bzl", "tflite_custom_android_library")' 'load("//tensorflow/lite/java:aar_with_jni.bzl", "aar_with_jni")' '' 'tflite_custom_android_library(' '    name = "custom_tensorflowlite",')
+ message+=('    '$(generate_list_field "models" $MODEL_NAMES))
++ generate_list_field models ,walletBillModel.tflite
++ local name=models
++ local list_string=,walletBillModel.tflite
++ list=('walletBillModel.tflite')
++ local list
++ message=('models=[')
++ local message
++ for item in "${list[@]}"
++ message+=("\"$item\",")
++ message+=('],')
++ printf %s 'models=[' '"walletBillModel.tflite",' '],'
+ message+=('    '$(generate_list_field "srcs" $TFLITE_OPS_SRCS))
++ generate_list_field srcs
++ local name=srcs
++ local list_string=
++ list=()
++ local list
++ message=('srcs=[')
++ local message
++ message+=('],')
++ printf %s 'srcs=[' '],'
+ message+=('    '$(generate_list_field "deps" $FLAG_TFLITE_OPS_DEPS))
++ generate_list_field deps
++ local name=deps
++ local list_string=
++ list=()
++ local list
++ message=('deps=[')
++ local message
++ message+=('],')
++ printf %s 'deps=[' '],'
+ message+=(')' '' 'aar_with_jni(' '    name = "tensorflow-lite",' '    android_library = ":custom_tensorflowlite",' ')' '')
+ printf '%s\n' 'load("//tensorflow/lite:build_def.bzl", "tflite_custom_android_library")' 'load("//tensorflow/lite/java:aar_with_jni.bzl", "aar_with_jni")' '' 'tflite_custom_android_library(' '    name = "custom_tensorflowlite",' '    models=["walletBillModel.tflite",],' '    srcs=[],' '    deps=[],' ')' '' 'aar_with_jni(' '    name = "tensorflow-lite",' '    android_library = ":custom_tensorflowlite",' ')' ''
+ popd
+ bazel build -c opt --config=opt --cxxopt=--std=c++17 --fat_apk_cpu=arm64-v8a,armeabi-v7a --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 /tensorflow-2.19.0/.bazelrc: --windows_enable_symlinks
INFO: Options provided by the client:
  Inherited 'common' options: --isatty=1 --terminal_columns=157
INFO: Reading rc options for 'build' from /tensorflow-2.19.0/.bazelrc:
  Inherited 'common' options: --experimental_repo_remote_exec
INFO: Reading rc options for 'build' from /tensorflow-2.19.0/.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 --experimental_cc_shared_library --experimental_link_static_libraries_once=false --incompatible_enforce_config_setting_visibility
INFO: Reading rc options for 'build' from /tensorflow-2.19.0/.tf_configure.bazelrc:
  'build' options: --action_env PYTHON_BIN_PATH=/usr/bin/python3 --action_env PYTHON_LIB_PATH=/usr/lib/python3/dist-packages --python_path=/usr/bin/python3 --action_env ANDROID_NDK_HOME=/android/ndk --action_env ANDROID_NDK_VERSION=25 --action_env ANDROID_NDK_API_LEVEL=30 --action_env ANDROID_BUILD_TOOLS_VERSION=31.0.0 --action_env ANDROID_SDK_API_LEVEL=30 --action_env ANDROID_SDK_HOME=/android/sdk
INFO: Found applicable config definition build:short_logs in file /tensorflow-2.19.0/.bazelrc: --output_filter=DONT_MATCH_ANYTHING
INFO: Found applicable config definition build:v2 in file /tensorflow-2.19.0/.bazelrc: --define=tf_api_version=2 --action_env=TF2_BEHAVIOR=1
INFO: Found applicable config definition build:opt in file /tensorflow-2.19.0/.tf_configure.bazelrc: --copt=-Wno-sign-compare --host_copt=-Wno-sign-compare
INFO: Found applicable config definition build:linux in file /tensorflow-2.19.0/.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 --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 /tensorflow-2.19.0/.bazelrc: --define=dynamic_loaded_kernels=true --copt=-DAUTOLOAD_DYNAMIC_KERNELS
INFO: Build option --fat_apk_cpu has changed, discarding analysis cache.
INFO: Analyzed target //tmp:tensorflow-lite (1 packages loaded, 15708 targets configured).
INFO: Found 1 target...
Target //tmp:tensorflow-lite up-to-date:
  bazel-bin/tmp/tensorflow-lite.aar
INFO: Elapsed time: 1112.653s, Critical Path: 80.66s
INFO: 1378 processes: 1 internal, 1377 local.
INFO: Build completed successfully, 1378 total actions
+ OUT_FILES=' bazel-bin/tmp/tensorflow-lite.aar'
+ bazel build -c opt --config=monolithic //tensorflow/lite/tools:list_flex_ops_no_kernel_main
INFO: Reading 'startup' options from /tensorflow-2.19.0/.bazelrc: --windows_enable_symlinks
INFO: Options provided by the client:
  Inherited 'common' options: --isatty=1 --terminal_columns=157
INFO: Reading rc options for 'build' from /tensorflow-2.19.0/.bazelrc:
  Inherited 'common' options: --experimental_repo_remote_exec
INFO: Reading rc options for 'build' from /tensorflow-2.19.0/.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 --experimental_cc_shared_library --experimental_link_static_libraries_once=false --incompatible_enforce_config_setting_visibility
INFO: Reading rc options for 'build' from /tensorflow-2.19.0/.tf_configure.bazelrc:
  'build' options: --action_env PYTHON_BIN_PATH=/usr/bin/python3 --action_env PYTHON_LIB_PATH=/usr/lib/python3/dist-packages --python_path=/usr/bin/python3 --action_env ANDROID_NDK_HOME=/android/ndk --action_env ANDROID_NDK_VERSION=25 --action_env ANDROID_NDK_API_LEVEL=30 --action_env ANDROID_BUILD_TOOLS_VERSION=31.0.0 --action_env ANDROID_SDK_API_LEVEL=30 --action_env ANDROID_SDK_HOME=/android/sdk
INFO: Found applicable config definition build:short_logs in file /tensorflow-2.19.0/.bazelrc: --output_filter=DONT_MATCH_ANYTHING
INFO: Found applicable config definition build:v2 in file /tensorflow-2.19.0/.bazelrc: --define=tf_api_version=2 --action_env=TF2_BEHAVIOR=1
INFO: Found applicable config definition build:monolithic in file /tensorflow-2.19.0/.bazelrc: --define framework_shared_object=false --define tsl_protobuf_header_only=false --experimental_link_static_libraries_once=false
INFO: Found applicable config definition build:linux in file /tensorflow-2.19.0/.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 --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 /tensorflow-2.19.0/.bazelrc: --define=dynamic_loaded_kernels=true --copt=-DAUTOLOAD_DYNAMIC_KERNELS
INFO: Build options --copt, --cxxopt, --define, and 2 more have changed, discarding analysis cache.
INFO: Analyzed target //tensorflow/lite/tools:list_flex_ops_no_kernel_main (5 packages loaded, 1287 targets configured).
INFO: Found 1 target...
Target //tensorflow/lite/tools:list_flex_ops_no_kernel_main up-to-date:
  bazel-bin/tensorflow/lite/tools/list_flex_ops_no_kernel_main
INFO: Elapsed time: 122.614s, Critical Path: 45.26s
INFO: 46 processes: 1 internal, 45 local.
INFO: Build completed successfully, 46 total actions
+ bazel-bin/tensorflow/lite/tools/list_flex_ops_no_kernel_main --graphs=model/walletBillModel.tflite
++ cat /tensorflow-2.19.0/tmp//ops_list.txt
+ [[ ["TensorListReserve","TensorListSetItem","TensorListStack"] != \[\] ]]
+ generate_flex_aar
+ pushd /tensorflow-2.19.0/tmp/
/tensorflow-2.19.0/tmp /tensorflow-2.19.0
+ message=('load("//tensorflow/lite/delegates/flex:build_def.bzl", "tflite_flex_android_library")' 'load("//tensorflow/lite/java:aar_with_jni.bzl", "aar_with_jni")' '' 'tflite_flex_android_library(' '    name = "custom_tensorflowlite_flex",')
+ message+=('    '$(generate_list_field "models" $MODEL_NAMES))
++ generate_list_field models ,walletBillModel.tflite
++ local name=models
++ local list_string=,walletBillModel.tflite
++ list=('walletBillModel.tflite')
++ local list
++ message=('models=[')
++ local message
++ for item in "${list[@]}"
++ message+=("\"$item\",")
++ message+=('],')
++ printf %s 'models=[' '"walletBillModel.tflite",' '],'
+ message+=(')' '' 'aar_with_jni(' '    name = "tensorflow-lite-select-tf-ops",' '    android_library = ":custom_tensorflowlite_flex",' ')')
+ printf '%s\n' 'load("//tensorflow/lite/delegates/flex:build_def.bzl", "tflite_flex_android_library")' 'load("//tensorflow/lite/java:aar_with_jni.bzl", "aar_with_jni")' '' 'tflite_flex_android_library(' '    name = "custom_tensorflowlite_flex",' '    models=["walletBillModel.tflite",],' ')' '' 'aar_with_jni(' '    name = "tensorflow-lite-select-tf-ops",' '    android_library = ":custom_tensorflowlite_flex",' ')'
+ cp /tensorflow-2.19.0/tensorflow/lite/java/AndroidManifest.xml .
+ cp /tensorflow-2.19.0/tensorflow/lite/java/proguard.flags .
+ popd
/tensorflow-2.19.0
+ bazel build -c opt --config=opt --cxxopt=--std=c++17 --fat_apk_cpu=arm64-v8a,armeabi-v7a --define=android_dexmerger_tool=d8_dexmerger --define=android_incremental_dexing_tool=d8_dexbuilder --host_crosstool_top=@bazel_tools//tools/cpp:toolchain //tmp:tensorflow-lite-select-tf-ops
INFO: Reading 'startup' options from /tensorflow-2.19.0/.bazelrc: --windows_enable_symlinks
INFO: Options provided by the client:
  Inherited 'common' options: --isatty=1 --terminal_columns=157
INFO: Reading rc options for 'build' from /tensorflow-2.19.0/.bazelrc:
  Inherited 'common' options: --experimental_repo_remote_exec
INFO: Reading rc options for 'build' from /tensorflow-2.19.0/.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 --experimental_cc_shared_library --experimental_link_static_libraries_once=false --incompatible_enforce_config_setting_visibility
INFO: Reading rc options for 'build' from /tensorflow-2.19.0/.tf_configure.bazelrc:
  'build' options: --action_env PYTHON_BIN_PATH=/usr/bin/python3 --action_env PYTHON_LIB_PATH=/usr/lib/python3/dist-packages --python_path=/usr/bin/python3 --action_env ANDROID_NDK_HOME=/android/ndk --action_env ANDROID_NDK_VERSION=25 --action_env ANDROID_NDK_API_LEVEL=30 --action_env ANDROID_BUILD_TOOLS_VERSION=31.0.0 --action_env ANDROID_SDK_API_LEVEL=30 --action_env ANDROID_SDK_HOME=/android/sdk
INFO: Found applicable config definition build:short_logs in file /tensorflow-2.19.0/.bazelrc: --output_filter=DONT_MATCH_ANYTHING
INFO: Found applicable config definition build:v2 in file /tensorflow-2.19.0/.bazelrc: --define=tf_api_version=2 --action_env=TF2_BEHAVIOR=1
INFO: Found applicable config definition build:opt in file /tensorflow-2.19.0/.tf_configure.bazelrc: --copt=-Wno-sign-compare --host_copt=-Wno-sign-compare
INFO: Found applicable config definition build:linux in file /tensorflow-2.19.0/.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 --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 /tensorflow-2.19.0/.bazelrc: --define=dynamic_loaded_kernels=true --copt=-DAUTOLOAD_DYNAMIC_KERNELS
INFO: Build options --copt, --cxxopt, --define, and 2 more have changed, discarding analysis cache.
INFO: Analyzed target //tmp:tensorflow-lite-select-tf-ops (550 packages loaded, 55015 targets configured).
INFO: Found 1 target...
ERROR: /tensorflow-2.19.0/tensorflow/compiler/mlir/lite/BUILD:1306:11: Compiling tensorflow/compiler/mlir/lite/transforms/default_quant_params.cc [for tool] failed: (Exit 1): gcc failed: error executing command (from target //tensorflow/compiler/mlir/lite:tensorflow_lite_quantize) /usr/bin/gcc -U_FORTIFY_SOURCE -fstack-protector -Wall -Wunused-but-set-parameter -Wno-free-nonheap-object -fno-omit-frame-pointer -g0 -O2 '-D_FORTIFY_SOURCE=1' -DNDEBUG -ffunction-sections ... (remaining 206 arguments skipped)
In file included from /usr/include/c++/11/memory:76,
                 from tensorflow/compiler/mlir/lite/transforms/default_quant_params.cc:16:
/usr/include/c++/11/bits/unique_ptr.h: In instantiation of 'typename std::_MakeUniq<_Tp>::__single_object std::make_unique(_Args&& ...) [with _Tp = mlir::TFL::{anonymous}::DefaultQuantParamsPass; _Args = {const mlir::TFL::DefaultQuantParamsPassOptions&}; typename std::_MakeUniq<_Tp>::__single_object = std::unique_ptr<mlir::TFL::{anonymous}::DefaultQuantParamsPass, std::default_delete<mlir::TFL::{anonymous}::DefaultQuantParamsPass> >]':
tensorflow/compiler/mlir/lite/transforms/default_quant_params.cc:249:50:   required from here
/usr/include/c++/11/bits/unique_ptr.h:962:30: error: call of overloaded 'DefaultQuantParamsPass(const mlir::TFL::DefaultQuantParamsPassOptions&)' is ambiguous
  962 |     { return unique_ptr<_Tp>(new _Tp(std::forward<_Args>(__args)...)); }
      |                              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from tensorflow/compiler/mlir/lite/transforms/default_quant_params.cc:52:
bazel-out/k8-opt-exec-50AE0418/bin/tensorflow/compiler/mlir/lite/transforms/passes.h.inc:162:3: note: candidate: 'mlir::TFL::{anonymous}::impl::DefaultQuantParamsPassBase<DerivedT>::DefaultQuantParamsPassBase(mlir::TFL::DefaultQuantParamsPassOptions) [with DerivedT = mlir::TFL::{anonymous}::DefaultQuantParamsPass]'
  162 |   DefaultQuantParamsPassBase(DefaultQuantParamsPassOptions options) : DefaultQuantParamsPassBase() {
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~
tensorflow/compiler/mlir/lite/transforms/default_quant_params.cc:57:37: note:   inherited here
   57 |   using DefaultQuantParamsPassBase::DefaultQuantParamsPassBase;
      |                                     ^~~~~~~~~~~~~~~~~~~~~~~~~~
tensorflow/compiler/mlir/lite/transforms/default_quant_params.cc:66:12: note: candidate: 'mlir::TFL::{anonymous}::DefaultQuantParamsPass::DefaultQuantParamsPass(const mlir::TFL::DefaultQuantParamsPassOptions&)'
   66 |   explicit DefaultQuantParamsPass(
      |            ^~~~~~~~~~~~~~~~~~~~~~
tensorflow/compiler/mlir/lite/transforms/default_quant_params.cc:54:7: note: candidate: 'mlir::TFL::{anonymous}::DefaultQuantParamsPass::DefaultQuantParamsPass(const mlir::TFL::{anonymous}::DefaultQuantParamsPass&)'
   54 | class DefaultQuantParamsPass
      |       ^~~~~~~~~~~~~~~~~~~~~~
tensorflow/compiler/mlir/lite/transforms/default_quant_params.cc:54:7: note: candidate: 'mlir::TFL::{anonymous}::DefaultQuantParamsPass::DefaultQuantParamsPass(mlir::TFL::{anonymous}::DefaultQuantParamsPass&&)' (deleted)
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: 2270.665s, Critical Path: 132.12s
INFO: 1303 processes: 36 internal, 1267 local.
FAILED: Build did NOT complete successfully

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.