build with Bazel

  1. build with Bazel
    1. what is Bazel?
    2. how to install Bazel?
    3. build with Bazel
    4. 如何使用Bazel编译c++,java,android

build with Bazel

what is Bazel?

What is Bazel?
Bazel is an open-source build and test tool similar to Make, Maven, and Gradle. It uses a human-readable, high-level build language. Bazel supports projects in multiple languages and builds outputs for multiple platforms. Bazel supports large codebases across multiple repositories, and large numbers of users.

how to install Bazel?

  • 安装编译bazel的依赖工具

    sudo apt-get install build-essential openjdk-8-jdk python zip unzip
  • 下载安装包:

    wget https://github.com/bazelbuild/bazel/releases/download/3.2.0/bazel-3.2.0-dist.zip --no-check-certificate
  • 解压

     unzip  bazel-3.2.0-dist.zip -d bazel-3.2.0-dist
     cd bazel-3.2.0-dist
  • 编译&安装

    env EXTRA_BAZEL_ARGS="--host_javabase=@local_jdk//:jdk" bash ./compile.sh
    sudo cp output/bazel /usr/local/bin/
    • 如果联网需要代理,需要使用cntlm配置代理,
      export http_proxy=http://127.0.0.1:xxxx

      build with Bazel

      tensorflow lite为例,clone 工程到本地目录。
      配置工程目录下的configure文件,’./configure’。根据自己的硬件配置,开关相应的选项。
      [操作引导](https://github.com/tensorflow/tensorflow/tree/master/tensorflow/lite/tools/benchmark)
      bazel build -c opt --config=android_arm64 tensorflow/lite/tools/benchmark:benchmark_model
    • 如果出现网站鉴权问题,可以配置bazel如下*
      alias bazel="bazel --host_jvm_args=-Djavax.net.ssl.trustStore='/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/security/cacerts' --host_jvm_args=-Djavax.net.ssl.trustStorePassword='changeit'"
      同时将对应需要鉴权的网站加入到cacerts文件,相关操作可以参考

    如何使用Bazel编译c++,java,android


转载请注明来源,欢迎对文章中的引用来源进行考证,欢迎指出任何有错误或不够清晰的表达。可以在下面评论区评论

×

喜欢就点赞,疼爱就打赏