Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TensorflowLite 1.15.2 aar build failure in Win10 #46600

Closed
nickkchenn opened this issue Jan 22, 2021 · 8 comments
Closed

TensorflowLite 1.15.2 aar build failure in Win10 #46600

nickkchenn opened this issue Jan 22, 2021 · 8 comments
Assignees
Labels
comp:lite TF Lite related issues subtype:windows Windows Build/Installation Issues TF 1.15 for issues seen on TF 1.15 type:build/install Build and install issues

Comments

@nickkchenn
Copy link

nickkchenn commented Jan 22, 2021

Please make sure that this is a build/installation issue. As per our GitHub Policy, we only address code/doc bugs, performance issues, feature requests and build/installation issues on GitHub. tag:build_template

System information

  • OS Platform and Distribution :win10
  • Mobile device (e.g. iPhone 8, Pixel 2, Samsung Galaxy) if the issue happens on mobile device:no
  • TensorFlow installed from (source or binary):source
  • TensorFlow version:1.15.2
  • Python version:3.7.9
  • Installed using virtualenv? pip? conda?: no,using bazel and the default python in system
  • Bazel version (if compiling from source):0.26.1
  • GCC/Compiler version (if compiling from source):
  • CUDA/cuDNN version: no
  • GPU model and memory:no

Describe the problem

I was trying to build the tensorflow-lite-1.15.2.aar from source on my local WIN10 PC,
I downloaded the source code and installed bazel following instructions online.
The version of ANDROID_NDK is 18.1.5063045 and ANDOIRD_SDK is 23
After configuring the bazelrc, I executed the build command and got the following error:

[18 / 56] Processing Android resources for //tensorflow/lite/java:tensorflow-lite_dummy_app_for_so; 1s local ... (12 actions, 11 running)
ERROR: D:/code/tensorflow-1.15.2/tensorflow-1.15.2/tensorflow/lite/java/BUILD:22:1: Processing Android resources for //tensorflow/lite/java:tensorflow-lite_dummy_app_for_so failed (Exit 1): ResourceProcessorBusyBox.exe failed: error executing command
  cd C:/users/c00/_bazel_c00/7oqu2vjd/execroot/org_tensorflow
  SET ANDROID_BUILD_TOOLS_VERSION=30.0.0
    SET ANDROID_NDK_API_LEVEL=18
    SET ANDROID_NDK_HOME=D:/softwares/AndroidSDK/ndk/18.1.5063045
    SET ANDROID_SDK_API_LEVEL=23
    SET ANDROID_SDK_HOME=D:/softwares/AndroidSDK
    SET PATH=C:\Program Files\Git\usr\bin;C:\Program Files\Git\bin;C:\WINDOWS;C:\WINDOWS\System32;C:\WINDOWS\System32\WindowsPowerShell\v1.0;C:\Users\c00\bin;C:\Program Files\Git\mingw64\bin;C:\Program Files\Git\usr\local\bin;C:\Program Files\Git\usr\bin;C:\Program Files\Git\usr\bin;C:\Program Files\Git\mingw64\bin;C:\Program Files\Git\usr\bin;C:\Users\c00\bin;%PyCharm%;%GoLand%;%IntelliJ IDEA%;C:\WINDOWS\system32\config\systemprofile\go\bin;C:\Program Files\Python37;C:\Program Files\Python37\Scripts;D:\softwares\apache-maven-3.6.3\bin;D:\softwares\AndroidSDK\platform-tools\adb.exe;C:\Program Files (x86)\GnuWin32\bin;C:\Windows\System32;C:\Program Files\Git\usr\bin\git.exe;C:\Program Files\Git LFS;C:\Program Files\Java\jdk1.8.0_202\bin;C:\Program Files\Java\jdk1.8.0_202\jre\bin;D:\softwares\PyCharm 2020.1\bin;D:\softwares\GoLand 2020.1.3\bin;D:\softwares\IntelliJ IDEA 2020.2\bin;C:\Users\c00\go\bin;C:\Program Files\Git\usr\bin\vendor_perl;C:\Program Files\Git\usr\bin\core_perl
    SET PYTHON_BIN_PATH=C:/Program Files/Python37/python.exe
    SET PYTHON_LIB_PATH=C:/Program Files/Python37/lib/site-packages
    SET RUNFILES_MANIFEST_ONLY=1
    SET TF2_BEHAVIOR=0
    SET TF_CONFIGURE_IOS=0
    SET TF_ENABLE_XLA=1
  bazel-out/x64_windows-opt/bin/external/bazel_tools/src/tools/android/java/com/google/devtools/build/android/ResourceProcessorBusyBox.exe @bazel-out/x64_windows-opt/bin/tensorflow/lite/java/tensorflow-lite_dummy_app_for_so_symbols/R.txt-0.params
