This patch provides a draft overlay to support compilation of llvm libc with Bazel.
Tested on linux x86-64 with
cd git/llvm-project/utils/bazel bazelisk-linux-amd64 build --sandbox_base=/dev/shm --config=generic_clang @llvm-project//libc:all
Paths
| Differential D114712
[libc] Bazel overlay for libc ClosedPublic Authored by gchatelet on Nov 29 2021, 8:14 AM.
Details
Summary This patch provides a draft overlay to support compilation of llvm libc with Bazel. Tested on linux x86-64 with cd git/llvm-project/utils/bazel bazelisk-linux-amd64 build --sandbox_base=/dev/shm --config=generic_clang @llvm-project//libc:all
Diff Detail
Event TimelineHerald added subscribers: ecnelises, tschuett, pengfei. · View Herald TranscriptNov 29 2021, 8:14 AM Comment Actions Overall LGTM but one question: Will the file libc/BUILD.bazel interfere with downstream BUILD files? Comment Actions
I assume you're talking about Google's monorepo. No, it won't.
Comment Actions Nice! Thanks for iterating on this. It looks like the Bazel build has been broken since yesterday evening. The error looks unrelated to libc, but would still be good to have a clean build. Maybe wait till @dblaikie or @mtrofin get a chance to fix it or rebase on the last passing commit (https://github.com/llvm/llvm-project/commit/a556ec8861) so we can make sure this is all working properly. I don't see the libc targets showing up in the build logs, but I think that's just because it's a bazel test invocation so the final summary just prints tests (even though it does also build the targets specified). Have you double checked that these targets show up in bazel query @llvm-project//... as expected (I can check, if you'd like).
This revision is now accepted and ready to land.Dec 9 2021, 10:55 AM Comment Actions I've cherry picked this change on top of the commit you mentioned, the build is green (I've also checked that llvm libc targets do appear in bazel query) I'll wait for your final approval and submit. Comment Actions Thanks, LGTM 🙂 (The previous accept was intended to indicate "please fix these nits then gtg") Closed by commit rG8ed70d0189ba: [libc] Bazel overlay for libc (authored by gchatelet). · Explain WhyDec 13 2021, 11:14 AM This revision was automatically updated to reflect the committed changes.
Revision Contents
Diff 393972 utils/bazel/llvm-project-overlay/libc/BUILD.bazel
utils/bazel/llvm-project-overlay/libc/libc_build_rules.bzl
utils/bazel/llvm-project-overlay/libc/platforms.bzl
|
Nit: there's no official line length limit in the style guide, but it is recommended to wrap at 80 (79?) where possible, so I think it makes sense to have the line fills and explicit wraps be that wide. https://docs.bazel.build/versions/main/skylark/bzl-style.html#line-length