build cache and bazel build --config=foo

275 views
Skip to first unread message

Ming Zhao

unread,
Jul 14, 2015, 12:25:22 PM7/14/15
to bazel-...@googlegroups.com
Current the build output is stored inside
bazel-out/${toolchain_identifier}-${build-mode}, like bazel-out/clang-fastbuild

which causes an issue that if I switch build config like bazel build
--config=asan, the existing build cache inside fastbuild will be
overwritten, once I want to switch back to normal fastbuild, the whole
build cache needs to be invalidated and pretty much everything needs
to be recompiled. I guess there might not be a problem for Google
internally because you have another remote cache, but given that there
is no cache support in bazel yet, is there any recommended way to work
around this problem? Thanks!

- Ming

Han-Wen Nienhuys

unread,
Jul 15, 2015, 2:53:47 AM7/15/15
to Ming Zhao, bazel-...@googlegroups.com
You can switch --output_base to have a different action cache for the
asan build.
> --
> You received this message because you are subscribed to the Google Groups "bazel-discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to bazel-discus...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/bazel-discuss/CAN0GiO1UOFZMpj_OegdkEv8XwTqrPYXVfuaCBDTK2UTn_R%3D1Gg%40mail.gmail.com.
> For more options, visit https://groups.google.com/d/optout.



--
Han-Wen Nienhuys
Google Munich
han...@google.com

Ming Zhao

unread,
Jul 15, 2015, 12:31:58 PM7/15/15
to Han-Wen Nienhuys, bazel-...@googlegroups.com
I would expect I can do something like
build:asan --output_base bazel-asan
in my bazel.rc, but it turned out --output_base has to be specified in
the command line explicitly.

But thanks any way.

Kristina Chodorow

unread,
Jul 16, 2015, 3:06:08 AM7/16/15
to Ming Zhao, Han-Wen Nienhuys, bazel-...@googlegroups.com
output_base is not a build option (it's called a startup option because it's parsed before the server starts up and goes before the command, e.g., bazel --output_base=bazel-asan build //foo) so you'd have to say

startup --output_base bazel-asan

Unfortunately, this doesn't really work for you because you can't say startup:asan (the startup flags are used before the bazel server launches but the asan config is parsed by the bazel server).

cns...@gmail.com

unread,
11:59 AM (5 hours ago) 11:59 AM
to bazel-discuss
Instead of --output_base, is --platform_suffix a good option? 
build:asan --platform_suffix asan

Reply all
Reply to author
Forward
0 new messages