如何将包含目录从 WORKSPACE 中导入的包传递到 cxx_builtin_include_directories 以获得自定义 cc_toolchain_config
how to pass include directories from package imported in WORKSPACE to cxx_builtin_include_directories for a selfdefined cc_toolchain_config
我在 WORKSPACE 文件中导入交叉工具链,如何将包含目录从 gcc_arm_aarch64 传递到 cxx_builtin_include_directories,我尝试通过定义的文件组传递它,但文件组是一个标签,如何传输一个文件组标签的 srcs attrs 到一个字符串?如果有一种方法可以转移到字符串,它会起作用吗?似乎 gcc 有相对路径问题?这个issue说说这个问题,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",
],
)
执行此操作有一种特殊的语法。它看起来像 "%package(@your_toolchain//relative/clang/include)%"
,其中 @your_toolchain
替换为您的存储库名称。在您的情况下,这意味着类似于 %package(@gcc_arm_aarch64//aarch64-none-linux-gnu/include)%
。根据包边界的位置(带有 BUILD 文件的最深文件夹),某些目录可能需要在 %package()
之后移动,例如 %package(@gcc_arm_aarch64//aarch64-none-linux-gnu)%/include
.
这些指令在生成编译器命令行时得到扩展。除了 the source.
之外,我不知道有任何文档
我在 WORKSPACE 文件中导入交叉工具链,如何将包含目录从 gcc_arm_aarch64 传递到 cxx_builtin_include_directories,我尝试通过定义的文件组传递它,但文件组是一个标签,如何传输一个文件组标签的 srcs attrs 到一个字符串?如果有一种方法可以转移到字符串,它会起作用吗?似乎 gcc 有相对路径问题?这个issue说说这个问题,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",
],
)
执行此操作有一种特殊的语法。它看起来像 "%package(@your_toolchain//relative/clang/include)%"
,其中 @your_toolchain
替换为您的存储库名称。在您的情况下,这意味着类似于 %package(@gcc_arm_aarch64//aarch64-none-linux-gnu/include)%
。根据包边界的位置(带有 BUILD 文件的最深文件夹),某些目录可能需要在 %package()
之后移动,例如 %package(@gcc_arm_aarch64//aarch64-none-linux-gnu)%/include
.
这些指令在生成编译器命令行时得到扩展。除了 the source.
之外,我不知道有任何文档