Open MarcoBonino opened 3 weeks ago
I don't think Bazel modules are relevant here. Can you please expand on what you mean here?
I don't think Bazel modules are relevant here. Can you please expand on what you mean here?
I'm trying to setup a toolchain to cross compile riscv64 on macos (aarch64).
This is my MODULE.bazel:
http_archive = use_repo_rule("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
http_archive(
name = "riscv64-unknown-elf-toolchain-mac-aarch64",
urls = ["http://riscv.org.s3.amazonaws.com/bottles/riscv-gnu-toolchain-main.arm64_sonoma.bottle.15.tar.gz"],
strip_prefix = "riscv-gnu-toolchain",
sha256 = "0131cce13fae8b9c40d48b2b7cee3682bf1def0430281a2af7f7f8569efb93ac",
)
It is successfully downloading the archive and extract it.
What I'm missing is how can I map all the executables (and include paths) used by the new custom toolchain to the actual files in the extracted archive ? In example, looking at your code the mapping should be something like:
tool_paths = [tool_path(name = tool, path = "main/bin/riscv64-unknown-elf-{}".format(tool)) for tool in toolchain_tools]
Essentially gcc should be mapped to "main/bin/riscv64-unknown-elf-gcc" from the http_archive root folder.
I tried different approaches but I cannot find a way to make it working without using absolute paths (like you did). If I try to pass "@riscv64-unknown-elf-toolchain-mac-aarch64//main/bin" it will simply look in "toolchain/@riscv64-unknown-elf-toolchain-mac-aarch64/main/bin" which does not exists...
Could you help on this ?
I see what you're saying, but it really depends on how the authors of that archive intended this to be used.
Could your tool chain rule take the labels to these files as parameters, and then you could plumb those through the implementation function? Please provide the code for your toolchain rule and maybe we can think of something.
That said, this repository doesn't deal with modules. I think a more accurate title here would be "how to use a custom, non-local toolchain".
Hello!
Could you add an example using Bazel modules ?
Thanks!