conan-io / conan

Conan - The open-source C and C++ package manager
https://conan.io
MIT License
8.25k stars 980 forks source link

[question] Plans regarding bazeltoolchain generator #15751

Open sandeshhardikar opened 8 months ago

sandeshhardikar commented 8 months ago

What is your question?

Hello ,

Currently we are using conan 1.x as package generator and cmake as our build-tool with the help of cmake generators

We are now evaluating bazel as the next build tool and hope to use it similarly like cmake with the help of bazel generators

  1. I am a newbie to bazel and i hit some problems when trying to cross compile using our own custom cross compiler . It seems that bazel has to know what is the source of the compiler and where it comes from and has to download on its own . Are you thinking on this usecase to generate a compiler path to conan package in artifactory so that bazel can download it ?

  2. Do you have any thoughts on generating something related to platforms/toolchains ?

  3. Any approximate timeline on adding support to bazel 7.x ?

Sorry for not keeping the question very specific .

Have you read the CONTRIBUTING guide?

franramirez688 commented 8 months ago

HI @sandeshhardikar

Thanks for your questions 😁

I am a newbie to bazel and i hit some problems when trying to cross compile using our own custom cross compiler . It seems that bazel has to know what is the source of the compiler and where it comes from and has to download on its own . Are you thinking on this usecase to generate a compiler path to conan package in artifactory so that bazel can download it ?

Could you please give me a minimal example? I'm not sure if I'm getting the whole picture of your question.

Do you have any thoughts on generating something related to platforms/toolchains ?

I'd like to say Yes, but no, we're not Bazel experts 😓 I was gathering a lot of information about those Bazel toolchains/platforms and it was too complex (at least for me) to perform that kind of platform/toolchain using the whole Conan context. I gave it a try but I did not find a way to make that mechanism work with Conan.

Any approximate timeline on adding support to bazel 7.x ?

I tend to say over the next 4 months. I'd like to say a more exact date, but I'm still waiting for a more stable version of Bazel 7.x just in case. I just opened an issue https://github.com/conan-io/conan/issues/15754 to remind me of this one 😁

sandeshhardikar commented 8 months ago

Hi @franramirez688 ,

Thanks for taking time to answer this :)

Could you please give me a minimal example?

I just created this https://github.com/sandeshhardikar/conan-bazel to demonstrate an attempt to cross compile . I now hit the error cc_toolchain_suite rule @local_config_cc//:toolchain: cc_toolchain_suite '@local_config_cc//:toolchain' does not contain a toolchain for cpu 'linux_armv8.3'

I imagine compiler being consumed as tool_requires . How do we tell bazel this ? .

Generate something like build --platforms=//platforms:linux_armv8.3 via the toolchain or directly define this manually in a custom toolchain .rc file which resides in a compiler package ?

I'm not sure if I'm getting the whole picture of your question.

hmm , can i put it in one line as Do you have a guide just like Build Simple Bazel Project for cross compilation ?

sandeshhardikar commented 7 months ago

Hi @franramirez688 ,

I added one more working example for cross compilation which works and is inspired from bazel-embedded , may be it helps you . One of the things which i dont like there is the explicit download of compiler defined here . I would ideally like to have this package as tool_requires in my host profile and tell bazel to use this as a cross compiler