tensorflow: Multiple problems building TFLite 2.9.1

Click to expand!

Issue Type

Build/Install

Source

source

Tensorflow Version

2.9.1

Custom Code

No

OS Platform and Distribution

iOS

Mobile device

No response

Python version

No response

Bazel version

No response

GCC/Compiler version

No response

CUDA/cuDNN version

No response

GPU model and memory

No response

Current Behaviour?

1. tensorflow/lite/c/CMakeLists.txt references common.c. Actual file at the referenced location is common.cc
2. With default TFL_MINIMUM_OS_VERSION=9.0 in tensorflow/lite/ios/ios.bzl, there is a compile-time error in Eigen related to thread local storage. Need that value bumped to 10.0 or 11.0 by default.
3. Upon the successful completion of `bazel build --config=ios_fat -c opt //tensorflow/lite/ios:TensorFlowLiteC_static_framework`, the `bazel-bin` folder is empty. The output can be found in `bazel-out/applebin_ios-ios_armv7-opt-ST-5b7531beec20/bin/tensorflow/lite/ios/TensorFlowLiteC_static_framework.zip` instead
4. Why is the hard dependency on Bazel version? Why does it have to be 5.0.0 and can not be 5.1.1? This makes it very unfriendly for CI environment.

Standalone code to reproduce the issue

Just build it out of the box.

Relevant log output

INFO: Found 1 target...
Target //tensorflow/lite/ios:TensorFlowLiteC_static_framework up-to-date:
  bazel-out/applebin_ios-ios_armv7-opt-ST-5b7531beec20/bin/tensorflow/lite/ios/TensorFlowLiteC_static_framework.zip
INFO: Elapsed time: 0.280s, Critical Path: 0.00s
INFO: 1 process: 1 internal.
INFO: Build completed successfully, 1 total action

Compared to 2.7.1:

Target //tensorflow/lite/ios:TensorFlowLiteC_static_framework up-to-date:
  bazel-bin/tensorflow/lite/ios/TensorFlowLiteC_static_framework.zip
INFO: Elapsed time: 411.210s, Critical Path: 80.19s
INFO: 3901 processes: 227 internal, 3674 local.
INFO: Build completed successfully, 3901 total actions
INFO: Build completed successfully, 3901 total actions
</details>

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 16 (6 by maintainers)

Most upvoted comments

Here’s an example of symbols in 2.7.1 vs 2.9.1 resulting frameworks:

2.9.1:

$ nm ~/.conan/data/tensorflow-lite/2.9.1.16+329b4449/ci/branch_release_2.9/package/c59ee57fe12aba06c09eb42e8369b6b2d726a34b/lib/TensorFlowLiteCMetal.framework/TensorFlowLiteCMetal | grep absl
                 U __ZN4absl12lts_2021110212UnknownErrorENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE
                 U __ZN4absl12lts_2021110213DataLossErrorENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE
                 U __ZN4absl12lts_2021110213InternalErrorENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE
                 U __ZN4absl12lts_2021110213NotFoundErrorENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE
                 U __ZN4absl12lts_2021110216strings_internal9CatPiecesESt16initializer_listINSt3__117basic_string_viewIcNS3_11char_traitsIcEEEEE
                 U __ZN4absl12lts_2021110218UnimplementedErrorENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE
                 U __ZN4absl12lts_2021110219substitute_internal24SubstituteAndAppendArrayEPNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEENS2_17basic_string_viewIcS5_EEPKSB_m
                 U __ZN4absl12lts_2021110220InvalidArgumentErrorENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE
                 U __ZN4absl12lts_2021110222ResourceExhaustedErrorENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE
00000000002265eb s __ZZN4absl12lts_2021110218debugging_internalL30IdentifierIsAnonymousNamespaceEPNS1_5StateEiE11anon_prefix
0000000000226939 s __ZZN4absl12lts_202111029SymbolizeEPKvPciE9kEllipsis

2.7.1:

$ nm ~/.conan/data/tensorflow-lite/2.7.1.14+442738f3/ci/branch_release_2.7/package/3b95326f653baf403ae4d70dae74814d9c4fef8a/lib/TensorFlowLiteCMetal.framework/TensorFlowLiteCMetal | grep absl
00000000001f3e64 s __ZZN4absl12lts_2021032418debugging_internalL30IdentifierIsAnonymousNamespaceEPNS1_5StateEiE11anon_prefix
00000000001f41b1 s __ZZN4absl12lts_202103249SymbolizeEPKvPciE9kEllipsis

ABSL when compiled with different C++ standard (e.g., -std=c++14 vs. -std=c++17) may result in different binary. Some TFLite component changed to used C++17 (e.g., metal delegate), so a quick solution is to add --cxxopt=-std=c++17 --host_cxxopt=-std=c++17 to you bazel build flags.