diff options
author | Changqing Li <changqing.li@windriver.com> | 2021-12-07 05:04:15 +0000 |
---|---|---|
committer | Khem Raj <raj.khem@gmail.com> | 2021-12-09 08:54:15 -0800 |
commit | edca114de1c04bdce4fe6b71ab42f4b0aa2e88e7 (patch) | |
tree | 2fef6bd1bc57c1557bbd8760ad4ebcc5326d5e61 /recipes-devtools/clang/llvm-project-source.inc | |
parent | 7294d0ec96f7a8396632b7153c8a76c58b142412 (diff) | |
download | meta-clang-edca114de1c04bdce4fe6b71ab42f4b0aa2e88e7.tar.gz |
clang: for x86_64, correct GCC install search path for OpenEmbedded Host
Build on OpenEmbedded Host, compiler-rt-native do_configure failed with
following error:
compiler-rt-native/13.0.1-r0/recipe-sysroot-native/usr/bin/clang -target x86_64-linux
-isystem/path/to/x86_64-linux/compiler-rt-native/13.0.1-r0/recipe-sysroot-native/usr/include
-O2 -pipe
/path/to/compiler-rt-native/13.0.1-r0/recipe-sysroot-native/usr/share/cmake-3.21/Modules/CMakeCCompilerABI.c`
| /build/tmp-glibc/hosttools/ld: cannot find crtbeginS.o: No such file or directory
| /build/tmp-glibc/hosttools/ld: cannot find -lgcc
| /build/tmp-glibc/hosttools/ld: cannot find -lgcc
| clang-13: error: linker command failed with exit code 1 (use -v to see invocation)
Since OpenEmbedded Host's gcc install path is different with clang's
default search form, patch for OpenEmbedded Host's gcc library install
path.
Signed-off-by: Changqing Li <changqing.li@windriver.com>
Diffstat (limited to 'recipes-devtools/clang/llvm-project-source.inc')
-rw-r--r-- | recipes-devtools/clang/llvm-project-source.inc | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/recipes-devtools/clang/llvm-project-source.inc b/recipes-devtools/clang/llvm-project-source.inc index de7ba8a..a840030 100644 --- a/recipes-devtools/clang/llvm-project-source.inc +++ b/recipes-devtools/clang/llvm-project-source.inc | |||
@@ -22,6 +22,10 @@ PACKAGES = "" | |||
22 | # space separated list of additional distro vendor values we want to support e.g. | 22 | # space separated list of additional distro vendor values we want to support e.g. |
23 | # "yoe webos" or "-yoe -webos" '-' is optional | 23 | # "yoe webos" or "-yoe -webos" '-' is optional |
24 | CLANG_EXTRA_OE_VENDORS ?= "${TARGET_VENDOR} ${SDK_VENDOR}" | 24 | CLANG_EXTRA_OE_VENDORS ?= "${TARGET_VENDOR} ${SDK_VENDOR}" |
25 | # Extra OE DISTRO that want to support as build host. space separated list of additional distro. | ||
26 | # ":" separated the ID in "/etc/os-release" and the triple for finding gcc on this OE DISTRO. | ||
27 | # eg: "poky:poky wrlinux:wrs" | ||
28 | CLANG_EXTRA_OE_DISTRO ?= "poky:poky" | ||
25 | 29 | ||
26 | python add_distro_vendor() { | 30 | python add_distro_vendor() { |
27 | import subprocess | 31 | import subprocess |
@@ -51,6 +55,33 @@ python add_distro_vendor() { | |||
51 | subprocess.check_output(cmd, stderr=subprocess.STDOUT, shell=True) | 55 | subprocess.check_output(cmd, stderr=subprocess.STDOUT, shell=True) |
52 | cmd = d.expand("sed -i 's#//CLANG_EXTRA_OE_VENDORS_CASES#%s#g' -i ${S}/llvm/lib/Support/Triple.cpp" % (case)) | 56 | cmd = d.expand("sed -i 's#//CLANG_EXTRA_OE_VENDORS_CASES#%s#g' -i ${S}/llvm/lib/Support/Triple.cpp" % (case)) |
53 | subprocess.check_output(cmd, stderr=subprocess.STDOUT, shell=True) | 57 | subprocess.check_output(cmd, stderr=subprocess.STDOUT, shell=True) |
58 | |||
59 | |||
60 | case = "" | ||
61 | triple = "" | ||
62 | name = "" | ||
63 | check = "" | ||
64 | oe_names = "" | ||
65 | distros = d.getVar('CLANG_EXTRA_OE_DISTRO') | ||
66 | for distro in distros.split(): | ||
67 | distro_id = distro.split(":")[0].replace('-','_') | ||
68 | distro_triple = distro.split(":")[1] | ||
69 | case += '\\n .Case("' + distro_id + '", Distro::' + distro_id.upper() + ')' | ||
70 | triple += '\\n if (Distro.Is' + distro_id.upper() + '())\\n return "x86_64-' + distro_triple + '-linux",' | ||
71 | name += '\\n '+ distro_id.upper() + ',' | ||
72 | check += '\\nbool Is' + distro_id.upper() + '() const { return DistroVal == ' + distro_id.upper() + '; }' | ||
73 | oe_names += distro_id.upper() + ' ||' | ||
74 | |||
75 | check += '\\nbool IsOpenEmbedded() const { return DistroVal == ' + oe_names[0:-3] + '; }' | ||
76 | |||
77 | cmd = d.expand("sed -i 's#//CLANG_EXTRA_OE_DISTRO_NAME#%s#g' ${S}/clang/include/clang/Driver/Distro.h" % (name)) | ||
78 | subprocess.check_output(cmd, stderr=subprocess.STDOUT, shell=True) | ||
79 | cmd = d.expand("sed -i 's#//CLANG_EXTRA_OE_DISTRO_CHECK#%s#g' ${S}/clang/include/clang/Driver/Distro.h" % (check)) | ||
80 | subprocess.check_output(cmd, stderr=subprocess.STDOUT, shell=True) | ||
81 | cmd = d.expand("sed -i 's#//CLANG_EXTRA_OE_DISTRO_TRIPLES#%s#g' ${S}/clang/lib/Driver/ToolChains/Linux.cpp" % (triple)) | ||
82 | subprocess.check_output(cmd, stderr=subprocess.STDOUT, shell=True) | ||
83 | cmd = d.expand("sed -i 's#//CLANG_EXTRA_OE_DISTRO_CASES#%s#g' -i ${S}/clang/lib/Driver/Distro.cpp" % (case)) | ||
84 | subprocess.check_output(cmd, stderr=subprocess.STDOUT, shell=True) | ||
54 | } | 85 | } |
55 | 86 | ||
56 | do_patch[postfuncs] += "add_distro_vendor" | 87 | do_patch[postfuncs] += "add_distro_vendor" |