summaryrefslogtreecommitdiff
path: root/grpc/tools/bazel.rc
blob: b5e3d74a51ee755f81602d94ed81db7a10887bdd (plain)
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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
# bazelrc file

# for platform-appropriate cxxopts
common --enable_platform_specific_config

build:windows --cxxopt='/std:c++14'
build:windows --host_cxxopt='/std:c++14'
build:linux   --cxxopt='-std=c++14'
build:linux   --host_cxxopt='-std=c++14'
build:macos   --cxxopt='-std=c++14'
build:macos   --host_cxxopt='-std=c++14'
build:freebsd   --cxxopt='-std=c++14'
build:freebsd   --host_cxxopt='-std=c++14'

# Don't trigger --config=<host platform> when cross-compiling.
build:android --noenable_platform_specific_config
build:ios --noenable_platform_specific_config

build --client_env=CC=clang
build --copt=-DGRPC_BAZEL_BUILD
build --host_copt=-DGRPC_BAZEL_BUILD
build --action_env=GRPC_BAZEL_RUNTIME=1
build --define=use_fast_cpp_protos=true

build:opt --compilation_mode=opt
build:opt --copt=-Wframe-larger-than=16384

build:dbg --compilation_mode=dbg
build:dbg --copt=-Werror=return-stack-address

# Dynamic link cause issues like: `dyld: malformed mach-o: load commands size (59272) > 32768`
# https://github.com/bazelbuild/bazel/issues/9190
build:macos --dynamic_mode=off

build:windows_opt --compilation_mode=opt
build:windows_dbg --compilation_mode=dbg

build:asan --strip=never
build:asan --copt=-fsanitize=address
build:asan --copt=-O0
build:asan --copt=-fno-omit-frame-pointer
build:asan --copt=-DGPR_NO_DIRECT_SYSCALLS
build:asan --copt=-DGRPC_ASAN
build:asan --copt=-DADDRESS_SANITIZER  # used by absl
build:asan --linkopt=-fsanitize=address
build:asan --action_env=ASAN_OPTIONS=detect_leaks=1:color=always
build:asan --action_env=LSAN_OPTIONS=suppressions=test/core/util/lsan_suppressions.txt:report_objects=1

build:fuzzer_asan --strip=never
build:fuzzer_asan --define=grpc_build_fuzzers=true
build:fuzzer_asan --copt=-fsanitize=fuzzer,address
build:fuzzer_asan --copt=-fsanitize-coverage=edge
build:fuzzer_asan --copt=-fsanitize-coverage=trace-cmp
build:fuzzer_asan --copt=-O0
build:fuzzer_asan --copt=-fno-omit-frame-pointer
build:fuzzer_asan --copt=-DGPR_NO_DIRECT_SYSCALLS
build:fuzzer_asan --copt=-DGRPC_ASAN
build:fuzzer_asan --copt=-DADDRESS_SANITIZER  # used by absl
build:fuzzer_asan --linkopt=-fsanitize=fuzzer,address
build:fuzzer_asan --action_env=ASAN_OPTIONS=detect_leaks=1:color=always
build:fuzzer_asan --action_env=LSAN_OPTIONS=suppressions=test/core/util/lsan_suppressions.txt:report_objects=1

build:coverage --copt=-fprofile-instr-generate
build:coverage --copt=-fcoverage-mapping
build:coverage --linkopt=-fprofile-instr-generate

build:fork_support --cxxopt=-DGRPC_ENABLE_FORK_SUPPORT=1
build:fork_support --cxxopt=-DGRPC_POSIX_FORK_ALLOW_PTHREAD_ATFORK=1
build:fork_support --action_env=GRPC_ENABLE_FORK_SUPPORT=1


# We have a separate ASAN config for Mac OS to workaround a couple of bugs:
# 1. https://github.com/bazelbuild/bazel/issues/6932
#    _FORTIFY_SOURCE=1 is enabled by default on Mac OS, which breaks ASAN.
#    We workaround it by setting _FORTIFY_SOURCE=0 and ignoring macro redefined
#    warnings.
# 2. https://github.com/google/sanitizers/issues/1026
#    LSAN is not supported by the version of Clang that ships with Mac OS, so
#    we disable it.
build:asan_macos --strip=never
build:asan_macos --copt=-fsanitize=address
build:asan_macos --copt -Wno-macro-redefined
build:asan_macos --copt -D_FORTIFY_SOURCE=0
build:asan_macos --copt=-fsanitize=address
build:asan_macos --copt=-O0
build:asan_macos --copt=-fno-omit-frame-pointer
build:asan_macos --copt=-DGPR_NO_DIRECT_SYSCALLS
build:asan_macos --linkopt=-fsanitize=address
build:asan_macos --action_env=ASAN_OPTIONS=detect_leaks=0
build:asan_macos --dynamic_mode=off

