Hi, I want to build tensorflow lite support library for ios device.
First i download the source code of tflite-support and tensorflow.
Then i realize that if want to build tensorflow lite as external library, i need to copy partial related packages in tflite-support WORKSPACE.
I try to resolve errors from build error message. And try to fix the depencency issues.
Currently i can success build “TensorFlowLiteTaskVisionC_framework” by this command “bazel build -c opt --config=ios_arm64 //tensorflow_lite_support/ios:TensorFlowLiteTaskVisionC_framework”.
But i still cannot pass the build by “bazel build -c opt --config=ios_arm64 //tensorflow_lite_support/ios:TensorFlowLiteTaskVision_framework”.
I notice i have encounter c++ version errors such as below:
ERROR: /Users/chung-iwu/codeBase/tensorflow/tflite-support/tensorflow_lite_support/ios/task/vision/utils/BUILD:24:13: Compiling tensorflow_lite_support/ios/task/vision/utils/sources/GMLImage+CppUtils.mm failed: (Exit
1): wrapped_clang_pp failed: error executing command (from target //tensorflow_lite_support/ios/task/vision/utils:GMLImageCppUtils) external/local_config_cc/wrapped_clang_pp -target arm64-apple-ios12.0 '-stdlib=libc
++' '-std=gnu++11' '-D_FORTIFY_SOURCE=1' -fstack-protector -fcolor-diagnostics -Wall -Wthread-safety -Wself-assign ... (remaining 49 arguments skipped)
In file included from tensorflow_lite_support/ios/task/vision/utils/sources/GMLImage+CppUtils.mm:15:
In file included from ./tensorflow_lite_support/ios/sources/TFLCommonCppUtils.h:19:
In file included from external/com_google_absl/absl/status/status.h:58:
In file included from external/com_google_absl/absl/functional/function_ref.h:53:
In file included from external/com_google_absl/absl/base/attributes.h:37:
In file included from external/com_google_absl/absl/base/config.h:86:
external/com_google_absl/absl/base/policy_checks.h:79:2: error: "C++ versions less than C++14 are not supported."
#error "C++ versions less than C++14 are not supported."
^
In file included from tensorflow_lite_support/ios/task/vision/utils/sources/GMLImage+CppUtils.mm:15:
In file included from ./tensorflow_lite_support/ios/sources/TFLCommonCppUtils.h:19:
In file included from external/com_google_absl/absl/status/status.h:59:
In file included from external/com_google_absl/absl/status/internal/status_internal.h:22:
In file included from external/com_google_absl/absl/container/inlined_vector.h:53:
In file included from external/com_google_absl/absl/container/internal/inlined_vector.h:30:
external/com_google_absl/absl/container/internal/compressed_tuple.h:77:16: error: no member named 'is_final' in namespace 'std'
!std::is_final<T>::value &&
~~~~~^
external/com_google_absl/absl/container/internal/compressed_tuple.h:77:25: error: 'T' does not refer to a value
!std::is_final<T>::value &&
^
external/com_google_absl/absl/container/internal/compressed_tuple.h:74:20: note: declared here
template <typename T>
^
external/com_google_absl/absl/container/internal/compressed_tuple.h:77:29: error: no member named 'value' in the global namespace
!std::is_final<T>::value &&
~~^
external/com_google_absl/absl/container/internal/compressed_tuple.h:75:16: error: no return statement in constexpr function
constexpr bool ShouldUseBase() {
^
In file included from tensorflow_lite_support/ios/task/vision/utils/sources/GMLImage+CppUtils.mm:15:
In file included from ./tensorflow_lite_support/ios/sources/TFLCommonCppUtils.h:19:
In file included from external/com_google_absl/absl/status/status.h:59:
In file included from external/com_google_absl/absl/status/internal/status_internal.h:22:
In file included from external/com_google_absl/absl/container/inlined_vector.h:53:
In file included from external/com_google_absl/absl/container/internal/inlined_vector.h:31:
external/com_google_absl/absl/memory/memory.h:97:12: error: no member named 'make_unique' in namespace 'std'
using std::make_unique;
~~~~~^
In file included from tensorflow_lite_support/ios/task/vision/utils/sources/GMLImage+CppUtils.mm:15:
In file included from ./tensorflow_lite_support/ios/sources/TFLCommonCppUtils.h:19:
In file included from external/com_google_absl/absl/status/status.h:59:
In file included from external/com_google_absl/absl/status/internal/status_internal.h:22:
In file included from external/com_google_absl/absl/container/inlined_vector.h:53:
In file included from external/com_google_absl/absl/container/internal/inlined_vector.h:33:
In file included from external/com_google_absl/absl/types/span.h:69:
external/com_google_absl/absl/types/internal/span.h:119:21: error: no template named 'remove_const_t' in namespace 'std'; did you mean simply 'remove_const_t'?
using Container = std::remove_const_t<T>;
^~~~~~~~~~~~~~~~~~~
remove_const_t
external/com_google_absl/absl/meta/type_traits.h:241:1: note: 'remove_const_t' declared here
using remove_const_t = typename std::remove_const<T>::type;
^
In file included from tensorflow_lite_support/ios/task/vision/utils/sources/GMLImage+CppUtils.mm:15:
In file included from ./tensorflow_lite_support/ios/sources/TFLCommonCppUtils.h:19:
In file included from external/com_google_absl/absl/status/status.h:59:
In file included from external/com_google_absl/absl/status/internal/status_internal.h:22:
In file included from external/com_google_absl/absl/container/inlined_vector.h:53:
In file included from external/com_google_absl/absl/container/internal/inlined_vector.h:33:
In file included from external/com_google_absl/absl/types/span.h:69:
external/com_google_absl/absl/types/internal/span.h:130:24: error: no template named 'enable_if_t' in namespace 'std'; did you mean simply 'enable_if_t'?
using EnableIfIsView = std::enable_if_t<IsView<T>::value, int>;
^~~~~~~~~~~~~~~~
enable_if_t
external/com_google_absl/absl/meta/type_traits.h:307:1: note: 'enable_if_t' declared here
using enable_if_t = typename std::enable_if<B, T>::type;
^
In file included from tensorflow_lite_support/ios/task/vision/utils/sources/GMLImage+CppUtils.mm:15:
In file included from ./tensorflow_lite_support/ios/sources/TFLCommonCppUtils.h:19:
In file included from external/com_google_absl/absl/status/status.h:59:
In file included from external/com_google_absl/absl/status/internal/status_internal.h:22:
In file included from external/com_google_absl/absl/container/inlined_vector.h:53:
In file included from external/com_google_absl/absl/container/internal/inlined_vector.h:33:
In file included from external/com_google_absl/absl/types/span.h:69:
external/com_google_absl/absl/types/internal/span.h:133:27: error: no template named 'enable_if_t' in namespace 'std'; did you mean simply 'enable_if_t'?
using EnableIfNotIsView = std::enable_if_t<!IsView<T>::value, int>;
^~~~~~~~~~~~~~~~
enable_if_t
external/com_google_absl/absl/meta/type_traits.h:307:1: note: 'enable_if_t' declared here
using enable_if_t = typename std::enable_if<B, T>::type;
^
In file included from tensorflow_lite_support/ios/task/vision/utils/sources/GMLImage+CppUtils.mm:15:
In file included from ./tensorflow_lite_support/ios/sources/TFLCommonCppUtils.h:19:
In file included from external/com_google_absl/absl/status/status.h:59:
In file included from external/com_google_absl/absl/status/internal/status_internal.h:23:
In file included from external/com_google_absl/absl/strings/cord.h:79:
In file included from external/com_google_absl/absl/crc/internal/crc_cord_state.h:23:
In file included from external/com_google_absl/absl/crc/crc32c.h:32:
In file included from external/com_google_absl/absl/strings/str_format.h:78:
In file included from external/com_google_absl/absl/strings/internal/str_format/arg.h:34:
In file included from external/com_google_absl/absl/strings/internal/has_absl_stringify.h:21:
external/com_google_absl/absl/strings/string_view.h:338:18: warning: 'constexpr' non-static member function will not be implicitly 'const' in C++14; add 'const' to avoid a change in behavior [-Wconstexpr-not-const]
constexpr void remove_prefix(size_type n) {
^
const
external/com_google_absl/absl/strings/string_view.h:348:18: warning: 'constexpr' non-static member function will not be implicitly 'const' in C++14; add 'const' to avoid a change in behavior [-Wconstexpr-not-const]
constexpr void remove_suffix(size_type n) {
^
const
external/com_google_absl/absl/strings/string_view.h:356:18: warning: 'constexpr' non-static member function will not be implicitly 'const' in C++14; add 'const' to avoid a change in behavior [-Wconstexpr-not-const]
constexpr void swap(string_view& s) noexcept {
^
const
external/com_google_absl/absl/strings/string_view.h:340:10: error: cannot assign to non-static data member within const member function 'remove_prefix'
ptr_ += n;
~~~~ ^
external/com_google_absl/absl/strings/string_view.h:338:18: note: member function 'absl::string_view::remove_prefix' is declared const here
constexpr void remove_prefix(size_type n) {
~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
external/com_google_absl/absl/strings/string_view.h:341:13: error: cannot assign to non-static data member within const member function 'remove_prefix'
length_ -= n;
~~~~~~~ ^
external/com_google_absl/absl/strings/string_view.h:338:18: note: member function 'absl::string_view::remove_prefix' is declared const here
constexpr void remove_prefix(size_type n) {
~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
external/com_google_absl/absl/strings/string_view.h:338:18: error: constexpr function's return type 'void' is not a literal type
constexpr void remove_prefix(size_type n) {
^
external/com_google_absl/absl/strings/string_view.h:350:13: error: cannot assign to non-static data member within const member function 'remove_suffix'
length_ -= n;
~~~~~~~ ^
external/com_google_absl/absl/strings/string_view.h:348:18: note: member function 'absl::string_view::remove_suffix' is declared const here
constexpr void remove_suffix(size_type n) {
~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
external/com_google_absl/absl/strings/string_view.h:348:18: error: constexpr function's return type 'void' is not a literal type
constexpr void remove_suffix(size_type n) {
^
external/com_google_absl/absl/strings/string_view.h:358:11: error: no viable overloaded '='
*this = s;
~~~~~ ^ ~
external/com_google_absl/absl/strings/string_view.h:161:7: note: candidate function (the implicit copy assignment operator) not viable: 'this' argument has type 'const absl::string_view', but method is not marked con
st
class string_view {
^
external/com_google_absl/absl/strings/string_view.h:161:7: note: candidate function (the implicit move assignment operator) not viable: 'this' argument has type 'const absl::string_view', but method is not marked con
st
external/com_google_absl/absl/strings/string_view.h:356:18: error: constexpr function's return type 'void' is not a literal type
constexpr void swap(string_view& s) noexcept {
^
In file included from tensorflow_lite_support/ios/task/vision/utils/sources/GMLImage+CppUtils.mm:15:
In file included from ./tensorflow_lite_support/ios/sources/TFLCommonCppUtils.h:19:
In file included from external/com_google_absl/absl/status/status.h:59:
In file included from external/com_google_absl/absl/status/internal/status_internal.h:23:
In file included from external/com_google_absl/absl/strings/cord.h:79:
In file included from external/com_google_absl/absl/crc/internal/crc_cord_state.h:23:
In file included from external/com_google_absl/absl/crc/crc32c.h:32:
In file included from external/com_google_absl/absl/strings/str_format.h:78:
In file included from external/com_google_absl/absl/strings/internal/str_format/arg.h:34:
external/com_google_absl/absl/strings/internal/has_absl_stringify.h:46:8: error: no template named 'enable_if_t' in namespace 'std'; did you mean simply 'enable_if_t'?
T, std::enable_if_t<std::is_void<decltype(AbslStringify(
^~~~~~~~~~~~~~~~
enable_if_t
external/com_google_absl/absl/meta/type_traits.h:307:1: note: 'enable_if_t' declared here
using enable_if_t = typename std::enable_if<B, T>::type;
^
In file included from tensorflow_lite_support/ios/task/vision/utils/sources/GMLImage+CppUtils.mm:15:
In file included from ./tensorflow_lite_support/ios/sources/TFLCommonCppUtils.h:19:
In file included from external/com_google_absl/absl/status/status.h:59:
In file included from external/com_google_absl/absl/status/internal/status_internal.h:23:
In file included from external/com_google_absl/absl/strings/cord.h:79:
In file included from external/com_google_absl/absl/crc/internal/crc_cord_state.h:23:
In file included from external/com_google_absl/absl/crc/crc32c.h:32:
In file included from external/com_google_absl/absl/strings/str_format.h:78:
external/com_google_absl/absl/strings/internal/str_format/arg.h:141:8: error: no template named 'enable_if_t' in namespace 'std'; did you mean simply 'enable_if_t'?
-> std::enable_if_t<std::is_enum<T>::value &&
^~~~~~~~~~~~~~~~
enable_if_t
external/com_google_absl/absl/meta/type_traits.h:307:1: note: 'enable_if_t' declared here
using enable_if_t = typename std::enable_if<B, T>::type;
^
In file included from tensorflow_lite_support/ios/task/vision/utils/sources/GMLImage+CppUtils.mm:15:
In file included from ./tensorflow_lite_support/ios/sources/TFLCommonCppUtils.h:19:
In file included from external/com_google_absl/absl/status/status.h:59:
In file included from external/com_google_absl/absl/status/internal/status_internal.h:23:
In file included from external/com_google_absl/absl/strings/cord.h:79:
In file included from external/com_google_absl/absl/crc/internal/crc_cord_state.h:23:
In file included from external/com_google_absl/absl/crc/crc32c.h:32:
In file included from external/com_google_absl/absl/strings/str_format.h:78:
external/com_google_absl/absl/strings/internal/str_format/arg.h:160:8: error: no template named 'enable_if_t' in namespace 'std'; did you mean simply 'enable_if_t'?
-> std::enable_if_t<!std::is_enum<T>::value &&
^~~~~~~~~~~~~~~~
enable_if_t
external/com_google_absl/absl/meta/type_traits.h:307:1: note: 'enable_if_t' declared here
using enable_if_t = typename std::enable_if<B, T>::type;
^
In file included from tensorflow_lite_support/ios/task/vision/utils/sources/GMLImage+CppUtils.mm:15:
In file included from ./tensorflow_lite_support/ios/sources/TFLCommonCppUtils.h:19:
In file included from external/com_google_absl/absl/status/status.h:59:
In file included from external/com_google_absl/absl/status/internal/status_internal.h:23:
In file included from external/com_google_absl/absl/strings/cord.h:79:
In file included from external/com_google_absl/absl/crc/internal/crc_cord_state.h:23:
In file included from external/com_google_absl/absl/crc/crc32c.h:32:
In file included from external/com_google_absl/absl/strings/str_format.h:79:
In file included from external/com_google_absl/absl/strings/internal/str_format/bind.h:26:
In file included from external/com_google_absl/absl/strings/internal/str_format/checker.h:22:
external/com_google_absl/absl/strings/internal/str_format/constexpr_parser.h:44:20: warning: 'constexpr' non-static member function will not be implicitly 'const' in C++14; add 'const' to avoid a change in behavior [
-Wconstexpr-not-const]
constexpr void set_value(int value) {
^
const
external/com_google_absl/absl/strings/internal/str_format/constexpr_parser.h:55:20: warning: 'constexpr' non-static member function will not be implicitly 'const' in C++14; add 'const' to avoid a change in behavior [
-Wconstexpr-not-const]
constexpr void set_from_arg(int value) {
^
const
fatal error: too many errors emitted, stopping now [-ferror-limit=]
5 warnings and 20 errors generated.
Error in child process '/usr/bin/xcrun'. 1
Target //tensorflow_lite_support/ios:TensorFlowLiteTaskVision_framework failed to build
Use --verbose_failures to see the command lines of failed build steps.
INFO: Elapsed time: 4.295s, Critical Path: 1.27s
INFO: 11 processes: 9 internal, 2 local.
FAILED: Build did NOT complete successfully
PS:
I have update some external library version such as tensorflow, com_google_absl, rules_apple, rules_ios, rules_swift to meet the configuration of tensorflow source code.