5

I followed this example, and it works fine.

But sometimes (not always) when I changed some application level code that's totally not related to protobuf and rebuild, bazel spends all its time recompiling protobuf.

Any suggestions what I can try to debug this?

bill
  • 650
  • 8
  • 17
  • Have the same problem. Build takes 30 seconds now instead of 5s before that. Every time new build starts it recompiles all the protobuf... – yname Oct 02 '19 at 18:47

1 Answers1

0

I had the same problem: protobuf C++ seemed to recompile each build. Time to build the project went from ~3s to 30s.

I was launching the build with following command:

bazel build -c dbg --config=asan <target>
bazel run -c dbg --config=asan <target>

And problem actually went away once I've removed --config=asan

For reference here is how asan is configured (lines are located in .bazelrc right next to WORKSPACE file:

# Address sanitizer
build:asan --strip=never
build:asan --copt -fsanitize=address
build:asan --copt -DADDRESS_SANITIZER
build:asan --copt -DDYNAMIC_ANNOTATIONS_ENABLED=1
build:asan --copt -g
build:asan --copt -fno-omit-frame-pointer
build:asan --copt -fsanitize-address-use-after-scope
build:asan --linkopt -fsanitize=address
build:asan --dynamic_mode=off
yname
  • 2,189
  • 13
  • 23
  • thanks! I didn't use --config=asan but still got the the recompilations... – bill Oct 08 '19 at 05:37
  • --config=asan is just a way to include all the flags defined in .bazelrc. It could be useful to check which flags are included in your build when you run `bazel build` (there could be some configured in ".bazelrc" or maybe some other way. – yname Oct 10 '19 at 21:24
  • are you suggesting that I should check through the flags I'm using and identify the one that's causing the problem? my recompilation problem is somewhat intermittent unfortunately... do you have a guess which flag in your case cause the recompilation? – bill Oct 12 '19 at 04:43