Philipp Schrader | dada107 | 2020-11-24 11:34:46 -0800 | [diff] [blame] | 1 | # Use platforms to build our code. |
| 2 | build --incompatible_enable_cc_toolchain_resolution |
| 3 | |
Austin Schuh | 085eab9 | 2020-11-26 13:54:51 -0800 | [diff] [blame] | 4 | # Default to py3 since that's all we support |
| 5 | build --python_version=PY3 |
| 6 | |
Philipp Schrader | dada107 | 2020-11-24 11:34:46 -0800 | [diff] [blame] | 7 | # For now we only support building on x86 Linux so we can hard-code the host |
| 8 | # platform. |
| 9 | build --host_platform=//tools/platforms:linux_x86 |
Brian Silverman | fbe4fd5 | 2015-10-26 10:40:55 -0400 | [diff] [blame] | 10 | |
Brian Silverman | 5bc5434 | 2015-11-26 22:57:46 -0500 | [diff] [blame] | 11 | # Always include debug information in the non-.stripped binaries. |
| 12 | build --strip=never |
| 13 | |
Austin Schuh | da9d060 | 2019-09-15 17:29:38 -0700 | [diff] [blame] | 14 | build --noincompatible_disable_nocopts |
Brian Silverman | 78aab86 | 2020-12-16 14:15:05 -0800 | [diff] [blame] | 15 | common --noincompatible_restrict_string_escapes |
Austin Schuh | da9d060 | 2019-09-15 17:29:38 -0700 | [diff] [blame] | 16 | |
Brian Silverman | 516ceb2 | 2015-11-27 01:29:05 -0500 | [diff] [blame] | 17 | # Use the malloc we want. |
| 18 | build --custom_malloc=//tools/cpp:malloc |
| 19 | |
Philipp Schrader | dada107 | 2020-11-24 11:34:46 -0800 | [diff] [blame] | 20 | # Shortcuts for selecting the target platform. |
| 21 | build:k8 --platforms=//tools/platforms:linux_x86 |
| 22 | build:roborio --platforms=//tools/platforms:linux_roborio |
| 23 | build:armhf-debian --platforms=//tools/platforms:linux_armhf |
| 24 | build:cortex-m4f --platforms=//tools/platforms:cortex_m4f |
Austin Schuh | 0a96ea3 | 2022-01-01 22:29:30 -0800 | [diff] [blame^] | 25 | build:rp2040 --platforms=//tools/platforms:rp2040 |
Philipp Schrader | dada107 | 2020-11-24 11:34:46 -0800 | [diff] [blame] | 26 | |
Austin Schuh | c4788d1 | 2021-01-23 17:23:37 -0800 | [diff] [blame] | 27 | # Without this, we end up rebuilding from scratch every time we change compilers. This is needed to make --cpu work (even though it shouldn't be used). |
| 28 | build --crosstool_top=@//tools/cpp:toolchain --host_crosstool_top=@//tools/cpp:toolchain |
| 29 | |
Brian Silverman | 63889f9 | 2015-11-27 01:33:56 -0500 | [diff] [blame] | 30 | build:asan --copt -fsanitize=address |
| 31 | build:asan --linkopt -fsanitize=address --linkopt -ldl |
| 32 | build:asan --platform_suffix=-asan |
| 33 | build:asan --test_env ASAN_SYMBOLIZER_PATH=/usr/bin/llvm-symbolizer-3.6 |
| 34 | build:asan --test_env ASAN_OPTIONS=detect_leaks=1:check_initialization_order=1:strict_init_order=1:detect_stack_use_after_return=1:detect_odr_violation=2:allow_user_segv_handler=1 |
Brian Silverman | b466eef | 2015-11-28 20:33:44 -0500 | [diff] [blame] | 35 | build:asan --copt -fsanitize-blacklist=tools/cpp/asan-blacklist |
Brian Silverman | 7dc6adb | 2017-02-19 17:04:36 -0800 | [diff] [blame] | 36 | build:asan --define have_asan=true |
Brian Silverman | 63889f9 | 2015-11-27 01:33:56 -0500 | [diff] [blame] | 37 | |
| 38 | build:tsan --copt -fsanitize=thread --copt -DAOS_SANITIZER_thread |
| 39 | build:tsan --linkopt -fsanitize=thread |
| 40 | build:tsan --platform_suffix=-tsan |
| 41 | build:tsan --test_env TSAN_OPTIONS=external_symbolizer_path=/usr/bin/llvm-symbolizer-3.6:detect_deadlocks=1:second_deadlock_stack=1 |
Brian Silverman | 7dc6adb | 2017-02-19 17:04:36 -0800 | [diff] [blame] | 42 | build:tsan --define have_tsan=true |
Brian Silverman | 63889f9 | 2015-11-27 01:33:56 -0500 | [diff] [blame] | 43 | |
| 44 | build:isan --copt -fsanitize=integer |
| 45 | build:isan --linkopt -fsanitize=integer |
| 46 | build:isan --platform_suffix=-isan |
| 47 | build:isan --test_env LLVM_SYMBOLIZER=/usr/bin/llvm-symbolizer-3.6 |
Brian Silverman | 7dc6adb | 2017-02-19 17:04:36 -0800 | [diff] [blame] | 48 | build:isan --define have_isan=true |
Brian Silverman | 63889f9 | 2015-11-27 01:33:56 -0500 | [diff] [blame] | 49 | |
Brian Silverman | a4a4ea6 | 2015-11-27 10:27:53 -0500 | [diff] [blame] | 50 | build:ubsan --copt -fsanitize=undefined --copt -fno-sanitize-recover |
| 51 | # Bad alignment is just slow on x86 and traps on ARM, so we'll find |
| 52 | # it other ways, and some x86 code does it on purpose. |
| 53 | build:ubsan --copt -fno-sanitize=alignment |
Brian Silverman | 63889f9 | 2015-11-27 01:33:56 -0500 | [diff] [blame] | 54 | build:ubsan --linkopt -fsanitize=undefined |
Brian Silverman | b466eef | 2015-11-28 20:33:44 -0500 | [diff] [blame] | 55 | # TOOD(Brian): Remove this once Clang adds it itself like it should. |
| 56 | build:ubsan --linkopt /usr/lib/llvm-3.6/lib/clang/3.6.2/lib/linux/libclang_rt.ubsan_cxx-x86_64.a |
Brian Silverman | 63889f9 | 2015-11-27 01:33:56 -0500 | [diff] [blame] | 57 | build:ubsan --platform_suffix=-ubsan |
Brian Silverman | b466eef | 2015-11-28 20:33:44 -0500 | [diff] [blame] | 58 | build:ubsan --test_env UBSAN_OPTIONS=external_symbolizer_path=/usr/bin/llvm-symbolizer-3.6:color=always:print_stacktrace=1 |
| 59 | build:ubsan --copt -fsanitize-blacklist=tools/cpp/ubsan-blacklist |
Brian Silverman | 7dc6adb | 2017-02-19 17:04:36 -0800 | [diff] [blame] | 60 | build:ubsan --define have_ubsan=true |
Brian Silverman | 63889f9 | 2015-11-27 01:33:56 -0500 | [diff] [blame] | 61 | |
Brian Silverman | a4a4ea6 | 2015-11-27 10:27:53 -0500 | [diff] [blame] | 62 | build:msan --copt -fsanitize=memory --copt -fsanitize-memory-track-origins |
Brian Silverman | b466eef | 2015-11-28 20:33:44 -0500 | [diff] [blame] | 63 | build:msan --linkopt -fsanitize=memory --linkopt -fsanitize-memory-track-origins |
Brian Silverman | 63889f9 | 2015-11-27 01:33:56 -0500 | [diff] [blame] | 64 | build:msan --platform_suffix=-msan |
| 65 | build:msan --test_env MSAN_SYMBOLIZER_PATH=/usr/bin/llvm-symbolizer-3.6 |
Brian Silverman | 7dc6adb | 2017-02-19 17:04:36 -0800 | [diff] [blame] | 66 | build:msan --define have_msan=true |
Brian Silverman | 63889f9 | 2015-11-27 01:33:56 -0500 | [diff] [blame] | 67 | |
James Kuszmaul | 2af1ba8 | 2019-02-09 22:16:53 -0800 | [diff] [blame] | 68 | # Sometime, we want to be able to have eigen assertions run so that we can |
| 69 | # catch potential issues (e.g., accessing invalid indices). |
| 70 | build:eigen --copt -UNDEBUG |
| 71 | |
Brian Silverman | 12b3fc5 | 2015-10-11 19:38:33 -0400 | [diff] [blame] | 72 | # Show paths to a few more than just 1 target. |
Austin Schuh | 00bc093 | 2016-02-14 21:05:34 -0800 | [diff] [blame] | 73 | build --show_result 5 |
Brian Silverman | 12b3fc5 | 2015-10-11 19:38:33 -0400 | [diff] [blame] | 74 | # Dump the output of the failing test to stdout. |
| 75 | test --test_output=errors |
Brian Silverman | b200c17 | 2017-01-02 17:35:35 -0800 | [diff] [blame] | 76 | |
Austin Schuh | 9d92e6b | 2017-10-17 01:19:38 -0700 | [diff] [blame] | 77 | build --experimental_sandbox_base=/dev/shm/ |
Austin Schuh | 35c75e8 | 2017-03-11 21:54:05 -0800 | [diff] [blame] | 78 | build --experimental_multi_threaded_digest |
Austin Schuh | 9d92e6b | 2017-10-17 01:19:38 -0700 | [diff] [blame] | 79 | |
| 80 | build --sandbox_fake_hostname=true |
| 81 | build --sandbox_fake_username=true |
| 82 | |
Austin Schuh | 9d92e6b | 2017-10-17 01:19:38 -0700 | [diff] [blame] | 83 | startup --host_jvm_args=-Dbazel.DigestFunction=SHA1 |
| 84 | |
| 85 | common --watchfs |
Austin Schuh | e18baff | 2018-10-20 17:40:42 -0700 | [diff] [blame] | 86 | |
| 87 | # Switch to SHA256 for compatibility with distributed caching. |
| 88 | startup --host_jvm_args=-Dbazel.DigestFunction=SHA256 |
| 89 | |
Austin Schuh | b6043b2 | 2017-11-29 00:14:39 -0800 | [diff] [blame] | 90 | build --spawn_strategy=linux-sandbox |
Austin Schuh | e18baff | 2018-10-20 17:40:42 -0700 | [diff] [blame] | 91 | build --experimental_sandbox_default_allow_network=false |
| 92 | |
Austin Schuh | 89a9505 | 2019-04-14 14:51:14 -0700 | [diff] [blame] | 93 | build --strategy=TypeScriptCompile=worker --strategy=AngularTemplateCompile=worker |
| 94 | |
Austin Schuh | e18baff | 2018-10-20 17:40:42 -0700 | [diff] [blame] | 95 | # Use our hermetic JDK. |
| 96 | # Note that this doesn't quite work fully, but it should. See |
| 97 | # https://github.com/bazelbuild/bazel/issues/6341 for ongoing discussion with |
| 98 | # upstream about this. |
| 99 | build --javabase=@openjdk_linux_archive//:jdk --host_javabase=@openjdk_linux_archive//:jdk |
Philipp Schrader | d64e130 | 2020-12-12 18:53:00 -0800 | [diff] [blame] | 100 | |
| 101 | # Prevent falling back to the host JDK. |
| 102 | startup --noautodetect_server_javabase |