How to build with multiple toolchains as a part of a single build command

294 views
Skip to first unread message

Garrett Kajmowicz

unread,
Jun 2, 2021, 1:09:29 PM6/2/21
to bazel-discuss
I have a build scenario where I need to compile a set of libraries with multiple toolchains as a part of a single "blaze build" operation.

As a simplified example, consider a graphics processing application which will, at run-time, determine the processor features supported and load a different version of the library which does the actual math work. Different toolchains might be the Intel compiler, and gcc with different linking options. And for $reasons this is implemented as separate toolchains.

In this case it's obvious that a "product build" involves building the external application once for the target platform, and the library multiple times.

How do I go about annotating the BUILD file that I need to do the build of the libraries for each of a set of toolchains?

Alex Garcia Mayans

unread,
Jun 2, 2021, 1:29:40 PM6/2/21
to Garrett Kajmowicz, bazel-discuss
I have an example on how to achieve that using transitions here:


Just build ‘//board/…’ in that folder and you will see 2 packages being built with 2 different tool chains using the same app as source.

Regards,
Alexandre Garcia Mayans

On 2 Jun 2021, at 19:09, Garrett Kajmowicz <garrett....@gmail.com> wrote:

I have a build scenario where I need to compile a set of libraries with multiple toolchains as a part of a single "blaze build" operation.

As a simplified example, consider a graphics processing application which will, at run-time, determine the processor features supported and load a different version of the library which does the actual math work. Different toolchains might be the Intel compiler, and gcc with different linking options. And for $reasons this is implemented as separate toolchains.

In this case it's obvious that a "product build" involves building the external application once for the target platform, and the library multiple times.

How do I go about annotating the BUILD file that I need to do the build of the libraries for each of a set of toolchains?

--
You received this message because you are subscribed to the Google Groups "bazel-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bazel-discus...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/bazel-discuss/79fba7d5-55d3-46f1-85f5-d46f6e54eb14n%40googlegroups.com.

Garrett Kajmowicz

unread,
Jun 23, 2021, 10:22:53 AM6/23/21
to bazel-discuss
I finally managed to get this implemented and it works quite well. Thank you!

-     Garrett

Reply all
Reply to author
Forward
0 new messages