Bazel rules for libc and libcxx

Hello, everybody

I have some questions regarding Bazel rules for llvm targets.

In our project we plan to build llvm-project via Bazel. Currently only rules for clang, llvm, libunwind, lld and mlir are presented in the llvm tree. But we also plan to build libc and libcxx targets via Bazel, the rules for these targets aren’t in llvm tree yet. As far as I know they exist only in internal Google monorepo.

So, my questions:

  • Are there any plans to add Bazel rules for libc and libcxx to the llvm tree under llvm-projects/utils/bazel/llvm-project-overlay?

  • And if they are, then is it an ongoing task or only plans for now? Are there any thoughts on when such rules could become available?

  • Or there aren’t such plans? Or they wound’t be implemented soon and we better start writing these rules by ourselves?

From the short discussion in github here - https://github.com/llvm/llvm-project/commit/693a95a69416e23a31e46d3d2c81e854688e606e (probably not really suitable place to start such discussion, I should had write it here at the beginning) it seems that there are such plans, but it isn’t clear for me if somebody working on this now.

@sivachandra also pointed out some design goal for these rules:

  • We want the individual functions to be mutually exclusive. So, we ideally want a separate target for every libc function.
  • What actually is in a user’s libc will be left up to the user. That is, the users are free to pick-and-choose what they want from LLVM libc and get the rest from another libc if they so choose to. Hence, we ideally do not want to provide a Bazel target for the final libc. The users will list the cc_library targets of the individual functions of their interest as deps to the actual libc target.

Another question: Would it be the same for libcxx? Or libcxx is completely different topic to discuss?

I would really appreciate any help :slight_smile:

Best regards,

Kirill Zabelin

Hello, everybody

I have some questions regarding Bazel rules for llvm targets.

In our project we plan to build llvm-project via Bazel. Currently only rules for clang, llvm, libunwind, lld and mlir are presented in the llvm tree. But we also plan to build libc and libcxx targets via Bazel, the rules for these targets aren’t in llvm tree yet. As far as I know they exist only in internal Google monorepo.

So, my questions:

  • Are there any plans to add Bazel rules for libc and libcxx to the llvm tree under llvm-projects/utils/bazel/llvm-project-overlay?

As pointed out on the github discussion you linked below, we are currently working on putting them in place.

  • And if they are, then is it an ongoing task or only plans for now? Are there any thoughts on when such rules could become available?

As +Guillaume Chatelet explained on the github discussion, we are evaluating a few possible directions we can take. We will share them publicly as soon as we can.

  • Or there aren’t such plans? Or they wound’t be implemented soon and we better start writing these rules by ourselves?

I would say, wait for a few weeks and we should be able to provide you with concrete plans and procedures to start using libc’s Bazel rules. You also see patches for this soon.

From the short discussion in github here - https://github.com/llvm/llvm-project/commit/693a95a69416e23a31e46d3d2c81e854688e606e (probably not really suitable place to start such discussion, I should had write it here at the beginning) it seems that there are such plans, but it isn’t clear for me if somebody working on this now.

@sivachandra also pointed out some design goal for these rules:

  • We want the individual functions to be mutually exclusive. So, we ideally want a separate target for every libc function.
  • What actually is in a user’s libc will be left up to the user. That is, the users are free to pick-and-choose what they want from LLVM libc and get the rest from another libc if they so choose to. Hence, we ideally do not want to provide a Bazel target for the final libc. The users will list the cc_library targets of the individual functions of their interest as deps to the actual libc target.

Another question: Would it be the same for libcxx? Or libcxx is completely different topic to discuss?

Yes, libcxx is a completely different topic and discussions related to it should be taken up on a libcxx specific forum.

  • Maxim

вт, 7 дек. 2021 г. в 00:32, Siva Chandra <sivachandra@google.com>: