protocol-buffers - bazel 重新编译 protobuf 超出了必要的范围
问题描述
我按照这个例子,它工作正常。
但有时(并非总是)当我更改了一些与 protobuf 和重建完全无关的应用程序级代码时,bazel 会花费所有时间重新编译 protobuf。
有什么建议我可以尝试调试吗?
解决方案
我遇到了同样的问题:protobuf C++ 似乎重新编译了每个构建。构建项目的时间从大约 3 秒缩短到 30 秒。
我正在使用以下命令启动构建:
bazel build -c dbg --config=asan <target>
bazel run -c dbg --config=asan <target>
一旦我删除问题实际上就消失了--config=asan
以下是 asan 的配置方式供参考(行位于文件.bazelrc
旁边WORKSPACE
:
# 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
推荐阅读
- pycharm - Pycharm 终端不工作
- python - 在python中读取一个csv文件
- amazon-web-services - 如何使用 CloudFormation 为 Classic Load Balancer 创建多个侦听器?
- mysql - 如何在不对其进行硬编码的情况下对 phpMyAdmin 中具有 200 列和 250 行的表进行反透视?
- c# - 从头开始用于 WinForm 的 C# 功能区控件
- linux - sed 命令删除该行中的字符串及其后面的所有内容
- docker - Docker撰写不安装卷?
- sql-server - 将 SELECT TOP 与 OPTION (FAST N) 结合使用是否会改变执行计划?
- typescript - 如何使用打字稿为猫鼬创建自定义模式类型
- android - 如何动态替换Android中的按钮?