The C based gRPC (C++, Python, Ruby, Objective-C, PHP, C#) https://grpc.io/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

185 lines
7.7 KiB

# bazelrc file
# Bazel 7 begins to enable module by default which breaks gRPC build.
# Therefore, this option is disabled until gRPC works with bzlmod.
common --enable_bzlmod=false
# 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'
# TODO(veblush): Remove these once upb is upgraded to 25.x or later
build:linux --copt=-Wno-typedef-redefinition
build:linux --host_copt=-Wno-typedef-redefinition
build:macos --copt=-Wno-typedef-redefinition
build:macos --host_copt=-Wno-typedef-redefinition
# 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
# 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:clang-cl --extra_toolchains=@local_config_cc//:cc-toolchain-x64_windows-clang-cl
build:clang-cl --extra_execution_platforms=//:x64_windows-clang-cl
build:clang-cl --incompatible_enable_cc_toolchain_resolution
build:clang-cl --define=use_strict_warning_windows=true
build:clang-cl --compiler=clang-cl
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/test_util/lsan_suppressions.txt:report_objects=1
[CI] Disabled ODR violation from ASAN (#36756) https://github.com/grpc/grpc/pull/36753 has this ASAN test failure with the following error which doesn't seem to make sense. ([full log](https://btx.cloud.google.com/invocations/a587e5cc-ca1e-46ed-a3c3-199c581583db/targets)) ``` Executing tests from //test/cpp/util:grpc_tool_test@poller=epoll1 ----------------------------------------------------------------------------- ================================================================= ==15==ERROR: AddressSanitizer: odr-violation (0x7fcfa2961400): [1] size=66 'typeinfo name for google::protobuf::compiler::java::ImmutableExtensionLiteGenerator' external/com_google_protobuf/src/google/protobuf/compiler/java/lite/extension.cc in /b/f/w/bazel-out/k8-fastbuild/bin/test/cpp/util/grpc_tool_test@poller=epoll1.runfiles/com_github_grpc_grpc/test/cpp/util/../../../_solib_k8/libexternal_Scom_Ugoogle_Uprotobuf_Ssrc_Sgoogle_Sprotobuf_Scompiler_Sjava_Slite_Sliblite.so [2] size=66 'typeinfo name for google::protobuf::compiler::java::ImmutableExtensionLiteGenerator' external/com_google_protobuf/src/google/protobuf/compiler/java/lite/extension.cc in /b/f/w/bazel-out/k8-fastbuild/bin/test/cpp/util/grpc_tool_test@poller=epoll1.runfiles/com_github_grpc_grpc/test/cpp/util/../../../_solib_k8/libexternal_Scom_Ugoogle_Uprotobuf_Ssrc_Sgoogle_Sprotobuf_Scompiler_Sjava_Slite_Slibfield_Ugenerators.so These globals were registered at these points: [1]: #0 0x5626b4ea1488 in __asan_register_globals /tmp/clang-build/src/compiler-rt/lib/asan/asan_globals.cpp:369:3 #1 0x5626b4ea2559 in __asan_register_elf_globals /tmp/clang-build/src/compiler-rt/lib/asan/asan_globals.cpp:352:3 #2 0x7fcfa3fa4b99 (/lib64/ld-linux-x86-64.so.2+0x11b99) (BuildId: 7ae2aaae1a0e5b262df913ee0885582d2e327982) [2]: #0 0x5626b4ea1488 in __asan_register_globals /tmp/clang-build/src/compiler-rt/lib/asan/asan_globals.cpp:369:3 #1 0x5626b4ea2559 in __asan_register_elf_globals /tmp/clang-build/src/compiler-rt/lib/asan/asan_globals.cpp:352:3 #2 0x7fcfa3fa4b99 (/lib64/ld-linux-x86-64.so.2+0x11b99) (BuildId: 7ae2aaae1a0e5b262df913ee0885582d2e327982) ==15==HINT: if you don't care about these errors you may set ASAN_OPTIONS=detect_odr_violation=0 SUMMARY: AddressSanitizer: odr-violation: global 'typeinfo name for google::protobuf::compiler::java::ImmutableExtensionLiteGenerator' at external/com_google_protobuf/src/google/protobuf/compiler/java/lite/extension.cc in /b/f/w/bazel-out/k8-fastbuild/bin/test/cpp/util/grpc_tool_test@poller=epoll1.runfiles/com_github_grpc_grpc/test/cpp/util/../../../_solib_k8/libexternal_Scom_Ugoogle_Uprotobuf_Ssrc_Sgoogle_Sprotobuf_Scompiler_Sjava_Slite_Sliblite.so ==15==ABORTING ``` This turned out to be a known issue described at https://github.com/google/sanitizers/issues/1017 and there is much to do other than disabling the ODR test. I gave a try to "-mllvm -asan-use-private-alias=1" option but it didn't change the result so I turned into this way. Closes #36756 COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/36756 from veblush:asan-workaround 622581e8d219b0c9419df3604b9765a06e940e9d PiperOrigin-RevId: 638421967
6 months ago
build:asan --action_env=ASAN_OPTIONS=detect_odr_violation=0 # https://github.com/google/sanitizers/issues/1017
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
# add a macro that can be used to determine that we're running under a fuzzer
# allowing different code paths to be substituted under fuzzing (say, additional
# checks)
build:fuzzer_asan --copt=-DFUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
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/test_util/lsan_suppressions.txt:report_objects=1
[CI] Disabled ODR violation from ASAN (#36756) https://github.com/grpc/grpc/pull/36753 has this ASAN test failure with the following error which doesn't seem to make sense. ([full log](https://btx.cloud.google.com/invocations/a587e5cc-ca1e-46ed-a3c3-199c581583db/targets)) ``` Executing tests from //test/cpp/util:grpc_tool_test@poller=epoll1 ----------------------------------------------------------------------------- ================================================================= ==15==ERROR: AddressSanitizer: odr-violation (0x7fcfa2961400): [1] size=66 'typeinfo name for google::protobuf::compiler::java::ImmutableExtensionLiteGenerator' external/com_google_protobuf/src/google/protobuf/compiler/java/lite/extension.cc in /b/f/w/bazel-out/k8-fastbuild/bin/test/cpp/util/grpc_tool_test@poller=epoll1.runfiles/com_github_grpc_grpc/test/cpp/util/../../../_solib_k8/libexternal_Scom_Ugoogle_Uprotobuf_Ssrc_Sgoogle_Sprotobuf_Scompiler_Sjava_Slite_Sliblite.so [2] size=66 'typeinfo name for google::protobuf::compiler::java::ImmutableExtensionLiteGenerator' external/com_google_protobuf/src/google/protobuf/compiler/java/lite/extension.cc in /b/f/w/bazel-out/k8-fastbuild/bin/test/cpp/util/grpc_tool_test@poller=epoll1.runfiles/com_github_grpc_grpc/test/cpp/util/../../../_solib_k8/libexternal_Scom_Ugoogle_Uprotobuf_Ssrc_Sgoogle_Sprotobuf_Scompiler_Sjava_Slite_Slibfield_Ugenerators.so These globals were registered at these points: [1]: #0 0x5626b4ea1488 in __asan_register_globals /tmp/clang-build/src/compiler-rt/lib/asan/asan_globals.cpp:369:3 #1 0x5626b4ea2559 in __asan_register_elf_globals /tmp/clang-build/src/compiler-rt/lib/asan/asan_globals.cpp:352:3 #2 0x7fcfa3fa4b99 (/lib64/ld-linux-x86-64.so.2+0x11b99) (BuildId: 7ae2aaae1a0e5b262df913ee0885582d2e327982) [2]: #0 0x5626b4ea1488 in __asan_register_globals /tmp/clang-build/src/compiler-rt/lib/asan/asan_globals.cpp:369:3 #1 0x5626b4ea2559 in __asan_register_elf_globals /tmp/clang-build/src/compiler-rt/lib/asan/asan_globals.cpp:352:3 #2 0x7fcfa3fa4b99 (/lib64/ld-linux-x86-64.so.2+0x11b99) (BuildId: 7ae2aaae1a0e5b262df913ee0885582d2e327982) ==15==HINT: if you don't care about these errors you may set ASAN_OPTIONS=detect_odr_violation=0 SUMMARY: AddressSanitizer: odr-violation: global 'typeinfo name for google::protobuf::compiler::java::ImmutableExtensionLiteGenerator' at external/com_google_protobuf/src/google/protobuf/compiler/java/lite/extension.cc in /b/f/w/bazel-out/k8-fastbuild/bin/test/cpp/util/grpc_tool_test@poller=epoll1.runfiles/com_github_grpc_grpc/test/cpp/util/../../../_solib_k8/libexternal_Scom_Ugoogle_Uprotobuf_Ssrc_Sgoogle_Sprotobuf_Scompiler_Sjava_Slite_Sliblite.so ==15==ABORTING ``` This turned out to be a known issue described at https://github.com/google/sanitizers/issues/1017 and there is much to do other than disabling the ODR test. I gave a try to "-mllvm -asan-use-private-alias=1" option but it didn't change the result so I turned into this way. Closes #36756 COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/36756 from veblush:asan-workaround 622581e8d219b0c9419df3604b9765a06e940e9d PiperOrigin-RevId: 638421967
6 months ago
build:fuzzer_asan --action_env=ASAN_OPTIONS=detect_odr_violation=0 # https://github.com/google/sanitizers/issues/1017
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
[CI] Disabled ODR violation from ASAN (#36756) https://github.com/grpc/grpc/pull/36753 has this ASAN test failure with the following error which doesn't seem to make sense. ([full log](https://btx.cloud.google.com/invocations/a587e5cc-ca1e-46ed-a3c3-199c581583db/targets)) ``` Executing tests from //test/cpp/util:grpc_tool_test@poller=epoll1 ----------------------------------------------------------------------------- ================================================================= ==15==ERROR: AddressSanitizer: odr-violation (0x7fcfa2961400): [1] size=66 'typeinfo name for google::protobuf::compiler::java::ImmutableExtensionLiteGenerator' external/com_google_protobuf/src/google/protobuf/compiler/java/lite/extension.cc in /b/f/w/bazel-out/k8-fastbuild/bin/test/cpp/util/grpc_tool_test@poller=epoll1.runfiles/com_github_grpc_grpc/test/cpp/util/../../../_solib_k8/libexternal_Scom_Ugoogle_Uprotobuf_Ssrc_Sgoogle_Sprotobuf_Scompiler_Sjava_Slite_Sliblite.so [2] size=66 'typeinfo name for google::protobuf::compiler::java::ImmutableExtensionLiteGenerator' external/com_google_protobuf/src/google/protobuf/compiler/java/lite/extension.cc in /b/f/w/bazel-out/k8-fastbuild/bin/test/cpp/util/grpc_tool_test@poller=epoll1.runfiles/com_github_grpc_grpc/test/cpp/util/../../../_solib_k8/libexternal_Scom_Ugoogle_Uprotobuf_Ssrc_Sgoogle_Sprotobuf_Scompiler_Sjava_Slite_Slibfield_Ugenerators.so These globals were registered at these points: [1]: #0 0x5626b4ea1488 in __asan_register_globals /tmp/clang-build/src/compiler-rt/lib/asan/asan_globals.cpp:369:3 #1 0x5626b4ea2559 in __asan_register_elf_globals /tmp/clang-build/src/compiler-rt/lib/asan/asan_globals.cpp:352:3 #2 0x7fcfa3fa4b99 (/lib64/ld-linux-x86-64.so.2+0x11b99) (BuildId: 7ae2aaae1a0e5b262df913ee0885582d2e327982) [2]: #0 0x5626b4ea1488 in __asan_register_globals /tmp/clang-build/src/compiler-rt/lib/asan/asan_globals.cpp:369:3 #1 0x5626b4ea2559 in __asan_register_elf_globals /tmp/clang-build/src/compiler-rt/lib/asan/asan_globals.cpp:352:3 #2 0x7fcfa3fa4b99 (/lib64/ld-linux-x86-64.so.2+0x11b99) (BuildId: 7ae2aaae1a0e5b262df913ee0885582d2e327982) ==15==HINT: if you don't care about these errors you may set ASAN_OPTIONS=detect_odr_violation=0 SUMMARY: AddressSanitizer: odr-violation: global 'typeinfo name for google::protobuf::compiler::java::ImmutableExtensionLiteGenerator' at external/com_google_protobuf/src/google/protobuf/compiler/java/lite/extension.cc in /b/f/w/bazel-out/k8-fastbuild/bin/test/cpp/util/grpc_tool_test@poller=epoll1.runfiles/com_github_grpc_grpc/test/cpp/util/../../../_solib_k8/libexternal_Scom_Ugoogle_Uprotobuf_Ssrc_Sgoogle_Sprotobuf_Scompiler_Sjava_Slite_Sliblite.so ==15==ABORTING ``` This turned out to be a known issue described at https://github.com/google/sanitizers/issues/1017 and there is much to do other than disabling the ODR test. I gave a try to "-mllvm -asan-use-private-alias=1" option but it didn't change the result so I turned into this way. Closes #36756 COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/36756 from veblush:asan-workaround 622581e8d219b0c9419df3604b9765a06e940e9d PiperOrigin-RevId: 638421967
6 months ago
build:asan_macos --action_env=ASAN_OPTIONS=detect_odr_violation=0 # https://github.com/google/sanitizers/issues/1017
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/test_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/test_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/test_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/test_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
# OpenTelemetry C++ needs this option to build with absl
build --@io_opentelemetry_cpp//api:with_abseil