You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Want to build tensorflow for android but stuck at this problem. #11279
OS Platform and Distribution : Windows 10
Bazel version :0.5.2
C:\Users\dulam\tensorflow>bazel build -c opt //tensorflow/contrib/android:libtensorflow_inference.so
ERROR: C:/users/dulam/tensorflow/tensorflow/core/BUILD:1415:1: no such target '//tensorflow/tools/git:gen/spec.json': target 'gen/spec.json' not declared in package 'tensorflow/tools/git' defined by C:/users/dulam/tensorflow/tensorflow/tools/git/BUILD and referenced by '//tensorflow/core:version_info_gen'.
ERROR: C:/users/dulam/tensorflow/tensorflow/core/BUILD:1415:1: no such target '//tensorflow/tools/git:gen/head': target 'gen/head' not declared in package 'tensorflow/tools/git' defined by C:/users/dulam/tensorflow/tensorflow/tools/git/BUILD and referenced by '//tensorflow/core:version_info_gen'.
ERROR: C:/users/dulam/tensorflow/tensorflow/core/BUILD:1415:1: no such target '//tensorflow/tools/git:gen/branch_ref': target 'gen/branch_ref' not declared in package 'tensorflow/tools/git' defined by C:/users/dulam/tensorflow/tensorflow/tools/git/BUILD and referenced by '//tensorflow/core:version_info_gen'.
ERROR: Analysis of target '//tensorflow/contrib/android:libtensorflow_inference.so' failed; build aborted.
Ah, OK. I'd recommend downloading the binary for windows, building your model, then downloading the binary for android, then copying the binaries over. There is no HOWTO AFAIK.
@mhyttsten might have a clue. If not, that might be a good document to have.
@RohitDulam It's currently not possible to build Android TF on Windows directly using Bazel (this is a Bazel limitation). See #6385 for details and workarounds. The preferred method of using TF on Android is the AAR distribution which allows integration with a few lines of configuration. You can also manually download the prebuilt binaries as others suggest.
@jubjamie Agreed that a more comprehensive official walkthrough would be useful, this is something we plan on adding.
Hi,
I'm on windows. The android example runs pretty straight forward, however using this build the native libraries are pre-built and stripped of symbols and I can't use them to link other native C++ code that uses either the C++ or C TF APIs.
Do you have any suggestions other than use a different operation system for the compilation?
drpngx i am building .so file using bazel build -c opt //tensorflow/contrib/android:libtensorflow_inference.so --crosstool_top=//external:android/crosstool --host_crosstool_top=@bazel_tools//tools/cpp:toolchain --cpu=armeabi-v7a and i faced this probelm form two weeks
ERROR: C:/users/sabir-pc/_bazel_sabir-pc/zp6kp3ov/external/com_google_absl/absl/strings/BUILD.bazel:32:1: C++ compilation of rule '@com_google_absl//absl/strings:strings' failed (Exit 1)
In file included from external/com_google_absl/absl/strings/str_cat.cc:15:
In file included from external/com_google_absl\absl/strings/str_cat.h:62:
In file included from external/com_google_absl\absl/strings/numbers.h:37:
In file included from external/com_google_absl\absl/numeric/int128.h:29:
In file included from external/androidndk/ndk/sources/cxx-stl/llvm-libc++/include\cmath:305:
In file included from external/androidndk/ndk/sources/android/support/include\math.h:32:
external/androidndk/ndk/sources/cxx-stl/llvm-libc++/include\math.h:1302:93: error: no member named 'log2f' in the global namespace
inline _LIBCPP_INLINE_VISIBILITY float log2(float __lcpp_x) _NOEXCEPT {return ::log2f(__lcpp_x);}
~~^
external/androidndk/ndk/sources/cxx-stl/llvm-libc++/include\math.h:1303:93: error: no member named 'log2l' in the global namespace
inline _LIBCPP_INLINE_VISIBILITY long double log2(long double __lcpp_x) _NOEXCEPT {return ::log2l(__lcpp_x);}
~~^
external/androidndk/ndk/sources/cxx-stl/llvm-libc++/include\math.h:1308:38: error: call to 'log2' is ambiguous
log2(_A1 __lcpp_x) _NOEXCEPT {return ::log2((double)__lcpp_x);}
^~~~~~
external/androidndk/ndk/sources/cxx-stl/llvm-libc++/include\math.h:1302:46: note: candidate function
inline _LIBCPP_INLINE_VISIBILITY float log2(float __lcpp_x) _NOEXCEPT {return ::log2f(__lcpp_x);}
^
external/androidndk/ndk/sources/cxx-stl/llvm-libc++/include\math.h:1303:46: note: candidate function
inline _LIBCPP_INLINE_VISIBILITY long double log2(long double __lcpp_x) _NOEXCEPT {return ::log2l(__lcpp_x);}
^
3 errors generated.
Target //tensorflow/contrib/android:libtensorflow_inference.so failed to build
Use --verbose_failures to see the command lines of failed build steps.
INFO: Elapsed time: 212.615s, Critical Path: 18.57s
INFO: 213 processes: 213 local.
FAILED: Build did NOT complete successfully
please help i am stuck in my FYP
i am building libtensorflow_inference.so file using build but it will give me the error
compilation of rule '@com_google_absl//absl/strings:strings' failed (Exit 1)
please tensorflow member help me
Activity
drpngx commentedon Jul 4, 2017
For windows, it's best that you use the CMake solution right now, in
contrib/cmake.RohitDulam commentedon Jul 4, 2017
I'm new to this, can you give me a reference link that explains the procedure you just said. @drpngx
drpngx commentedon Jul 4, 2017
Oh, wait, do you want to cross-compile from windows to android?
RohitDulam commentedon Jul 4, 2017
I want to train a classifier on my windows machine and use it in an android application.
drpngx commentedon Jul 4, 2017
Ah, OK. I'd recommend downloading the binary for windows, building your model, then downloading the binary for android, then copying the binaries over. There is no HOWTO AFAIK.
@mhyttsten might have a clue. If not, that might be a good document to have.
jubjamie commentedon Jul 5, 2017
You can just copy the binaries into the project. I just got them from the nightly and put them into my libs folder in my project. I would recommend looking at the android demo app here for more information: https://github.com/tensorflow/tensorflow/tree/master/tensorflow/examples/android
@drpngx when I started with the android stuff a few months ago it was incredibly painful getting it to work, especially on windows. I think a proper howto on getting your android project set up with Tensorflow would be handy. https://github.com/tensorflow/tensorflow/blob/master/tensorflow/contrib/android/README.md is a good start but I think some clear documentation and/or tutorial would be much appreciated!
andydavis1 commentedon Jul 5, 2017
assigned to add documentation for a how-to on this.
andrewharp commentedon Jul 10, 2017
@RohitDulam It's currently not possible to build Android TF on Windows directly using Bazel (this is a Bazel limitation). See #6385 for details and workarounds. The preferred method of using TF on Android is the AAR distribution which allows integration with a few lines of configuration. You can also manually download the prebuilt binaries as others suggest.
@jubjamie Agreed that a more comprehensive official walkthrough would be useful, this is something we plan on adding.
tensorflowbutler commentedon Dec 20, 2017
It has been 14 days with no activity and this issue has an assignee.Please update the label and/or status accordingly.
drpngx commentedon Dec 20, 2017
We seem to have revamped the build to split it into multiple libraries. Please check with the newest version to see if the problem persists.
dr4b commentedon Dec 21, 2017
Right -- I think everything current about building for Android is in https://www.tensorflow.org/mobile/ now.
tensorflowbutler commentedon Jan 4, 2018
It has been 14 days with no activity and this issue has an assignee.Please update the label and/or status accordingly.
drpngx commentedon Jan 4, 2018
Closing since it seems to be working now.
BarMazal commentedon Mar 16, 2018
Hi,
I'm on windows. The android example runs pretty straight forward, however using this build the native libraries are pre-built and stripped of symbols and I can't use them to link other native C++ code that uses either the C++ or C TF APIs.
Do you have any suggestions other than use a different operation system for the compilation?
Thanks.
andrewharp commentedon Mar 16, 2018
@BarMazal you might try the Linux for Windows workaround outlined in #6385 to build the custom binaries you need
cusitkhan commentedon Oct 24, 2018
drpngx i am building .so file using bazel build -c opt //tensorflow/contrib/android:libtensorflow_inference.so --crosstool_top=//external:android/crosstool --host_crosstool_top=@bazel_tools//tools/cpp:toolchain --cpu=armeabi-v7a and i faced this probelm form two weeks
ERROR: C:/users/sabir-pc/_bazel_sabir-pc/zp6kp3ov/external/com_google_absl/absl/strings/BUILD.bazel:32:1: C++ compilation of rule '@com_google_absl//absl/strings:strings' failed (Exit 1)
In file included from external/com_google_absl/absl/strings/str_cat.cc:15:
In file included from external/com_google_absl\absl/strings/str_cat.h:62:
In file included from external/com_google_absl\absl/strings/numbers.h:37:
In file included from external/com_google_absl\absl/numeric/int128.h:29:
In file included from external/androidndk/ndk/sources/cxx-stl/llvm-libc++/include\cmath:305:
In file included from external/androidndk/ndk/sources/android/support/include\math.h:32:
external/androidndk/ndk/sources/cxx-stl/llvm-libc++/include\math.h:1302:93: error: no member named 'log2f' in the global namespace
inline _LIBCPP_INLINE_VISIBILITY float log2(float __lcpp_x) _NOEXCEPT {return ::log2f(__lcpp_x);}
~~^
external/androidndk/ndk/sources/cxx-stl/llvm-libc++/include\math.h:1303:93: error: no member named 'log2l' in the global namespace
inline _LIBCPP_INLINE_VISIBILITY long double log2(long double __lcpp_x) _NOEXCEPT {return ::log2l(__lcpp_x);}
~~^
external/androidndk/ndk/sources/cxx-stl/llvm-libc++/include\math.h:1308:38: error: call to 'log2' is ambiguous
log2(_A1 __lcpp_x) _NOEXCEPT {return ::log2((double)__lcpp_x);}
^~~~~~
external/androidndk/ndk/sources/cxx-stl/llvm-libc++/include\math.h:1302:46: note: candidate function
inline _LIBCPP_INLINE_VISIBILITY float log2(float __lcpp_x) _NOEXCEPT {return ::log2f(__lcpp_x);}
^
external/androidndk/ndk/sources/cxx-stl/llvm-libc++/include\math.h:1303:46: note: candidate function
inline _LIBCPP_INLINE_VISIBILITY long double log2(long double __lcpp_x) _NOEXCEPT {return ::log2l(__lcpp_x);}
^
3 errors generated.
Target //tensorflow/contrib/android:libtensorflow_inference.so failed to build
Use --verbose_failures to see the command lines of failed build steps.
INFO: Elapsed time: 212.615s, Critical Path: 18.57s
INFO: 213 processes: 213 local.
FAILED: Build did NOT complete successfully
please help i am stuck in my FYP
cusitkhan commentedon Oct 24, 2018
i am building libtensorflow_inference.so file using build but it will give me the error
compilation of rule '@com_google_absl//absl/strings:strings' failed (Exit 1)
please tensorflow member help me