flatc Errno 8 Exec format error when building for android
I've tried building with `bazel build -c opt //tensorflow/lite:libtensorflowlite.so --fat_apk_cpu=arm64-v8a` but now it says `<path to .so> is not compatible with aarch64linux` . I couldn't build with `bazel build -c opt //tensorflow/lite:libtensorflowlite.so --cpu=arm64-v8a` because I got `cc_toolchain_suite rule @local_config_cc//:toolchain: cc_toolchain_suite '@local_config_cc//:toolchain' does not contain a toolchain for cpu 'arm64-v8a'` error. Hi @turgut-baba, Please find the latest official pre release of TF v2.12 [here](https://github.com/tensorflow/tensorflow/tree/v2.12.0-rc0) and confirm if you are trying with the same source. Thank you!  I've deleted all the files, git clone again, checkout to the branch you linked, did everything the same, same result. Thank you for the update @turgut-baba. It seems like we have to dig more into this issue, we will update soon here. Thanks!   Also, I've opened another issue tackling more stuff I've tried: https://github.com/tensorflow/tensorflow/issues/59692 Hi, @pjpratik 

Could you please look into this issue ? Hi @turgut-baba, sorry for delayed response.

As suggested [here](https://github.com/tensorflow/tensorflow/issues/59692#issuecomment-1451090438), can you please build on latest stable branch 2.11 and let us know if the issue still persists.

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

<details><summary>Click to expand!</summary> 
 
 ### Issue Type

Build/Install

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

No

### Source

source

### Tensorflow Version

2.12

### Custom Code

Yes

### OS Platform and Distribution

Debian 11 

### Mobile device

Android 

### Python version

3.9.2

### Bazel version

6.0.0

### GCC/Compiler version

10.2.1

### CUDA/cuDNN version

_No response_

### GPU model and memory

nvidia 

### Current Behaviour?

```shell
I have a c++ code base that can be used on different applications with different UI's. Currently I've run the Build with CMake example on the documentation and it worked on my linux debian machine. However I want to build tflite for android devices too so I tried the "Specifics of Android cross-compilation" part with NDK 25.0.8775105 as my path provided. It eventually did finish the cmake run.
```


### Standalone code to reproduce the issue

```shell
After that I've tried running `cmake --build .` which caused me to get an error regarding `OSError: [Errno 8] Exec format error:` I can see that it's trying to find something like `#!/bin/sh` but I cannot add it since flatc is produced and deleted during the cmake run.
```


### Relevant log output

```shell
[ 21%] Built target flathash
[ 21%] Linking CXX executable flatc
Running scripts/generate_code.py...
Traceback (most recent call last):
  File "/home/tb/Desktop/tensorflow/tflite_android_build/flatbuffers/scripts/generate_code.py", line 148, in <module>
    flatc(
  File "/home/tb/Desktop/tensorflow/tflite_android_build/flatbuffers/scripts/generate_code.py", line 82, in flatc
    result = subprocess.run(cmd, cwd=str(cwd), check=True)
  File "/usr/lib/python3.9/subprocess.py", line 505, in run
    with Popen(*popenargs, **kwargs) as process:
  File "/usr/lib/python3.9/subprocess.py", line 951, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "/usr/lib/python3.9/subprocess.py", line 1823, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
OSError: [Errno 8] Exec format error: '/home/tb/Desktop/tensorflow/tflite_android_build/_deps/flatbuffers-build/flatc'
gmake[2]: *** [_deps/flatbuffers-build/CMakeFiles/flatc.dir/build.make:540: _deps/flatbuffers-build/flatc] Error 1
gmake[2]: *** Deleting file '_deps/flatbuffers-build/flatc'
gmake[1]: *** [CMakeFiles/Makefile2:4987: _deps/flatbuffers-build/CMakeFiles/flatc.dir/all] Error 2
gmake: *** [Makefile:149: all] Error 2
```
</details>