[PATCH] D141553: [bazel] Enable layering_check for llvm and clang

Geoffrey Martin-Noble via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 23 14:56:12 PST 2023


GMNGeoffrey added a comment.

Hmm breaking `zlib_external` isn't great. I actually ran into another issue when I tried to repro this:

`bazel build --config=generic_clang --config=zlib_external @llvm-project//...`

  ERROR: An error occurred during the fetch of repository 'llvm_zlib':
     Traceback (most recent call last):
          File "/usr/local/google/home/gcmn/.cache/bazel/_bazel_gcmn/7979a4df276c1366186cbb0309ad0645/external/llvm-raw/utils/bazel/zlib.bzl", line 85, column 33, in _llvm_zlib_from_env_impl
                  _llvm_zlib_external_impl(repository_ctx)
          File "/usr/local/google/home/gcmn/.cache/bazel/_bazel_gcmn/7979a4df276c1366186cbb0309ad0645/external/llvm-raw/utils/bazel/zlib.bzl", line 23, column 28, in _llvm_zlib_external_impl
                  repository_ctx.template(
  Error in template: got dict<string, Label> for 'substitutions', want dict<string, string>

So that appears to be broken also (need an explicit string conversion). Presumably that means that no one is using the environment variable method of configuring these.

We could add `features = ["-layering_check"]` to the `llvm:Support` rule only, which would at least scope it. Other options:

1. add a header file to the zlib_external build rule that re-exports the zlib header. That's a bit gross
2. Move the define to the zlib.BUILD build rule and make the zlib_external build rule just an alias. That requires dependent projects to use that rule rather than a zlib dep they've already set up, so also not great.
3. Find another way to remap repo names. I think Bazel might have better functionality for it now


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D141553/new/

https://reviews.llvm.org/D141553



More information about the llvm-commits mailing list