CROSSTOOL指向http_archive的工具链位置信息栏的路径

时间:2019-03-06 09:03:37

标签: cross-compiling bazel

在CentOS 7中编写带有针对LM32 cpu架构的bazel的构建。因此,我需要构建一个交叉编译器(本教程之后:https://docs.bazel.build/versions/0.23.0/tutorial/crosstool.html)。另外,我将使用http_archive自动下载工具链。我的工具链程序包中有一个CROSSTOOL文件,该文件需要引用此下载的程序包,而且我似乎不太了解如何实现此目的。

我有以下工作空间布局:

.
|-- external
|   `-- lm32-toolchain.BUILD
|-- main
|   |-- BUILD
|   `-- helloworld.c
|-- README.md
|-- toolchain
|   |-- BUILD
|   `-- CROSSTOOL
`-- WORKSPACE

工作空间:

load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive", "http_file")

http_archive(
  name = 'lm32_toolchain',
  url = 'https://www.ohwr.org/project/wr-cores/uploads  /2776ce0ba43503d1486ae205b48fb450/lm32_host_64bit.tar.xz',
  build_file = 'lm32-toolchain.BUILD',
  strip_prefix = 'lm32-gcc-4.5.3'
)

我可以看到工具链已下载:

$ ls $(bazel info output_base)/external/lm32_toolchain
bin  BUILD.bazel  include  lib  libexec  lm32-elf  share  WORKSPACE

但是,它无法编译,因为找不到编译器。

工具链/交叉工具:

major_version: "1"
minor_version: "0"
default_target_cpu: "lm32"

toolchain {
   toolchain_identifier: "lm32-toolchain"
   host_system_name: "i686-unknown-linux"
   target_system_name: "lm32-elf"
   target_cpu: "lm32"
   target_libc: "unknown"
   compiler: "lm32-elf-gcc"
   abi_version: "unknown"
   abi_libc_version: "unknown"

   tool_path { name: "gcc"        path: "???/lm32-elf-gcc" }
   tool_path { name: "ld"         path: "???/lm32-elf-ld" }
   tool_path { name: "ar"         path: "???/lm32-elf-ar" }
   tool_path { name: "cpp"        path: "???/lm32-elf-cpp" }
   tool_path { name: "gcov"       path: "???/lm32-elf-gcov" }
   tool_path { name: "nm"         path: "???/lm32-elf-nm" }
   tool_path { name: "objdump"    path: "???/lm32-elf-objdump" }
   tool_path { name: "strip"      path: "???/lm32-elf-strip" }
}

我的问题是,应将??? /放在什么位置?我已经尝试了几件事,但是没有任何效果。所有对程序包的引用都会原样复制到execvp命令,例如:

src/main/tools/process-wrapper-legacy.cc:58: "execvp(toolchain/@lm32_toolchain/bin/lm32-elf-gcc, ...)": No such file or directory

并且不允许相对路径。

还是有更好的方法来实现这一目标?我对bazel还是很陌生,因此希望您能指点一下。

谢谢, 文森特

0 个答案:

没有答案