Reputation: 159
I import cross toolchain in WORKSPACE file, how to pass include directories from gcc_arm_aarch64 to cxx_builtin_include_directories, I tried pass it by defined a filegroup, but file group is a lable, how to transfer a file group label's srcs attrs to a string? if there is a way transfer to a string, will it work? it seems gcc has relative path problem? this issue talk about this problem, https://github.com/bazelbuild/bazel/issues/4605
http_archive(
name = "gcc_arm_aarch64",
build_file = "@bazel_build_file_repo//bazel:gcc_arm_aarch64.BUILD",
sha256 = "1e33d53dea59c8de823bbdfe0798280bdcd138636c7060da9d77a97ded095a84",
strip_prefix = "gcc-arm-10.3-2021.07-x86_64-aarch64-none-linux-gnu",
#urls = ["https://developer.arm.com/-/media/Files/downloads/gnu-a/10.3-2021.07/binrel/gcc-arm-10.3-2021.07-x86_64-aarch64-none-linux-gnu.tar.xz"],
urls = ["file:///root/src/cpp/toolchains/gcc-arm-10.3-2021.07-x86_64-aarch64-none-linux-gnu.tar.xz"],
)
filegroup(
name = "cxx_builtin_include_directories",
srcs = [
"aarch64-none-linux-gnu/include",
"aarch64-none-linux-gnu/include/c++/10.3.1",
"aarch64-none-linux-gnu/include/c++/10.3.1/aarch64-none-linux-gnu",
"aarch64-none-linux-gnu/include/c++/10.3.1/backward",
],
)
Upvotes: 1
Views: 765
Reputation: 3858
There's a special syntax for doing this. It looks like "%package(@your_toolchain//relative/clang/include)%"
, with @your_toolchain
replaced with your repository's name. In your case that means something like %package(@gcc_arm_aarch64//aarch64-none-linux-gnu/include)%
. Depending on where the package boundary is (deepest folder with a BUILD file), some of the directories might need to move after the %package()
like %package(@gcc_arm_aarch64//aarch64-none-linux-gnu)%/include
.
Those directives get expanded when generating compiler command lines. I'm not aware of any documentation besides the source.
Upvotes: 1