Execution platform: @bazel_tools//platforms:host_platform
一月 22, 2021 5:18:13 下午 com.google.devtools.build.android.ResourceProcessorBusyBox processRequest
严重: Error during processing
java.nio.file.InvalidPathException: Illegal character [:] in path at index 4: ///C:/Users/C00520~1/AppData/Local/Temp/android_resources_tmp5724987117968661034/linked/bin.-pb.apk
        at sun.nio.fs.WindowsPathParser.nextSlash(WindowsPathParser.java:212)
        at sun.nio.fs.WindowsPathParser.parse(WindowsPathParser.java:111)
        at sun.nio.fs.WindowsPathParser.parse(WindowsPathParser.java:77)
        at sun.nio.fs.WindowsPath.parse(WindowsPath.java:94)
        at sun.nio.fs.WindowsFileSystem.getPath(WindowsFileSystem.java:255)
        at java.nio.file.Paths.get(Paths.java:84)
        at com.google.devtools.build.android.aapt2.ProtoApk.asApkPath(ProtoApk.java:203)
        at com.google.devtools.build.android.aapt2.ResourceLinker.link(ResourceLinker.java:555)
        at com.google.devtools.build.android.aapt2.ResourceLinker.link(ResourceLinker.java:536)
        at com.google.devtools.build.android.Aapt2ResourcePackagingAction.main(Aapt2ResourcePackagingAction.java:185)
        at com.google.devtools.build.android.ResourceProcessorBusyBox$Tool$14.call(ResourceProcessorBusyBox.java:144)
        at com.google.devtools.build.android.ResourceProcessorBusyBox.processRequest(ResourceProcessorBusyBox.java:240)
        at com.google.devtools.build.android.ResourceProcessorBusyBox.main(ResourceProcessorBusyBox.java:203)

Exception in thread "main" java.nio.file.InvalidPathException: Illegal character [:] in path at index 4: ///C:/Users/C00520~1/AppData/Local/Temp/android_resources_tmp5724987117968661034/linked/bin.-pb.apk
        at sun.nio.fs.WindowsPathParser.nextSlash(WindowsPathParser.java:212)
        at sun.nio.fs.WindowsPathParser.parse(WindowsPathParser.java:111)
        at sun.nio.fs.WindowsPathParser.parse(WindowsPathParser.java:77)
        at sun.nio.fs.WindowsPath.parse(WindowsPath.java:94)
        at sun.nio.fs.WindowsFileSystem.getPath(WindowsFileSystem.java:255)
        at java.nio.file.Paths.get(Paths.java:84)
        at com.google.devtools.build.android.aapt2.ProtoApk.asApkPath(ProtoApk.java:203)
        at com.google.devtools.build.android.aapt2.ResourceLinker.link(ResourceLinker.java:555)
        at com.google.devtools.build.android.aapt2.ResourceLinker.link(ResourceLinker.java:536)
        at com.google.devtools.build.android.Aapt2ResourcePackagingAction.main(Aapt2ResourcePackagingAction.java:185)
        at com.google.devtools.build.android.ResourceProcessorBusyBox$Tool$14.call(ResourceProcessorBusyBox.java:144)
        at com.google.devtools.build.android.ResourceProcessorBusyBox.processRequest(ResourceProcessorBusyBox.java:240)
        at com.google.devtools.build.android.ResourceProcessorBusyBox.main(ResourceProcessorBusyBox.java:203)
Target //tensorflow/lite/java:tensorflow-lite failed to build
INFO: Elapsed time: 2.462s, Critical Path: 1.37s
INFO: 14 processes: 14 local.
FAILED: Build did NOT complete successfully
FAILED: Build did NOT complete successfully

Provide the exact sequence of commands / steps that you executed before running into the problem

_bazel build --cxxopt='--std=c++11' -c opt --fat_apk_cpu=x86,x86_64,arm64-v8a,armeabi-v7a //tensorflow/lite/java:tensorflow-lite

Any other info / logs
Include any logs or source code that would be helpful to diagnose the problem. If including tracebacks, please include the full traceback. Large logs and files should be attached.

Here is the tf_configure.bazelrc content I got ,

  • I have JDK1.8 installed before ,so I added the "java_toolchain" setting
  • I used the ./configure to interactively configure it,but I couldn't get these "action_env" adout android, so I add those action_env manually.
  • I tried to remove some of the "build:opt" ,it didn't work,cause I don't really understand all of them
  • I tried to change the SDK and NDK higher ,to like 29/30, it didn't solve the problem either.
