来源于bazel官方文档https://docs.bazel.build/versions/master/output_directories.html
Bazel must be invoked from a directory containing a WORKSPACE file. It reports an error if it is not. We call this the workspace directory.
Bazel必须从woskspace目录下调用,该目录下包含WORKSPACE 文件
The outputRoot directory is ~/.cache/bazel. (Unless $TEST_TMPDIR is set, as in a test of bazel itself, in which case this directory is used instead.)
如果不设置$TEST_TMPDIR环境变量,bazel编译时的中间文件位于~/.cache/bazel
并且弹出警告信息:
WARNING: Output base '~/.cache/bazel' is on NFS. This may lead to surprising failures and undetermined behavior.
解决办法:
设置环境变量$TEST_TMPDIR,相应命令为:
export TEST_TMPDIR=/tmp/cache_bazel
设置该环境变量后,使用bazel进行编译时弹出以下信息:
INFO: $TEST_TMPDIR defined: output root default is '/tmp/cache_bazel'
编译最新版本的tensorlfow时出现如下错误:
/disk1/bowang/yxhuang3/google/rop/tensorflow/third_party/clang_toolchain/cc_configure_clang.bzl:3:1: file '@bazel_tools//tools/cpp:cc_configure.bzl' does not contain symbol 'cc_autoconf_impl'
解决方法:
安装最新版本的bazel
bazel安装方法:https://docs.bazel.build/versions/master/install-ubuntu.html#install-with-installer-ubuntu
bazel安装包下载地址:https://github.com/bazelbuild/bazel/releases