-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Expand file tree
/
Copy path.bazelrc
More file actions
89 lines (77 loc) · 3.81 KB
/
Copy path.bazelrc
File metadata and controls
89 lines (77 loc) · 3.81 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Bazel doesn't need more than 200MB of memory for local build based on memory profiling:
# https://docs.bazel.build/versions/master/skylark/performance.html#memory-profiling
# The default JVM max heapsize is 1/4 of physical memory up to 32GB which could be large
# enough to consume all memory constrained by cgroup in large host.
# Limiting JVM heapsize here to let it do GC more when approaching the limit to
# leave room for compiler/linker.
# The number 3G is chosen heuristically to both support large VM and small VM with RBE.
# Startup options cannot be selected via config.
startup --host_jvm_args=-Xmx3g
startup --host_jvm_args="-DBAZEL_TRACK_SOURCE_DIRECTORIES=1"
# Default build options. These are applied first and unconditionally.
common --registry=https://bcr.bazel.build
common --registry=https://baidu.github.io/babylon/registry
common --registry=https://raw.githubusercontent.com/apache/brpc/master/registry
build --verbose_failures
# Keep SHT_SYMTAB in built binaries so google::Symbolize can resolve
# in-binary functions (e.g. TestBody() in test binaries) by name
# instead of falling back to "<unknown>". Bazel's default
# `--strip=sometimes` strips debug/symbol sections in fastbuild mode,
# which is what `bazel test` uses unless `-c dbg` is given.
build --strip=never
build --cxxopt="-std=c++17"
build --copt="-fno-omit-frame-pointer"
# Use gnu17 for asm keyword.
build --conlyopt="-std=gnu17"
# Enable position independent code (this is the default on macOS and Windows)
# (Workaround for https://github.com/bazelbuild/rules_foreign_cc/issues/421)
build --copt=-fPIC
build --fission=dbg,opt
build --features=per_object_debug_info
# We already have absl in the build, define absl=1 to tell googletest to use absl for backtrace.
build --define absl=1
build:rdma --define BRPC_WITH_RDMA=true
# For UT.
build:test --define BRPC_BUILD_FOR_UNITTEST=true
# Hide libunwind's `_Unwind_*` symbols so they don't preempt libgcc_s at
# runtime. Without this, pthread_exit / C++ exception unwinding crashes
# when libunwind.so appears earlier in the dynamic link chain.
# See registry/modules/1.8.1/overlay/BUILD.bazel for details.
build:test --define with_bthread_tracer=false
build:test --define libunwind_hide_unwind_symbols=true
test --config=test
test --test_output=streamed
# Pass PATH, CC, CXX and LLVM_CONFIG variables from the environment.
build --action_env=CC
build --action_env=CXX
build --action_env=LLVM_CONFIG
build --action_env=PATH
# Basic ASAN
build:asan --define=with_asan=true
build:asan --copt -fsanitize=address
build:asan --linkopt -fsanitize=address
# ASAN needs -O1 to get reasonable performance.
build:asan --copt -O1
build:asan --copt -fno-optimize-sibling-calls
# macOS ASAN
build:macos-asan --config=asan
# Workaround, see https://github.com/bazelbuild/bazel/issues/6932
build:macos-asan --copt -Wno-macro-redefined
build:macos-asan --copt -D_FORTIFY_SOURCE=0
# Dynamic link cause issues like: `dyld: malformed mach-o: load commands size (59272) > 32768`
build:macos-asan --dynamic_mode=off
test:asan --test_env=ASAN_OPTIONS=detect_leaks=0:detect_stack_use_after_return=1