build --action_env PYTHON_BIN_PATH="C:/Program Files/Python37/python.exe"
build --action_env PYTHON_LIB_PATH="C:/Program Files/Python37/lib/site-packages"
build --python_path="C:/Program Files/Python37/python.exe"
build:xla --define with_xla_support=true
build --config=xla
build:opt --copt=-march=native
build:opt --copt=-Wno-sign-compare
build:opt --host_copt=-march=native
build:opt --define with_default_optimizations=true
build --config monolithic
build --copt=-w --host_copt=-w
build --copt=-DWIN32_LEAN_AND_MEAN --host_copt=-DWIN32_LEAN_AND_MEAN --copt=-DNOGDI --host_copt=-DNOGDI
build --verbose_failures
build --distinct_host_configuration=false
build --define=override_eigen_strong_inline=true
build:v2 --define=tf_api_version=2
build --java_toolchain=@bazel_tools//tools/jdk:toolchain_hostjdk8
build --action_env ANDROID_NDK_HOME="D:/softwares/AndroidSDK/ndk/18.1.5063045"
build --action_env ANDROID_NDK_API_LEVEL="18"
build --action_env ANDROID_BUILD_TOOLS_VERSION="30.0.0"
build --action_env ANDROID_SDK_API_LEVEL="23"
build --action_env ANDROID_SDK_HOME="D:/softwares/AndroidSDK"
test --flaky_test_attempts=3
test --test_size_filters=small,medium
test --test_tag_filters=-benchmark-test,-no_oss,-oss_serial
test --build_tag_filters=-benchmark-test,-no_oss
test --test_tag_filters=-no_windows,-gpu
test --build_tag_filters=-no_windows,-gpu
build --action_env TF_CONFIGURE_IOS="0"

I am new to bazel and tensorflow , I feel there must be something wrong with my bazelrc, but I can't find similar problem online, so I'm trying to seek for help here. Thanks.

@nickkchenn nickkchenn added the type:build/install Build and install issues label Jan 22, 2021
@ravikyram ravikyram added comp:lite TF Lite related issues TF 1.15 for issues seen on TF 1.15 subtype:windows Windows Build/Installation Issues labels Jan 22, 2021
@ravikyram ravikyram assigned ymodak and unassigned ravikyram Jan 22, 2021
@nickkchenn
Copy link
Author

I ran the build command in git bash at first,now I tried cmder/cmd-bash, I still got the same error,
And I got another win10 laptop ,configured the environment from the very first step of python installation....
And I still got the same error message after I configured the same environment(Python3.7/ndk 18/android sdk 23/buildtool 30/bazel 0.26/jdk9)
I really hope somebody can give me some advice ,I'm totally stuck here

@nickkchenn
Copy link
Author

@thaink Sorry to ask,but may you offer me some pro advice if possible,
I think it may be a very rookie mistake,but I just have no clue what to do with it now
any help would be appreciated... thanks

@ymodak ymodak removed their assignment Jan 25, 2021
@thaink
Copy link
Member

thaink commented Jan 26, 2021

@nickkchenn In my experience, this error is related to bazel version. Maybe yours is too old.
I recomend to build it using docker https://www.tensorflow.org/lite/guide/build_android#set_up_build_environment_using_docker

And is there any reason that you are building 1.15.2 instead of our latest release?

@nickkchenn
Copy link
Author

nickkchenn commented Jan 26, 2021

@thaink Thank you for your reply,

  1. I'm building 1.15.2 for a old existing program which depends on this version of tflite, change of version may produce more unwanted workloads.
  2. My goal was to put the building process on our own building-pipeline system, so I was trying to implement the process locally on my own machine first , now it seems not going to work though...
  3. I read in the configure.py that _TF_MAX_BAZEL_VERSION = '0.26.1' ,so I chosed 0.26.1 , is it because that the bazel version is too old for my system?

@thaink
Copy link
Member

thaink commented Jan 26, 2021

Looking at the error message:

java.nio.file.InvalidPathException: Illegal character [:] in path at index 4: ///C:/Users/C00520~1/AppData/Local/Temp/android_resources_tmp5724987117968661034/linked/bin.-pb.apk

Look like bazel at that version is not supporting Windows' path really well. If you make no modification to the code it might be better to just use our prebuilt aar file or build it in Linux.

Anyway, TFLite is designed to be backward-compatibility so I would still recommend to try our latest version as the first option.

@nickkchenn
Copy link
Author

ok,I understand it. I'll try to build it in linux instead or try with latest version
thank you very much

@tensorflowbutler
Copy link
Member

Hi There,

We are checking to see if you still need help on this, as you are using an older version of tensorflow which is officially considered end of life . We recommend that you upgrade to the latest 2.x version and let us know if the issue still persists in newer versions. Please open a new issue for any help you need against 2.x, and we will get you the right help.

This issue will be closed automatically 7 days from now. If you still need help with this issue, please provide us with more information.

@google-ml-butler
Copy link

Are you satisfied with the resolution of your issue?
Yes
No

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
comp:lite TF Lite related issues subtype:windows Windows Build/Installation Issues TF 1.15 for issues seen on TF 1.15 type:build/install Build and install issues
Projects
None yet
Development

No branches or pull requests

5 participants