1
- # This file is inspired by its counterpart over at the Envoy repository.
2
- # The following .bazelrc content is forked from the main Envoy repository. This is necessary since
3
- # this needs to be available before we can access the Envoy repository contents via Bazel.
4
-
5
- build:clang-asan --test_timeout=900
6
- build:clang-tsan --test_timeout=900
7
- # See https://github.com/envoyproxy/nighthawk/issues/405
8
- build:macos --copt -UDEBUG
9
-
1
+ # The following .bazelrc content is forked from the main Envoy repository. # unique
2
+ # This is necessary since this needs to be available before we can access # unique
3
+ # the Envoy repository contents via Bazel. # unique
4
+ # unique
5
+ build:clang-asan --test_timeout=900 # unique
6
+ build:clang-tsan --test_timeout=900 # unique
7
+ # See https://github.com/envoyproxy/nighthawk/issues/405 # unique
8
+ build:macos --copt -UDEBUG # unique
9
+ # unique
10
10
# Envoy specific Bazel build/test options.
11
11
12
12
# Bazel doesn't need more than 200MB of memory for local build based on memory profiling:
13
13
# https://docs.bazel.build/versions/master/skylark/performance.html#memory-profiling
14
14
# The default JVM max heapsize is 1/4 of physical memory up to 32GB which could be large
15
- # enough to consume all memory constrained by cgroup in large host, which is the case in CircleCI .
15
+ # enough to consume all memory constrained by cgroup in large host.
16
16
# Limiting JVM heapsize here to let it do GC more when approaching the limit to
17
17
# leave room for compiler/linker.
18
- # The number 2G is choosed heuristically to both support in CircleCI and large enough for RBE.
18
+ # The number 2G is chosen heuristically to both support large VM and small VM with RBE.
19
19
# Startup options cannot be selected via config.
20
20
startup --host_jvm_args=-Xmx2g
21
21
@@ -28,7 +28,8 @@ build --host_javabase=@bazel_tools//tools/jdk:remote_jdk11
28
28
build --javabase=@bazel_tools//tools/jdk:remote_jdk11
29
29
build --enable_platform_specific_config
30
30
31
- # Enable position independent code, this option is not supported on Windows and default on on macOS.
31
+ # Enable position independent code (this is the default on macOS and Windows)
32
+ # (Workaround for https://github.com/bazelbuild/rules_foreign_cc/issues/421)
32
33
build:linux --copt=-fPIC
33
34
build:linux --cxxopt=-std=c++17
34
35
build:linux --conlyopt=-fexceptions
@@ -44,9 +45,6 @@ build --action_env=CXX
44
45
build --action_env=LLVM_CONFIG
45
46
build --action_env=PATH
46
47
47
- # Skip system ICU linking.
48
- build --@com_googlesource_googleurl//build_config:system_icu=0
49
-
50
48
# Common flags for sanitizers
51
49
build:sanitizer --define tcmalloc=disabled
52
50
build:sanitizer --linkopt -ldl
@@ -63,8 +61,10 @@ build:asan --config=sanitizer
63
61
# ASAN install its signal handler, disable ours so the stacktrace will be printed by ASAN
64
62
build:asan --define signal_trace=disabled
65
63
build:asan --define ENVOY_CONFIG_ASAN=1
66
- build:asan --copt -fsanitize=address,undefined
67
- build:asan --linkopt -fsanitize=address,undefined
64
+ # The following two lines were manually edited due to #593. # unique
65
+ # Flag undefined was dropped from both the lines to allow CI/ASAN to pass. # unique
66
+ build:asan --copt -fsanitize=address # unique
67
+ build:asan --linkopt -fsanitize=address # unique
68
68
# vptr and function sanitizer are enabled in clang-asan if it is set up via bazel/setup_clang.sh.
69
69
build:asan --copt -fno-sanitize=vptr,function
70
70
build:asan --linkopt -fno-sanitize=vptr,function
@@ -73,6 +73,9 @@ build:asan --copt -D__SANITIZE_ADDRESS__
73
73
build:asan --test_env=ASAN_OPTIONS=handle_abort=1:allow_addr2line=true:check_initialization_order=true:strict_init_order=true:detect_odr_violation=1
74
74
build:asan --test_env=UBSAN_OPTIONS=halt_on_error=true:print_stacktrace=1
75
75
build:asan --test_env=ASAN_SYMBOLIZER_PATH
76
+ # ASAN needs -O1 to get reasonable performance.
77
+ build:asan --copt -O1
78
+ build:asan --copt -fno-optimize-sibling-calls
76
79
77
80
# Clang ASAN/UBSAN
78
81
build:clang-asan --config=asan
@@ -121,7 +124,8 @@ build:libc++ --config=clang
121
124
build:libc++ --action_env=CXXFLAGS=-stdlib=libc++
122
125
build:libc++ --action_env=LDFLAGS=-stdlib=libc++
123
126
build:libc++ --action_env=BAZEL_CXXOPTS=-stdlib=libc++
124
- build:libc++ --action_env=BAZEL_LINKLIBS=-l%:libc++.a:-l%:libc++abi.a:-lm
127
+ build:libc++ --action_env=BAZEL_LINKLIBS=-l%:libc++.a:-l%:libc++abi.a
128
+ build:libc++ --action_env=BAZEL_LINKOPTS=-lm:-pthread
125
129
build:libc++ --define force_libcpp=enabled
126
130
127
131
# Optimize build for binary size reduction.
@@ -138,6 +142,7 @@ build:coverage --action_env=GCOV=llvm-profdata
138
142
build:coverage --copt=-DNDEBUG
139
143
# 1.5x original timeout + 300s for trace merger in all categories
140
144
build:coverage --test_timeout=390,750,1500,5700
145
+ build:coverage --define=dynamic_link_tests=true
141
146
build:coverage --define=ENVOY_CONFIG_COVERAGE=1
142
147
build:coverage --cxxopt="-DENVOY_CONFIG_COVERAGE=1"
143
148
build:coverage --coverage_support=@envoy//bazel/coverage:coverage_support
@@ -149,10 +154,10 @@ build:coverage --strategy=CoverageReport=sandboxed,local
149
154
build:coverage --experimental_use_llvm_covmap
150
155
build:coverage --collect_code_coverage
151
156
build:coverage --test_tag_filters=-nocoverage
152
- build:coverage --instrumentation_filter="//source(?!/extensions/quic_listeners/quiche/platform)[/:],//include[/:]"
153
- coverage :test-coverage --test_arg="-l trace"
154
- coverage :fuzz-coverage --config=plain-fuzzer
155
- coverage :fuzz-coverage --run_under=@envoy//bazel/coverage:fuzz_coverage_wrapper.sh
157
+ build:coverage --instrumentation_filter="//source(?!/common/chromium_url|/ extensions/quic_listeners/quiche/platform)[/:],//include[/:]"
158
+ build :test-coverage --test_arg="-l trace"
159
+ build :fuzz-coverage --config=plain-fuzzer
160
+ build :fuzz-coverage --run_under=@envoy//bazel/coverage:fuzz_coverage_wrapper.sh
156
161
157
162
# Remote execution: https://docs.bazel.build/versions/master/remote-execution.html
158
163
build:rbe-toolchain --action_env=BAZEL_DO_NOT_DETECT_CPP_TOOLCHAIN=1
@@ -174,6 +179,16 @@ build:rbe-toolchain-clang-libc++ --action_env=CXXFLAGS=-stdlib=libc++
174
179
build:rbe-toolchain-clang-libc++ --action_env=LDFLAGS=-stdlib=libc++
175
180
build:rbe-toolchain-clang-libc++ --define force_libcpp=enabled
176
181
182
+ # Do not inherit from "clang-asan" to avoid picking up flags from local clang.bazelrc.
183
+ build:rbe-toolchain-asan --config=asan
184
+ build:rbe-toolchain-asan --linkopt -fuse-ld=lld
185
+ build:rbe-toolchain-asan --action_env=ENVOY_UBSAN_VPTR=1
186
+ build:rbe-toolchain-asan --copt=-fsanitize=vptr,function
187
+ build:rbe-toolchain-asan --linkopt=-fsanitize=vptr,function
188
+ build:rbe-toolchain-asan --linkopt=-L/opt/llvm/lib/clang/11.0.1/lib/linux
189
+ build:rbe-toolchain-asan --linkopt=-l:libclang_rt.ubsan_standalone-x86_64.a
190
+ build:rbe-toolchain-asan --linkopt=-l:libclang_rt.ubsan_standalone_cxx-x86_64.a
191
+
177
192
build:rbe-toolchain-msan --linkopt=-L/opt/libcxx_msan/lib
178
193
build:rbe-toolchain-msan --linkopt=-Wl,-rpath,/opt/libcxx_msan/lib
179
194
build:rbe-toolchain-msan --config=clang-msan
@@ -224,6 +239,10 @@ build:remote-clang-libc++ --config=rbe-toolchain-clang-libc++
224
239
build:remote-gcc --config=remote
225
240
build:remote-gcc --config=rbe-toolchain-gcc
226
241
242
+ build:remote-asan --config=remote
243
+ build:remote-asan --config=rbe-toolchain-clang-libc++
244
+ build:remote-asan --config=rbe-toolchain-asan
245
+
227
246
build:remote-msan --config=remote
228
247
build:remote-msan --config=rbe-toolchain-clang-libc++
229
248
build:remote-msan --config=rbe-toolchain-msan
@@ -237,8 +256,8 @@ build:remote-clang-cl --config=clang-cl
237
256
build:remote-clang-cl --config=rbe-toolchain-clang-cl
238
257
239
258
# Docker sandbox
240
- # NOTE: Update this from https://github.com/envoyproxy/envoy-build-tools/blob/master /toolchains/rbe_toolchains_config.bzl#L8
241
- build:docker-sandbox --experimental_docker_image=envoyproxy/envoy-build-ubuntu:e7ea4e81bbd5028abb9d3a2f2c0afe063d9b62c0
259
+ # NOTE: Update this from https://github.com/envoyproxy/envoy-build-tools/blob/main /toolchains/rbe_toolchains_config.bzl#L8
260
+ build:docker-sandbox --experimental_docker_image=envoyproxy/envoy-build-ubuntu:e33c93e6d79804bf95ff80426d10bdcc9096c785
242
261
build:docker-sandbox --spawn_strategy=docker
243
262
build:docker-sandbox --strategy=Javac=docker
244
263
build:docker-sandbox --strategy=Closure=docker
@@ -269,20 +288,41 @@ build:remote-ci --remote_cache=grpcs://remotebuildexecution.googleapis.com
269
288
build:remote-ci --remote_executor=grpcs://remotebuildexecution.googleapis.com
270
289
271
290
# Fuzz builds
272
- # -DFUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION is passed in in the bazel build target
273
- # rules for fuzz tests. Passing it in the CLI will cause dependencies to be build
274
- # with the macro. Causing issues in RouteMatcherTest.TestRoutes that expect prod
275
- # behavior from RE2 library.
291
+
292
+ # Shared fuzzing configuration.
293
+ build:fuzzing --define=ENVOY_CONFIG_ASAN=1
294
+ build:fuzzing --copt=-DFUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
295
+ build:fuzzing --config=libc++
296
+
297
+ # Fuzzing without ASAN. This is useful for profiling fuzzers without any ASAN artifacts.
298
+ build:plain-fuzzer --config=fuzzing
299
+ build:plain-fuzzer --define=FUZZING_ENGINE=libfuzzer
300
+ # The fuzzing rules provide their own instrumentation, but it is currently
301
+ # disabled due to bazelbuild/bazel#12888. Instead, we provide instrumentation at
302
+ # the top level through these options.
303
+ build:plain-fuzzer --copt=-fsanitize=fuzzer-no-link
304
+ build:plain-fuzzer --linkopt=-fsanitize=fuzzer-no-link
305
+
306
+ build:asan-fuzzer --config=plain-fuzzer
276
307
build:asan-fuzzer --config=asan
277
- build:asan-fuzzer --define=FUZZING_ENGINE=libfuzzer
278
- build:asan-fuzzer --copt=-fsanitize=fuzzer-no-link
279
308
build:asan-fuzzer --copt=-fno-omit-frame-pointer
280
309
# Remove UBSAN halt_on_error to avoid crashing on protobuf errors.
281
310
build:asan-fuzzer --test_env=UBSAN_OPTIONS=print_stacktrace=1
282
311
283
- # Fuzzing without ASAN. This is useful for profiling fuzzers without any ASAN artifacts.
284
- build:plain-fuzzer --define=FUZZING_ENGINE=libfuzzer
285
- build:plain-fuzzer --define ENVOY_CONFIG_ASAN=1
312
+ build:oss-fuzz --config=fuzzing
313
+ build:oss-fuzz --define=FUZZING_ENGINE=oss-fuzz
314
+ build:oss-fuzz --@rules_fuzzing//fuzzing:cc_engine_instrumentation=oss-fuzz
315
+ build:oss-fuzz --@rules_fuzzing//fuzzing:cc_engine_sanitizer=none
316
+ build:oss-fuzz --dynamic_mode=off
317
+ build:oss-fuzz --strip=never
318
+ build:oss-fuzz --copt=-fno-sanitize=vptr
319
+ build:oss-fuzz --linkopt=-fno-sanitize=vptr
320
+ build:oss-fuzz --define=tcmalloc=disabled
321
+ build:oss-fuzz --define=signal_trace=disabled
322
+ build:oss-fuzz --copt=-D_LIBCPP_DISABLE_DEPRECATION_WARNINGS
323
+ build:oss-fuzz --define=force_libcpp=enabled
324
+ build:oss-fuzz --linkopt=-lc++
325
+ build:oss-fuzz --linkopt=-pthread
286
326
287
327
# Compile database generation config
288
328
build:compdb --build_tag_filters=-nocompdb
@@ -292,30 +332,37 @@ build:windows --action_env=TMPDIR
292
332
build:windows --define signal_trace=disabled
293
333
build:windows --define hot_restart=disabled
294
334
build:windows --define tcmalloc=disabled
335
+ build:windows --define wasm=disabled
295
336
build:windows --define manual_stamp=manual_stamp
337
+ build:windows --cxxopt="/std:c++17"
296
338
297
- # Should not be required after upstream fix to bazel,
298
- # and already a no-op to linux/macos builds
299
- # see issue https://github.com/bazelbuild/rules_foreign_cc/issues/301
339
+ # TODO(wrowe,sunjayBhatia): Resolve bugs upstream in curl and rules_foreign_cc
340
+ # See issue https://github.com/bazelbuild/rules_foreign_cc/issues/301
300
341
build:windows --copt="-DCARES_STATICLIB"
301
342
build:windows --copt="-DNGHTTP2_STATICLIB"
302
343
build:windows --copt="-DCURL_STATICLIB"
303
- build:windows --cxxopt="/std:c++17"
304
344
305
- # Required to work around build defects on Windows MSVC cl
306
- # Unguarded gcc pragmas in quiche are not recognized by MSVC
307
- build:msvc-cl --copt="/wd4068"
308
- # Allows 'nodiscard' function return values to be discarded
309
- build:msvc-cl --copt="/wd4834"
310
- # Allows inline functions to be undefined
311
- build:msvc-cl --copt="/wd4506"
312
- build:msvc-cl --copt="-D_SILENCE_EXPERIMENTAL_FILESYSTEM_DEPRECATION_WARNING"
345
+ # Override any clang preference if building msvc-cl
346
+ # Drop the determinism feature (-DDATE etc are a no-op in msvc-cl)
347
+ build:msvc-cl --action_env=USE_CLANG_CL=""
348
+ build:msvc-cl --define clang_cl=0
349
+ build:msvc-cl --features=-determinism
350
+
351
+ # Windows build behaviors when using clang-cl
352
+ build:clang-cl --action_env=USE_CLANG_CL=1
353
+ build:clang-cl --define clang_cl=1
313
354
314
355
# Required to work around Windows clang-cl build defects
315
356
# Ignore conflicting definitions of _WIN32_WINNT
316
- # Overriding __TIME__ etc is problematic (and is actually an invalid no-op)
357
+ # Override determinism flags (DATE etc) is valid on clang-cl compiler
317
358
build:clang-cl --copt="-Wno-macro-redefined"
318
359
build:clang-cl --copt="-Wno-builtin-macro-redefined"
360
+ # Workaround problematic missing override declarations of mocks
361
+ # TODO: resolve this class of problematic mocks, e.g.
362
+ # ./test/mocks/http/stream.h(16,21): error: 'addCallbacks'
363
+ # overrides a member function but is not marked 'override'
364
+ # MOCK_METHOD(void, addCallbacks, (StreamCallbacks & callbacks));
365
+ build:clang-cl --copt="-Wno-inconsistent-missing-override"
319
366
build:clang-cl --action_env=USE_CLANG_CL=1
320
367
321
368
# Defaults to 'auto' - Off for windows, so override to linux behavior
0 commit comments