Search code examples
bazel

How to use bazel build a custom toolchain use a compiler installed at custom location?


According to the wiki https://github.com/bazelbuild/bazel/wiki/Building-with-a-custom-toolchain, I can use bazel build hello.cc code. Now I have Installed the croos-tool compiler in local disk. So I want to create a custom CROSSTOOL use new_local_repository. What should I do? Thanks!


Solution

  • If you want to write a custom CROSSTOOL, and you have compiler/linker already installed, just follow the instructions in https://github.com/bazelbuild/bazel/wiki/Building-with-a-custom-toolchain and when you're done, you can use your crosstool by e.g. bazel build --crosstool_top=//tools/my_custom_crosstool:toolchain //src:hello.