Consider retiring the "Build with Bazel provided LLVM installation" instructions
- Dominant language
- C++
- Stars
- 1.1k
- Forks
- 82
- Avg merge
- 1d 15h
- Merged PRs (30d)
- 173
Description
For several reasons:
1. The instructions as they stand, do not work. The commit hash [declared in bazel/llvm.bzl](https://github.com/google/crubit/blob/caa8f49a3767e84efde63bc3cc06880b06a1ddac/bazel/llvm.bzl#L64) is API incompatible with the crubit source code. See *Instructions as written failure* below.
2. If the commit hash is updated to something recent, the build still fails. See *Failure with updated commit* below.
3. Removing this option from the installation instructions will simplify them for users and contract the support surface.
4. The bazel build of LLVM doesn't seem actively maintained. The *Failure with updated commit* at first glance looks to be a defect in LLVM's bazel build.
## Instructions as written failure
```
dsankel@AP-PW015KJM:~/code/crubit$ bazel build --linkopt=-fuse-ld=/usr/bin/ld.lld //rs_bindings_from_cc:rs_bindings_from_cc_impl
DEBUG: Rule 'llvm-raw' indicated that a canonical reproducible form can be obtained by modifying arguments shallow_since = "1661922120 +0800"
DEBUG: Repository llvm-raw instantiated at:
/home/dsankel/code/crubit/WORKSPACE:127:36: in
/home/dsankel/code/crubit/bazel/llvm.bzl:61:23: in llvm_loader_repository_dependencies
Repository rule new_git_repository defined at:
/home/dsankel/.cache/bazel/_bazel_dsankel/1360c4342c51417fe5124e0a1427d9ea/external/bazel_tools/tools/build_defs/repo/git.bzl:186:37: in
INFO: Analyzed target //rs_bindings_from_cc:rs_bindings_from_cc_impl (121 packages loaded, 9510 targets configured).
INFO: Found 1 target...
ERROR: /home/dsankel/code/crubit/lifetime_annotations/BUILD:26:11: Compiling lifetime_annotations/type_lifetimes.cc failed: (Exit 1): clang-16 failed: error executing command /home/dsankel/code/llvm-project/install/bin/clang-16 -U_FORTIFY_SOURCE -fstack-protector -Wall -Wthread-safety -Wself-assign -Wunused-but-set-parameter -Wno-free-nonheap-object -fcolor-diagnostics ... (remaining 88 arguments skipped)
Use --sandbox_debug to see verbose messages from the sandbox and retain the sandbox build root for debugging
lifetime_annotations/type_lifetimes.cc:742:40: error: cannot initialize a variable of type 'const clang::TemplateTypeParmDecl *' with an rvalue of type 'const TemplateTypeParmType *'
const clang::TemplateTypeParmDecl* type_parm = targ->getReplacedParameter();
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
lifetime_annotations/type_lifetimes.cc:779:48: error: cannot initialize a variable of type 'const clang::TemplateTypeParmDecl *' with an rvalue of type 'const TemplateTypeParmType *'
const clang::TemplateTypeParmDecl* type_parm =
^
2 errors generated.
Target //rs_bindings_from_cc:rs_bindings_from_cc_impl failed to build
Use --verbose_failures to see the command lines of failed build steps.
INFO: Elapsed time: 318.474s, Critical Path: 66.47s
INFO: 2279 processes: 1038 internal, 1241 linux-sandbox.
FAILED: Build did NOT complete successfully
```
## Failure with updated commit
Using commit 163bb6d64e5f1220777c3ec2a8b58c0666a74d91.
```
dsankel@AP-PW015KJM:~/code/crubit$ bazel build --linkopt=-fuse-ld=/usr/bin/ld.lld //rs_bindings_from_cc:rs_bindings_from_cc_impl
DEBUG: Rule 'llvm-raw' indicated that a canonical reproducible form can be obtained by modifying arguments shallow_since = "1669057075 -0500"
DEBUG: Repository llvm-raw instantiated at:
/home/dsankel/code/crubit/WORKSPACE:127:36: in
/home/dsankel/code/crubit/bazel/llvm.bzl:61:23: in llvm_loader_repository_dependencies
Repository rule new_git_repository defined at:
/home/dsankel/.cache/bazel/_bazel_dsankel/1360c4342c51417fe5124e0a1427d9ea/external/bazel_tools/tools/build_defs/repo/git.bzl:186:37: in
ERROR: /home/dsankel/code/crubit/rs_bindings_from_cc/BUILD:62:10: error loading package '@llvm-project//llvm': cannot load '@bazel_skylib//rules:expand_template.bzl': no such file and referenced by '//rs_bindings_from_cc:rs_bindings_from_cc_impl'
ERROR: Analysis of target '//rs_bindings_from_cc:rs_bindings_from_cc_impl' failed; build aborted: Analysis failed
INFO: Elapsed time: 98.704s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (50 packages loaded, 154 targets configured)
currently loading: @llvm-project//llvm ... (2 packages)
```
Contributor guide
Assessment
This issue has not been assessed yet.