[英]Cannot compile bazel needed for tensorflow-android
I'm trying to explore the tensorflow android demo. 我正在尝试探索tensorflow android演示。 I want to adapt the app using android studio.
我想使用android studio修改应用程序。
However when I simply follow the instructions I get compilation errors no matter what I do: 但是,当我仅按照说明进行操作时,无论执行什么操作 ,都会出现编译错误:
Trying to compile tensorflow using bazel and NDK r12b: 尝试使用bazel和NDK r12b编译Tensorflow:
$bazel build -c opt //tensorflow/examples/android:tensorflow_demo
ERROR: /home/myUser/libs/tensorflow_android/WORKSPACE:3:1: //external:io_bazel_rules_closure: no such attribute 'urls' in 'http_archive' rule.
ERROR: /home/myUser/libs/tensorflow_android/WORKSPACE:3:1: //external:io_bazel_rules_closure: missing value for mandatory attribute 'url' in 'http_archive' rule.
ERROR: com.google.devtools.build.lib.packages.BuildFileContainsErrorsException: error loading package '': Encountered error while reading extension file 'closure/defs.bzl': no such package '@io_bazel_rules_closure//closure': error loading package 'external': Could not load //external package.
INFO: Elapsed time: 0.129s
Trying to compile a newer version of bazel following this advice : 按照以下建议尝试编译更新版本的bazel :
$bazel version
Build label: 0.2.3-jdk7 // This is my current version of bazel
via apt-get: 通过apt-get:
$sudo apt-get upgrade bazel
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
E: Unable to locate package bazel
from source (tried bazel-0.4.2 and bazel-0.5.0): 来源(尝试bazel-0.4.2和bazel-0.5.0):
$./compile.sh
INFO: You can skip this first step by providing a path to the bazel binary as second argument:
INFO: ./compile.sh compile /path/to/bazel
🍃 Building Bazel from scratch
ERROR: JDK version (1.7) is lower than 1.8, please set $JAVA_HOME.
or 要么
$bazel build //src:bazel
ERROR: /home/myUser/libs/bazel/bazel-0.4.2/tools/build_rules/genproto.bzl:45:16: Traceback (most recent call last):
File "/home/myUser/libs/bazel/bazel-0.4.2/tools/build_rules/genproto.bzl", line 42
rule(gensrcjar_impl, attrs = {"src": at..."), <2 more arguments>), "_proto_compiler": attr.label(default = Label("//third_party/p..."), <4 more arguments>), "_jar": attr.label(default = Label("@bazel_tools//t..."), <4 more arguments>), "_jdk": attr.label(default = Label("@bazel_tools//t..."), ...)}, ..."})
File "/home/myUser/libs/bazel/bazel-0.4.2/tools/build_rules/genproto.bzl", line 45, in rule
attr.label(allow_files = proto_filetype, sing...)
allow_files should be a boolean or a filetype object.
ERROR: /home/myUser/libs/bazel/bazel-0.4.2/src/BUILD:130:1: error loading package 'src/main/protobuf': Extension file 'tools/build_rules/genproto.bzl' has errors and referenced by '//src:embedded_tools'.
ERROR: Loading failed; build aborted.
INFO: Elapsed time: 0.251s
switching aroung java-versions to see whether the bazel compiling issues come from there: 切换到java-versions周围,以查看bazel编译问题是否来自那里:
$sudo update-alternatives --config java
There are 4 choices for the alternative java (providing /usr/bin/java).
Selection Path Priority Status
------------------------------------------------------------
0 /usr/lib/jvm/java-8-oracle/jre/bin/java 1074 auto mode
1 /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java 1071 manual mode
* 2 /usr/lib/jvm/java-7-oracle/jre/bin/java 1072 manual mode
3 /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java 1069 manual mode
4 /usr/lib/jvm/java-8-oracle/jre/bin/java 1074 manual mode
No luck so far :-/. 到目前为止没有运气:-/。 Has anyone successfully compiled tensorflow for android from source?
有没有人成功地从源代码为Android编译tensorflow?
What version of Tensorflow, NDK, bazel, java are required / compatible with each other? 需要/兼容哪个版本的Tensorflow,NDK,bazel,java? Do I really need bazel?
我真的需要榛子吗? (never worked with it anyway) Can't I just compile the android demo in android-studio like any other app?
(无论如何都不能使用它)我不能像其他任何应用程序一样在android-studio中编译android演示吗?
I'm using Ubuntu 14.04, Cuda8.0, cudnn_v5.1, Titan X Pascal (not sure if these things matter) 我正在使用Ubuntu 14.04,Cuda8.0,cudnn_v5.1,Titan X Pascal(不确定这些是否重要)
Installing Bazel on Ubuntu can be done without compiling. 无需编译即可在Ubuntu上安装Bazel。
Follow all steps of the dedicated documentation: Install Bazel on Ubuntu 请遵循专用文档的所有步骤: 在Ubuntu上安装Bazel
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.