Bazel cross compile

I want to build benchmark with flex delegate
then I found this command

bazel build -c opt \
  --config=monolithic \
  tensorflow/lite/tools/benchmark:benchmark_model_plus_flex

but the error “non executable 64-bit ELF file” on android

I should cross compile to build in arm64 format which is used in android
anybody know how to build benchmark with flex delegate which can be run on android?
please help!

@rita19991020,

Could you please try following command and let us know?

bazel build -c opt \
  --config=monolithic,android_arm64 \
  tensorflow/lite/tools/benchmark:benchmark_model_plus_flex

or

bazel build -c opt \
  --config=android_arm64 \
  tensorflow/lite/tools/benchmark:benchmark_model_plus_flex

Thank you!

hi
thanks for apply!
but it doesn’t work…

Which Android target do you want to use?
Most recent Android devices are ARM64, but some devices could be ARM32 or even x86 (for emulator)
Depending on the target, you need to add

  • –config=android_arm64
  • –config=android_arm
  • –config=android_x86

For ARM64, the following command will work.

$ bazel build -c opt
–config=monolithic --config=android_arm64
tensorflow/lite/tools/benchmark:benchmark_model_plus_flex

If it doesn’t work, please get back with how it doesn’t work.

1 Like