1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
From 34c4dc1a10140addf75d3503d4b9f427303fe212 Mon Sep 17 00:00:00 2001
From: Hongxu Jia <hongxu.jia@windriver.com>
Date: Mon, 14 Dec 2020 16:45:31 +0800
Subject: [PATCH] add Yocto native sysroot dir to the default Bazel toolchain
While using the default Bazel C++ toolchain to build Yocto native tools
(bazel build --host_crosstool_top=@bazel_tools//tools/cpp:toolchain),
it failed `bazel references a path outside of the execution root',
Add Yocto native sysroot dir (YOCTO_NATIVE_SYSROOT) to
builtin_include_directories could fix the issue
If not set YOCTO_NATIVE_SYSROOT, use NOT_SET_YOCTO_NATIVE_SYSROOT
to replace as a warning
Upstream-Status: Inappropriate [oe specific]
Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
---
tools/cpp/unix_cc_configure.bzl | 3 +++
1 file changed, 3 insertions(+)
diff --git a/tools/cpp/unix_cc_configure.bzl b/tools/cpp/unix_cc_configure.bzl
index d48485b..0d297bf 100755
--- a/tools/cpp/unix_cc_configure.bzl
+++ b/tools/cpp/unix_cc_configure.bzl
@@ -443,6 +443,9 @@ def configure_unix_toolchain(repository_ctx, cpu_value, overriden_tools):
paths["@bazel_tools//tools/cpp:generate_system_module_map.sh"],
))
+ # Customize for Yocto
+ builtin_include_directories.append(get_env_var(repository_ctx,"YOCTO_NATIVE_SYSROOT", "NOT_SET_YOCTO_NATIVE_SYSROOT"))
+
write_builtin_include_directory_paths(repository_ctx, cc, builtin_include_directories)
repository_ctx.template(
"BUILD",
--
2.18.2
|