build:msan --strip=never
build:msan --copt=-fsanitize=memory
build:msan --copt=-O0
build:msan --copt=-fsanitize-memory-track-origins
build:msan --copt=-fsanitize-memory-use-after-dtor
build:msan --copt=-fno-omit-frame-pointer
build:msan --copt=-DGPR_NO_DIRECT_SYSCALLS
build:msan --linkopt=-fsanitize=memory
build:msan --action_env=MSAN_OPTIONS=poison_in_dtor=1

build:tsan --strip=never
build:tsan --copt=-fsanitize=thread
build:tsan --copt=-fno-omit-frame-pointer
build:tsan --copt=-DGPR_NO_DIRECT_SYSCALLS
build:tsan --copt=-DGRPC_TSAN
build:tsan --linkopt=-fsanitize=thread
build:tsan --action_env=TSAN_OPTIONS=suppressions=test/core/util/tsan_suppressions.txt:halt_on_error=1:second_deadlock_stack=1

# a TSAN build that tries to create new threads whenever possible
build:thready_tsan --strip=never
build:thready_tsan --copt=-fsanitize=thread
build:thready_tsan --copt=-fno-omit-frame-pointer
build:thready_tsan --copt=-DGPR_NO_DIRECT_SYSCALLS
build:thready_tsan --copt=-DGRPC_TSAN
build:thready_tsan --copt=-DGRPC_MAXIMIZE_THREADYNESS
build:thready_tsan --linkopt=-fsanitize=thread
build:thready_tsan --action_env=TSAN_OPTIONS=suppressions=test/core/util/tsan_suppressions.txt:halt_on_error=1:second_deadlock_stack=1

build:tsan_macos --strip=never
build:tsan_macos --copt=-fsanitize=thread
build:tsan_macos --copt=-fno-omit-frame-pointer
build:tsan_macos --copt=-DGPR_NO_DIRECT_SYSCALLS
build:tsan_macos --copt=-DGRPC_TSAN
build:tsan_macos --linkopt=-fsanitize=thread
build:tsan_macos --action_env=TSAN_OPTIONS=suppressions=test/core/util/tsan_suppressions.txt:halt_on_error=1:second_deadlock_stack=1
build:tsan_macos --dynamic_mode=off

build:ubsan --strip=never
build:ubsan --copt=-fsanitize=undefined
build:ubsan --copt=-fsanitize-link-c++-runtime
build:ubsan --copt=-fno-omit-frame-pointer
build:ubsan --copt=-DGRPC_UBSAN
build:ubsan --copt=-DNDEBUG
build:ubsan --copt=-fno-sanitize=function,vptr
build:ubsan --linkopt=-fsanitize=undefined
# avoid ubsan build error with int128 by linking against libc++
# see b/200667821
build:ubsan --linkopt=-fsanitize-link-c++-runtime
build:ubsan --linkopt=-lc++
build:ubsan --linkopt=-lc++abi
build:ubsan --linkopt=-lm
build:ubsan --action_env=UBSAN_OPTIONS=halt_on_error=1:print_stacktrace=1:suppressions=test/core/util/ubsan_suppressions.txt
# if you want to run ubsan locally, uncomment following three lines
# build:ubsan --linkopt=-lgcc_s
# build:ubsan --linkopt=-lubsan
# build:ubsan --linkopt=--rtlib=compiler-rt

build:python_single_threaded_unary_stream --test_env="GRPC_SINGLE_THREADED_UNARY_STREAM=true"

build:python_poller_engine --test_env="GRPC_ASYNCIO_ENGINE=poller"

# Compile database generation config
build:compdb --build_tag_filters=-nocompdb --features=-layering_check

try-import %workspace%/tools/fuzztest.bazelrc
build:fuzztest --cxxopt=-std=c++17

build:fuzztest_test --cxxopt=-std=c++17