Bazel support to libc and libcxx + libcxxabi

Hi @sivachandra ,

I am aware that bazel is not community-supported, nonetheless I would like to contribute on the llvm bazel build.

I noticed that it’s missing a target to build a libc.so dependency and nothing has been done yet (at least publicly) to add libcxx or libcxxabi. I can prepare a pull request but I would like to understand a few things first before making additions to preexisting code. I would like to write an easy to maintain system and cooperate to get out a decent one so that also google is satisfied with it. At least I would like to give it a try…

Do you think I could start writing a patch and we can maybe start iterating on that?

I think the first target could be to add an aggregate target “@llvm-project//libc:libc” target? This should simplify the development of a toolchain as well. Do you think it makes sense?

Best,

I do not work on the libcxx or libcxxabi projects or their bazel overlay. You should check with @gcmn or a libcxx person about them.

Including @gchatelet who actually did the work to set up the libc bazel overlay.

About the high level target for the libc, we have consciously left it out for now. The idea being that, what exactly is a libc is left to the downstream consumers - they can define their libc (or something else that they might want to call it) as they see fit. Sometime in future, when the libc project is more complete, it might make sense to add a platform dependent target for the libc.

Hi @lromor

Thx a lot for offering some of your time to improve the bazel situation of libc, libcxx and libcxxabi.
I can only speak about libc, for libcxx and libcxxabi you should check with @gcmn.

I’m in the process of adding tests to llvm-libc. A number of things needs to be aligned and so it’s not so straightforward. For instance, we may need to add new package dependencies to the built bots, and wait for all of them to be updated. Also, Google has some internal rules to build llvm-libc and we would like to reuse some of the upstream configuration internally. This specifically makes it difficult for someone external to Google to contribute the initial bazel BUILD files. Once a first version is here though I believe it will be easier to help.

I just generally look after the Bazel contributions and have no particular knowledge about any of these subprojects (my project uses llvm, mlir, and lld, so those are the configurations I have some knowledge of, plus clang because we added it early).

As with the other subprojects, we already have some build rules for these internally that could probably be adapted for open source, but it would require someone with knowledge and interest to do so. Let me see if I can find a Googler who works on libcxx and might be able to help you. Otherwise, I can help review your contributions for general Bazel usage and consistency with the other llvm-project Bazel rules.

The flipside is also important here: we’ve got some build files internally and we’d like to be able to make use of them externally so they don’t have to be rewritten from scratch :slight_smile:

Absolutely, thx for pointing this out :slightly_smiling_face:

Thank you for your messages and consideration!

I would be happy to proactively contribute but from your messages it’s clear to me that I can’t do much until a few things are unlocked. If you feel like offloading some simple tasks that might help getting things out more quickly just let me know.

Cheers,

I think it’s more like, if you wait a bit someone else might be able to do this for you leveraging the internal stuff we already have. I’ve contacted folks on our side who work on libcxx, but if you don’t hear from someone in the next O(weeks), I’d say go ahead and start work on what you think is reasonable (although note I’m going to be on vacation next month, so won’t be able to review).

Sounds good to me. I’ll wait for a few weeks then.