I was struggling hard to cross compile a program for ARM processor using Bazel. I followed below tutorial from bazel:
https://github.com/bazelbuild/bazel/wiki/Building-with-a-custom-toolchain
When I run the exact command written in the above tutorial, the error log is as below:
manikanta@manikanta-VirtualBox:~/Desktop/my_project/bazel_toolchain_test_data$ bazel build --crosstool_top=//tools/arm_compiler:toolchain --cpu=armeabi-v7a
ERROR: no such package 'tools/arm_compiler': BUILD file not found on package path
INFO: Elapsed time: 0.724s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (0 packages loaded)
I am clueless as I am new to Bazel. Any help will be greatly appreciated.
The error is telling you that there's no file called BUILD
in the tools/arm_compiler
directory in your workspace (and I'm guessing tools/arm_compiler
itself doesn't exist).
If you're trying to write your own custom toolchain, which is what the tutorial covers, see the Writing the BUILD file section for how to write the BUILD file. Other sections of the tutorial also include instructions on writing the accompanying CROSSTOOL file (which defines compiler properties) and the compiler itself (i.e. the actual file).
If you just want to build with a different CPU, you can simply write bazel build --cpu=armeabi_v7a
(with the default toolchain). Ahtough I believe in the case of armeabi-v7a
the default toolchain doesn't work well (vs., say, building Android native code).