Files
carbon-lang/MODULE.bazel
T
Jon Ross-Perkins 74d6fc0b9f Update LLVM and use a hermetic llvm-symbolizer (#4347)
This only sets the symbolizer for our more used targets; not sure if
there's a great way to set it everywhere (I suppose I could try wrapping
cc_binary etc rules if there's a strong preference).

There is a downside here, symbolizing a fastbuild crash seems to take
about 3s. Not sure if there's a good way to get a faster llvm-symbolizer
execution...?

I tried running with the new LLVM update without the
LLVM_SYMBOLIZER_PATH, and it looks like that's insufficient. With the
settings, I now get readable crashes:

```
 #9 0x000055dc007d1724 void Carbon::Internal::CheckFail<Carbon::TemplateString<5>{"FATAL"}, Carbon::TemplateString<27>{"toolchain/driver/driver.cpp"}, 84, Carbon::TemplateString<0>{}, Carbon::TemplateString<3>{"err"}>() (/usr/local/google/home/jperkins/.cache/bazel/_bazel_jperkins/85deb7d9d96f7e0e80b42618a55969d7/sandbox/linux-sandbox/9383/execroot/_main/bazel-out/k8-fastbuild/bin/toolchain/testing/file_test.runfiles/_main/toolchain/testing/file_test+0x2894724)
```

Note the LLVM update is for
https://github.com/llvm/llvm-project/pull/109021
2024-09-27 20:41:55 +00:00

173 lines
6.8 KiB
Python

# Part of the Carbon Language project, under the Apache License v2.0 with LLVM
# Exceptions. See /LICENSE for license information.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
"""Bazel modules.
`MODULE.bazel.lock` may change locally when `bazel` is executed. This means one
of:
1. `MODULE.bazel` is changing.
- Running `bazel mod deps` provides a canonical update to
`MODULE.bazel.lock`; include the changes.
- GitHub test actions may also identify platform-specific lockfile
updates.
2. The `bazel` version doesn't match the version used to generate the
`MODULE.bazel.lock`.
- Bazel releases can change the lock file contents.
- We use Bazelisk in order to keep everyone using the same version:
https://bazel.build/install/bazelisk
- Developers are encouraged to alias `bazel` to `bazelisk` for
ease-of-use; some setups, like Homebrew, will include that with a
`bazelisk` install.
- Contribution tools documentation includes `bazelisk` setup:
https://github.com/carbon-language/carbon-lang/blob/trunk/docs/project/contribution_tools.md
- Make sure `bazelisk --version` (or `bazel --version`) matches the
version in `.bazeliskrc`.
3. The host platform hasn't yet been added to the lock file.
- Platforms tested with GitHub actions are kept up-to-date. Other
platforms may fall out of sync due to `bazel` or dependency changes,
and should be updated with a PR the same way a platform is added.
- Running `bazel mod deps` provides a canonical update to
`MODULE.bazel.lock`; create a PR with those changes in order to include
the host platform.
"""
module(name = "carbon")
http_archive = use_repo_rule(
"@bazel_tools//tools/build_defs/repo:http.bzl",
"http_archive",
)
bazel_dep(name = "bazel_skylib", version = "1.7.1")
bazel_dep(name = "rules_pkg", version = "0.10.1")
bazel_dep(name = "abseil-cpp", version = "20240116.2")
bazel_dep(name = "re2", version = "2024-06-01")
bazel_dep(name = "googletest", version = "1.14.0.bcr.1")
bazel_dep(name = "google_benchmark", version = "1.8.4")
# The registry only has an old version. We use that here to avoid a miss but
# override it with a newer version.
bazel_dep(name = "libpfm", version = "4.11.0")
libpfm_version = "4.13.0"
archive_override(
module_name = "libpfm",
integrity = "sha256-0YuXdkx1VSjBBR03bjNUXQ62DG6/hWgENoE/pbBMw9E=",
patch_strip = 1,
patches = ["@//bazel/libpfm:0001-Introduce-a-simple-native-Bazel-build.patch"],
strip_prefix = "libpfm-{0}".format(libpfm_version),
urls = ["https://sourceforge.net/projects/perfmon2/files/libpfm4/libpfm-{0}.tar.gz".format(libpfm_version)],
)
# The registry has a snapshot, but upstream is active and not regularly marking
# releases. We start with the BCR snapshot to avoid a miss and then override it
# with a more recent commit.
bazel_dep(name = "tcmalloc", version = "0.0.0-20240411-5ed309d", dev_dependency = True)
git_override(
module_name = "tcmalloc",
# HEAD as of 2024-07-14.
commit = "923df94c922e0cd2d0512c1662d374f63c2c0c96",
remote = "https://github.com/google/tcmalloc.git",
)
bazel_dep(name = "rules_bison", version = "0.2.2")
bazel_dep(name = "rules_flex", version = "0.2.1")
bazel_dep(name = "rules_m4", version = "0.2.3")
bazel_dep(name = "rules_cc", version = "0.0.9")
bazel_dep(name = "rules_proto", version = "6.0.2")
bazel_dep(name = "protobuf", version = "27.1")
libprotobuf_mutator_version = "1.3"
http_archive(
name = "com_google_libprotobuf_mutator",
build_file = "@//:third_party/libprotobuf_mutator/BUILD.txt",
sha256 = "1ee3473a6b0274494fce599539605bb19305c0efadc62b58d645812132c31baa",
strip_prefix = "libprotobuf-mutator-{0}".format(libprotobuf_mutator_version),
urls = ["https://github.com/google/libprotobuf-mutator/archive/v{0}.tar.gz".format(libprotobuf_mutator_version)],
)
bazel_dep(name = "bazel_clang_tidy", dev_dependency = True)
git_override(
module_name = "bazel_clang_tidy",
# HEAD as of 2024-03-12.
commit = "bff5c59c843221b05ef0e37cef089ecc9d24e7da",
remote = "https://github.com/erenon/bazel_clang_tidy.git",
)
bazel_cc_toolchain = use_extension(
"//bazel/cc_toolchains:clang_configuration.bzl",
"clang_toolchain_extension",
)
use_repo(bazel_cc_toolchain, "bazel_cc_toolchain")
register_toolchains("@bazel_cc_toolchain//:all")
bazel_dep(name = "hedron_compile_commands", dev_dependency = True)
git_override(
module_name = "hedron_compile_commands",
# HEAD as of 2024-03-12.
commit = "204aa593e002cbd177d30f11f54cff3559110bb9",
remote = "https://github.com/hedronvision/bazel-compile-commands-extractor.git",
)
boost_unordered_version = "1.85.0"
http_archive(
name = "boost_unordered",
build_file = "@//:third_party/boost_unordered/BUILD.bazel",
integrity = "sha256-2dQ4IQH/xFiK1iWCkrMYLeR8zsSQqGchKOdTuf1u0zI=",
strip_prefix = "boost_unordered-{0}".format(boost_unordered_version),
urls = ["https://github.com/MikePopoloski/boost_unordered/archive/v{0}.tar.gz".format(boost_unordered_version)],
)
# Required for llvm-project.
bazel_dep(name = "platforms", version = "0.0.10")
bazel_dep(name = "zlib", version = "1.3.1.bcr.3", repo_name = "llvm_zlib")
bazel_dep(name = "zstd", version = "1.5.6", repo_name = "llvm_zstd")
###############################################################################
# llvm-project
###############################################################################
# We pin to specific upstream commits and try to track top-of-tree reasonably
# closely rather than pinning to a specific release.
# HEAD as of 2024-09-25.
llvm_project_version = "29b92d07746fac26cd64c914bc9c5c3833974f6d"
# Load a repository for the raw llvm-project, pre-overlay.
http_archive(
name = "llvm-raw",
build_file_content = "# empty",
patch_args = ["-p1"],
patches = [
"@carbon//bazel/llvm_project:0001_Patch_for_mallinfo2_when_using_Bazel_build_system.patch",
"@carbon//bazel/llvm_project:0002_Added_Bazel_build_for_compiler_rt_fuzzer.patch",
],
sha256 = "3e8e93e3749454af4b64f7f34b792a4748b62fc533bca1703d33b2b04e34eb70",
strip_prefix = "llvm-project-{0}".format(llvm_project_version),
urls = ["https://github.com/llvm/llvm-project/archive/{0}.tar.gz".format(llvm_project_version)],
)
# Apply the overlay to produce llvm-project.
llvm_project = use_extension(
"//bazel/llvm_project:llvm_project.bzl",
"llvm_project",
)
use_repo(llvm_project, "llvm-project")
###############################################################################
# Python
###############################################################################
bazel_dep(name = "rules_python", version = "0.33.1")
python = use_extension("@rules_python//python/extensions:python.bzl", "python")
python.toolchain(
python_version = "3.11",
)
use_repo(python, "python_versions")