bazel 是google用于构建项目的工具,主要用于构建google 的软件,如tensorflow等。我新装的ubuntu 18.04系统,bazel 用apt 安装默认只支持ubuntu14和16版本,apt install bazel 会显示找不到软件,所以我们只能从github上安装clone源码进行编译安装。 最近想要编写android上的tensorflow 项目,使用android studio 要用到bazel,装好之后记录一下,方便自己和有用到的朋友查看。
安装jdk 首先需要安装jdk8以上,参考Ubuntu 16.04安装Java JDK。
安装bazel 使用git clone或下载zip方式,下载源码。 打开终端,进入源码的bazel目录,输入./complie.sh命令,会报如下错误: root@648700565:/home/lihansen/bazel-master# ./compile.sh Building Bazel from scratch ERROR: Must specify PROTOC if not bootstrapping from the distribution artifact ----------------------------------------- NOTE: This failure is likely occuring if you are trying to bootstrap bazel from a developer checkout. Those checkouts do not include the generated output of the protoc compiler (as we prefer not to version generated files). * To build a developer version of bazel, do bazel build //src:bazel * To bootstrap your first bazel binary, please download a dist archive from our release page at https://github.com/bazelbuild/bazel/releases and run compile.sh on the unpacked archive. The full install instructions to install a release version of bazel can be found at https://docs.bazel.build/install-compile-source.html For a rationale, why the bootstrap process is organized in this way, see https://bazel.build/designs/2016/10/11/distribution-artifact.html ----------------------------------------- 按照提示进入这里。 根据自己的操作系统选择合适的sh文件,我的ubuntu18.04版本选择的是bazel-0.13.0-installer-linux-x86_64.sh 终端输入命令./bazel-0.13.0-installer-linux-x86_64.sh (如果提示权限不够,输入命令chmod +x bazel-0.13.0-installer-linux-x86_64.sh) 结果如下: root@648700565:/home/lihansen/bazel-master# ./bazel-0.13.0-installer-linux-x86_64.sh Bazel installer --------------- Bazel is bundled with software licensed under the GPLv2 with Classpath exception. You can find the sources next to the installer on our release page: https://github.com/bazelbuild/bazel/releases # Release 0.13.0 (2018-04-30) Baseline: fdee70e6e39b74bfd9144b1e350d2d8806386e05 Cherry picks: + f083e7623cd03e20ed216117c5ea8c8b4ec61948: windows: GetOutputRoot() returns GetHomeDir() + fa36d2f48965b127e8fd397348d16e991135bfb6: ...... - android_binary.manifest_merger is no longer supported. ## Build informations - [Commit](https://github.com/bazelbuild/bazel/commit/f19d2c1) Uncompressing....... Bazel is now installed! Make sure you have "/usr/local/bin" in your path. You can also activate bash completion by adding the following line to your : source /usr/local/lib/bazel/bin/bazel-complete.bash See http://bazel.build/docs/getting-started.html to start a new project! 表示安装成功,输入bazel 可见到提示信息。
相关主题 |