简体   繁体   中英

How do I install linux crosstool compilers for Bazel via brew?

On my Mac, having installed Bazel via brew , how can I install linux crosstools to build libraries that will run on linux containers?

Background:

I'm trying to locally diagnose bazel/rules_docker test failures on my Mac, but I find that a clean enlistment fails ( https://github.com/bazelbuild/rules_docker/issues/217 ). My hunch is that I need to explicitly build some components with a linux crosstool, but bazel says

Valid toolchains are: [
  --cpu='darwin_x86_64' --compiler='compiler' --glibc='macosx',
  --cpu='ios_x86_64' --compiler='compiler' --glibc='ios',
  --cpu='watchos_i386' --compiler='compiler' --glibc='watchos',
  --cpu='tvos_x86_64' --compiler='compiler' --glibc='tvos',
  --cpu='ios_i386' --compiler='compiler' --glibc='ios',
  --cpu='ios_armv7' --compiler='compiler' --glibc='ios',
  --cpu='watchos_armv7k' --compiler='compiler' --glibc='watchos',
  --cpu='tvos_arm64' --compiler='compiler' --glibc='tvos',
  --cpu='ios_arm64' --compiler='compiler' --glibc='ios',
  --cpu='armeabi-v7a' --compiler='compiler' --glibc='armeabi-v7a',
].

Is there a way to either install and/or reference other toolchains?

Bazel autodetects local configuration using Skylark repository here . It only works for detecting toolchain that is used to target local environment. If you need to target linux from mac, you need to provide your custom toolchain (CROSSTOOL and related stuff). One option would be to run bazel on the linux machine, and retrieve the generated toolchain from output_base, copy the folder with the CROSSTOOL over to the mac machine and use --crosstool_top to use that CROSSTOOL instead of the autogenerated one. Does it make sense?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM