summaryrefslogtreecommitdiffstats
path: root/recipes-devtools/clang/clang/0026-For-x86_64-set-Yocto-based-GCC-install-search-path.patch
blob: dd5a9a247768a3243e22a5a73ea7575535b38e2b (plain)
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
From 386cec2c3000b398cb0afe9bf9e9d57f7cdfd4eb Mon Sep 17 00:00:00 2001
From: Hongxu Jia <hongxu.jia@windriver.com>
Date: Mon, 25 Jan 2021 16:14:35 +0800
Subject: [PATCH] For x86_64, set Yocto based GCC install search path

Under Yocto host, while using clang-native to build, it searches
install host gcc failed which causing the include file not found
[snip]
|clang++ -target x86_64-linux  -MMD -MF src/base/files/file_path_constants.o.d -I../../../tools/gn/src -I. \
-isystem/tmp-glibc/work/x86_64-linux/gn-native/87.0.4280.141-r0/recipe-sysroot-native/usr/include -O2 -pipe \
-std=c++17 -c ../../../tools/gn/src/base/files/file_path_constants.cc -o src/base/files/file_path_constants.o
|../../../tools/gn/src/base/files/file_path_constants.cc:7:10: fatal error: 'iterator' file not found
|#include <iterator>
|         ^~~~~~~~
[snip]

Set three Yocto based GCC triple: poky, oe-core and wind river

Before aplly the patch
[snip]
$ ../recipe-sysroot-native/usr/bin/clang++ -v
clang version 11.0.1 (https://github.com/llvm/llvm-project 43ff75f2c3feef64f9d73328230d34dac8832a91)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir:tmp-glibc/work/x86_64-linux/gn-native/87.0.4280.141-r0/chromium-87.0.4280.141/../recipe-sysroot-native/usr/bin
[snip]

After aplly the patch:
[snip]
$ ../recipe-sysroot-native/usr/bin/clang++ -v
clang version 11.0.1 (https://github.com/llvm/llvm-project 22c3241ff9a6224261df48d0258957fd8acc3d64)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir:tmp-glibc/work/x86_64-linux/gn-native/87.0.4280.141-r0/chromium-87.0.4280.141/../recipe-sysroot-native/usr/bin
Found candidate GCC installation: /usr/lib//x86_64-wrs-linux/10.1.0
Found candidate GCC installation: /usr/lib/gcc/x86_64-wrs-linux/10.1.0
Selected GCC installation: /usr/lib//x86_64-wrs-linux/10.1.0
Candidate multilib: .;@m64
Selected multilib: .;@m64
[snip]

BTW, it is hardly to insert a triple by the replacement of TARGET_SYS
(=${TARGET_ARCH}${TARGET_VENDOR}-${TARGET_OS}), since TARGET_VENDOR
is different between clang and clang-native

The //CLANG_EXTRA_OE_VENDORS_TRIPLES string is replaced with list of
additional triples based on CLANG_EXTRA_OE_VENDORS variable in
recipes-devtools/clang/llvm-project-source.inc:add_more_target_vendors()

Upstream-Status: Inappropriate [oe specific]

Signed-off-by: Martin Jansa <martin.jansa@gmail.com>
Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 clang/lib/Driver/ToolChains/Gnu.cpp | 1 +
 1 file changed, 1 insertion(+)

--- a/clang/lib/Driver/ToolChains/Gnu.cpp
+++ b/clang/lib/Driver/ToolChains/Gnu.cpp
@@ -2109,6 +2109,7 @@ void Generic_GCC::GCCInstallationDetecto
       "x86_64-redhat-linux",    "x86_64-suse-linux",
       "x86_64-manbo-linux-gnu", "x86_64-linux-gnu",
       "x86_64-slackware-linux", "x86_64-unknown-linux",
+      "x86_64-oe-linux",//CLANG_EXTRA_OE_VENDORS_TRIPLES
       "x86_64-amazon-linux",    "x86_64-linux-android"};
   static const char *const X32LibDirs[] = {"/libx32"};
   static const char *const X86LibDirs[] = {"/lib32", "/lib"};