1
1
# Envoy specific Bazel build/test options.
2
2
3
+ # Bazel doesn't need more than 200MB of memory for local build based on memory profiling:
4
+ # https://docs.bazel.build/versions/master/skylark/performance.html#memory-profiling
5
+ # The default JVM max heapsize is 1/4 of physical memory up to 32GB which could be large
6
+ # enough to consume all memory constrained by cgroup in large host, which is the case in CircleCI.
7
+ # Limiting JVM heapsize here to let it do GC more when approaching the limit to
8
+ # leave room for compiler/linker.
9
+ # The number 2G is choosed heuristically to both support in CircleCI and large enough for RBE.
10
+ # Startup options cannot be selected via config.
11
+ startup --host_jvm_args=-Xmx2g
12
+
3
13
build --workspace_status_command=bazel/get_workspace_status
14
+ build --experimental_remap_main_repo
15
+ build --experimental_local_memory_estimate
16
+ build --host_force_python=PY2
17
+ build --action_env=BAZEL_LINKLIBS=-l%:libstdc++.a
18
+ build --action_env=BAZEL_LINKOPTS=-lm:-static-libgcc
19
+ build --host_javabase=@bazel_tools//tools/jdk:remote_jdk11
20
+ build --javabase=@bazel_tools//tools/jdk:remote_jdk11
21
+
22
+ # Pass PATH, CC and CXX variables from the environment.
23
+ build --action_env=CC
24
+ build --action_env=CXX
25
+ build --action_env=PATH
4
26
5
27
# Basic ASAN/UBSAN that works for gcc
28
+ build:asan --action_env=BAZEL_LINKLIBS=
29
+ build:asan --action_env=BAZEL_LINKOPTS=-lstdc++:-lm
6
30
build:asan --define ENVOY_CONFIG_ASAN=1
7
31
build:asan --copt -fsanitize=address,undefined
8
32
build:asan --linkopt -fsanitize=address,undefined
@@ -14,37 +38,110 @@ build:asan --build_tag_filters=-no_asan
14
38
build:asan --test_tag_filters=-no_asan
15
39
build:asan --define signal_trace=disabled
16
40
build:asan --copt -DADDRESS_SANITIZER=1
41
+ build:asan --copt -D__SANITIZE_ADDRESS__
42
+ build:asan --test_env=ASAN_OPTIONS=handle_abort=1:allow_addr2line=true:check_initialization_order=true:strict_init_order=true:detect_odr_violation=1
43
+ build:asan --test_env=UBSAN_OPTIONS=halt_on_error=true:print_stacktrace=1
44
+ build:asan --test_env=ASAN_SYMBOLIZER_PATH
45
+
46
+ # Clang ASAN/UBSAN
47
+ build:clang-asan --config=asan
48
+ build:clang-asan --linkopt -fuse-ld=lld
49
+
50
+ # macOS ASAN/UBSAN
51
+ build:macos-asan --config=asan
52
+ # Workaround, see https://github.com/bazelbuild/bazel/issues/6932
53
+ build:macos-asan --copt -Wno-macro-redefined
54
+ build:macos-asan --copt -D_FORTIFY_SOURCE=0
55
+ # Workaround, see https://github.com/bazelbuild/bazel/issues/4341
56
+ build:macos-asan --copt -DGRPC_BAZEL_BUILD
57
+ # Dynamic link cause issues like: `dyld: malformed mach-o: load commands size (59272) > 32768`
58
+ build:macos-asan --dynamic_mode=off
17
59
18
- # Clang 5.0 ASAN/UBSAN
19
- build:clang-asan --define ENVOY_CONFIG_ASAN=1
20
- build:clang-asan --copt -D__SANITIZE_ADDRESS__
21
- build:clang-asan --copt -fsanitize=address,undefined
22
- build:clang-asan --linkopt -fsanitize=address,undefined
23
- build:clang-asan --copt -fno-sanitize=vptr
24
- build:clang-asan --linkopt -fno-sanitize=vptr
25
- build:clang-asan --copt -fno-sanitize-recover=all
26
- build:clang-asan --linkopt -ldl
27
- build:clang-asan --define tcmalloc=disabled
28
- build:clang-asan --build_tag_filters=-no_asan
29
- build:clang-asan --test_tag_filters=-no_asan
30
- build:clang-asan --define signal_trace=disabled
31
- build:clang-asan --copt -DADDRESS_SANITIZER=1
32
- build:clang-asan --test_env=ASAN_SYMBOLIZER_PATH
33
- build:clang-asan --test_env=ASAN_OPTIONS=handle_abort=1
34
-
35
- # Clang 5.0 TSAN
60
+ # Clang TSAN
36
61
build:clang-tsan --define ENVOY_CONFIG_TSAN=1
37
62
build:clang-tsan --copt -fsanitize=thread
38
63
build:clang-tsan --linkopt -fsanitize=thread
64
+ build:clang-tsan --linkopt -fuse-ld=lld
65
+ build:clang-tsan --linkopt -static-libsan
39
66
build:clang-tsan --define tcmalloc=disabled
67
+ # Needed due to https://github.com/libevent/libevent/issues/777
68
+ build:clang-tsan --copt -DEVENT__DISABLE_DEBUG_MODE
40
69
41
- # Clang 5.0 MSAN - broken today since we need to rebuild lib[std]c++ and external deps with MSAN
70
+ # Clang MSAN - broken today since we need to rebuild lib[std]c++ and external deps with MSAN
42
71
# support (see https://github.com/envoyproxy/envoy/issues/443).
43
72
build:clang-msan --define ENVOY_CONFIG_MSAN=1
44
73
build:clang-msan --copt -fsanitize=memory
45
74
build:clang-msan --linkopt -fsanitize=memory
46
75
build:clang-msan --define tcmalloc=disabled
47
76
build:clang-msan --copt -fsanitize-memory-track-origins=2
48
77
78
+ # Clang with libc++
79
+ # TODO(cmluciano) fix and re-enable _LIBCPP_VERSION testing for TCMALLOC in Envoy::Stats::TestUtil::hasDeterministicMallocStats
80
+ # and update stats_integration_test with appropriate m_per_cluster value
81
+ build:libc++ --action_env=CXXFLAGS=-stdlib=libc++
82
+ build:libc++ --action_env=BAZEL_CXXOPTS=-stdlib=libc++
83
+ build:libc++ --action_env=BAZEL_LINKLIBS=-l%:libc++.a:-l%:libc++abi.a:-lm
84
+ build:libc++ --host_linkopt=-fuse-ld=lld
85
+ build:libc++ --define force_libcpp=enabled
86
+
87
+ # Optimize build for binary size reduction.
88
+ build:sizeopt -c opt --copt -Os
89
+
49
90
# Test options
50
- test --test_env=HEAPCHECK=normal --test_env=PPROF_PATH
91
+ build --test_env=HEAPCHECK=normal --test_env=PPROF_PATH
92
+
93
+ # Remote execution: https://docs.bazel.build/versions/master/remote-execution.html
94
+ build:rbe-toolchain --host_platform=@envoy//bazel/toolchains:rbe_ubuntu_clang_platform
95
+ build:rbe-toolchain --platforms=@envoy//bazel/toolchains:rbe_ubuntu_clang_platform
96
+ build:rbe-toolchain --action_env=BAZEL_DO_NOT_DETECT_CPP_TOOLCHAIN=1
97
+
98
+ build:rbe-toolchain-clang --config=rbe-toolchain
99
+ build:rbe-toolchain-clang --crosstool_top=@rbe_ubuntu_clang//cc:toolchain
100
+ build:rbe-toolchain-clang --extra_toolchains=@rbe_ubuntu_clang//config:cc-toolchain
101
+ build:rbe-toolchain-clang --action_env=CC=clang --action_env=CXX=clang++ --action_env=PATH=/usr/sbin:/usr/bin:/sbin:/bin:/usr/lib/llvm-8/bin
102
+
103
+ build:rbe-toolchain-clang-libc++ --config=rbe-toolchain
104
+ build:rbe-toolchain-clang-libc++ --crosstool_top=@rbe_ubuntu_clang_libcxx//cc:toolchain
105
+ build:rbe-toolchain-clang-libc++ --extra_toolchains=@rbe_ubuntu_clang_libcxx//config:cc-toolchain
106
+ build:rbe-toolchain-clang-libc++ --action_env=CC=clang --action_env=CXX=clang++ --action_env=PATH=/usr/sbin:/usr/bin:/sbin:/bin:/usr/lib/llvm-8/bin
107
+
108
+ build:rbe-toolchain-gcc --config=rbe-toolchain
109
+ build:rbe-toolchain-gcc --crosstool_top=@rbe_ubuntu_gcc//cc:toolchain
110
+ build:rbe-toolchain-gcc --extra_toolchains=@rbe_ubuntu_gcc//config:cc-toolchain
111
+
112
+ build:remote --spawn_strategy=remote,sandboxed,local
113
+ build:remote --strategy=Javac=remote,sandboxed,local
114
+ build:remote --strategy=Closure=remote,sandboxed,local
115
+ build:remote --strategy=Genrule=remote,sandboxed,local
116
+ build:remote --remote_timeout=3600
117
+ build:remote --auth_enabled=true
118
+ build:remote --experimental_inmemory_jdeps_files
119
+ build:remote --experimental_inmemory_dotd_files
120
+ build:remote --experimental_remote_download_outputs=toplevel
121
+ test:remote --experimental_remote_download_outputs=minimal
122
+
123
+ build:remote-clang --config=remote
124
+ build:remote-clang --config=rbe-toolchain-clang
125
+
126
+ # Docker sandbox
127
+ build:docker-sandbox --experimental_docker_image=envoyproxy/envoy-build:8246167b9d238797cbc6c03dccc9e3921c37617d
128
+ build:docker-sandbox --spawn_strategy=docker
129
+ build:docker-sandbox --strategy=Javac=docker
130
+ build:docker-sandbox --strategy=Closure=docker
131
+ build:docker-sandbox --strategy=Genrule=docker
132
+ build:docker-sandbox --define=EXECUTOR=remote
133
+ build:docker-sandbox --experimental_docker_verbose
134
+ build:docker-sandbox --experimental_enable_docker_sandbox
135
+
136
+ build:docker-clang --config=docker-sandbox
137
+ build:docker-clang --config=rbe-toolchain-clang
138
+
139
+ # CI configurations
140
+ build:remote-ci --remote_cache=grpcs://remotebuildexecution.googleapis.com
141
+ build:remote-ci --remote_executor=grpcs://remotebuildexecution.googleapis.com
142
+
143
+ # Fuzz builds
144
+ build:asan-fuzzer --config=asan
145
+ build:asan-fuzzer --define=FUZZING_ENGINE=libfuzzer
146
+ build:asan-fuzzer --copt=-DFUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
147
+ build:asan-fuzzer --copt=-fsanitize-coverage=trace-pc-guard
0 commit comments