参考链接:传送门
官方文档:官方文档
1. 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 文件
2. 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'