1# bazelrc file 2 3# Bazel 7 begins to enable module by default which breaks gRPC build. 4# Therefore, this option is disabled until gRPC works with bzlmod. 5common --enable_bzlmod=false 6 7# for platform-appropriate cxxopts 8common --enable_platform_specific_config 9 10build:windows --cxxopt='/std:c++14' 11build:windows --host_cxxopt='/std:c++14' 12build:linux --cxxopt='-std=c++14' 13build:linux --host_cxxopt='-std=c++14' 14build:macos --cxxopt='-std=c++14' 15build:macos --host_cxxopt='-std=c++14' 16build:freebsd --cxxopt='-std=c++14' 17build:freebsd --host_cxxopt='-std=c++14' 18 19# TODO(veblush): Remove these once upb is upgraded to 25.x or later 20build:linux --copt=-Wno-typedef-redefinition 21build:linux --host_copt=-Wno-typedef-redefinition 22build:macos --copt=-Wno-typedef-redefinition 23build:macos --host_copt=-Wno-typedef-redefinition 24 25# Don't trigger --config=<host platform> when cross-compiling. 26build:android --noenable_platform_specific_config 27build:ios --noenable_platform_specific_config 28 29build --client_env=CC=clang 30build --copt=-DGRPC_BAZEL_BUILD 31build --host_copt=-DGRPC_BAZEL_BUILD 32build --action_env=GRPC_BAZEL_RUNTIME=1 33build --define=use_fast_cpp_protos=true 34 35build:opt --compilation_mode=opt 36build:opt --copt=-Wframe-larger-than=16384 37 38build:dbg --compilation_mode=dbg 39 40# Dynamic link cause issues like: `dyld: malformed mach-o: load commands size (59272) > 32768` 41# https://github.com/bazelbuild/bazel/issues/9190 42build:macos --dynamic_mode=off 43 44build:windows_opt --compilation_mode=opt 45build:windows_dbg --compilation_mode=dbg 46 47build:asan --strip=never 48build:asan --copt=-fsanitize=address 49build:asan --copt=-O0 50build:asan --copt=-fno-omit-frame-pointer 51build:asan --copt=-DGPR_NO_DIRECT_SYSCALLS 52build:asan --copt=-DGRPC_ASAN 53build:asan --copt=-DADDRESS_SANITIZER # used by absl 54build:asan --linkopt=-fsanitize=address 55build:asan --action_env=ASAN_OPTIONS=detect_leaks=1:color=always 56build:asan --action_env=LSAN_OPTIONS=suppressions=test/core/util/lsan_suppressions.txt:report_objects=1 57 58build:fuzzer_asan --strip=never 59build:fuzzer_asan --define=grpc_build_fuzzers=true 60build:fuzzer_asan --copt=-fsanitize=fuzzer,address 61build:fuzzer_asan --copt=-fsanitize-coverage=edge 62build:fuzzer_asan --copt=-fsanitize-coverage=trace-cmp 63build:fuzzer_asan --copt=-O0 64build:fuzzer_asan --copt=-fno-omit-frame-pointer 65build:fuzzer_asan --copt=-DGPR_NO_DIRECT_SYSCALLS 66build:fuzzer_asan --copt=-DGRPC_ASAN 67build:fuzzer_asan --copt=-DADDRESS_SANITIZER # used by absl 68build:fuzzer_asan --linkopt=-fsanitize=fuzzer,address 69build:fuzzer_asan --action_env=ASAN_OPTIONS=detect_leaks=1:color=always 70build:fuzzer_asan --action_env=LSAN_OPTIONS=suppressions=test/core/util/lsan_suppressions.txt:report_objects=1 71 72build:coverage --copt=-fprofile-instr-generate 73build:coverage --copt=-fcoverage-mapping 74build:coverage --linkopt=-fprofile-instr-generate 75 76build:fork_support --cxxopt=-DGRPC_ENABLE_FORK_SUPPORT=1 77build:fork_support --cxxopt=-DGRPC_POSIX_FORK_ALLOW_PTHREAD_ATFORK=1 78build:fork_support --action_env=GRPC_ENABLE_FORK_SUPPORT=1 79 80 81# We have a separate ASAN config for Mac OS to workaround a couple of bugs: 82# 1. https://github.com/bazelbuild/bazel/issues/6932 83# _FORTIFY_SOURCE=1 is enabled by default on Mac OS, which breaks ASAN. 84# We workaround it by setting _FORTIFY_SOURCE=0 and ignoring macro redefined 85# warnings. 86# 2. https://github.com/google/sanitizers/issues/1026 87# LSAN is not supported by the version of Clang that ships with Mac OS, so 88# we disable it. 89build:asan_macos --strip=never 90build:asan_macos --copt=-fsanitize=address 91build:asan_macos --copt -Wno-macro-redefined 92build:asan_macos --copt -D_FORTIFY_SOURCE=0 93build:asan_macos --copt=-fsanitize=address 94build:asan_macos --copt=-O0 95build:asan_macos --copt=-fno-omit-frame-pointer 96build:asan_macos --copt=-DGPR_NO_DIRECT_SYSCALLS 97build:asan_macos --linkopt=-fsanitize=address 98build:asan_macos --action_env=ASAN_OPTIONS=detect_leaks=0 99build:asan_macos --dynamic_mode=off 100 101build:msan --strip=never 102build:msan --copt=-fsanitize=memory 103build:msan --copt=-O0 104build:msan --copt=-fsanitize-memory-track-origins 105build:msan --copt=-fsanitize-memory-use-after-dtor 106build:msan --copt=-fno-omit-frame-pointer 107build:msan --copt=-DGPR_NO_DIRECT_SYSCALLS 108build:msan --linkopt=-fsanitize=memory 109build:msan --action_env=MSAN_OPTIONS=poison_in_dtor=1 110 111build:tsan --strip=never 112build:tsan --copt=-fsanitize=thread 113build:tsan --copt=-fno-omit-frame-pointer 114build:tsan --copt=-DGPR_NO_DIRECT_SYSCALLS 115build:tsan --copt=-DGRPC_TSAN 116build:tsan --linkopt=-fsanitize=thread 117build:tsan --action_env=TSAN_OPTIONS=suppressions=test/core/util/tsan_suppressions.txt:halt_on_error=1:second_deadlock_stack=1 118 119# a TSAN build that tries to create new threads whenever possible 120build:thready_tsan --strip=never 121build:thready_tsan --copt=-fsanitize=thread 122build:thready_tsan --copt=-fno-omit-frame-pointer 123build:thready_tsan --copt=-DGPR_NO_DIRECT_SYSCALLS 124build:thready_tsan --copt=-DGRPC_TSAN 125build:thready_tsan --copt=-DGRPC_MAXIMIZE_THREADYNESS 126build:thready_tsan --linkopt=-fsanitize=thread 127build:thready_tsan --action_env=TSAN_OPTIONS=suppressions=test/core/util/tsan_suppressions.txt:halt_on_error=1:second_deadlock_stack=1 128 129build:tsan_macos --strip=never 130build:tsan_macos --copt=-fsanitize=thread 131build:tsan_macos --copt=-fno-omit-frame-pointer 132build:tsan_macos --copt=-DGPR_NO_DIRECT_SYSCALLS 133build:tsan_macos --copt=-DGRPC_TSAN 134build:tsan_macos --linkopt=-fsanitize=thread 135build:tsan_macos --action_env=TSAN_OPTIONS=suppressions=test/core/util/tsan_suppressions.txt:halt_on_error=1:second_deadlock_stack=1 136build:tsan_macos --dynamic_mode=off 137 138build:ubsan --strip=never 139build:ubsan --copt=-fsanitize=undefined 140build:ubsan --copt=-fsanitize-link-c++-runtime 141build:ubsan --copt=-fno-omit-frame-pointer 142build:ubsan --copt=-DGRPC_UBSAN 143build:ubsan --copt=-DNDEBUG 144build:ubsan --copt=-fno-sanitize=function,vptr 145build:ubsan --linkopt=-fsanitize=undefined 146# avoid ubsan build error with int128 by linking against libc++ 147# see b/200667821 148build:ubsan --linkopt=-fsanitize-link-c++-runtime 149build:ubsan --linkopt=-lc++ 150build:ubsan --linkopt=-lc++abi 151build:ubsan --linkopt=-lm 152build:ubsan --action_env=UBSAN_OPTIONS=halt_on_error=1:print_stacktrace=1:suppressions=test/core/util/ubsan_suppressions.txt 153# if you want to run ubsan locally, uncomment following three lines 154# build:ubsan --linkopt=-lgcc_s 155# build:ubsan --linkopt=-lubsan 156# build:ubsan --linkopt=--rtlib=compiler-rt 157 158build:python_single_threaded_unary_stream --test_env="GRPC_SINGLE_THREADED_UNARY_STREAM=true" 159 160build:python_poller_engine --test_env="GRPC_ASYNCIO_ENGINE=poller" 161 162# Compile database generation config 163build:compdb --build_tag_filters=-nocompdb --features=-layering_check 164 165try-import %workspace%/tools/fuzztest.bazelrc 166build:fuzztest --cxxopt=-std=c++17 167 168build:fuzztest_test --cxxopt=-std=c++17 169 170# OpenTelemetry C++ needs this option to build with absl 171build --@io_opentelemetry_cpp//api:with_abseil 172