diff options
author | Khem Raj <raj.khem@gmail.com> | 2018-08-19 10:23:37 -0700 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2018-08-20 17:38:22 +0100 |
commit | 8884da482272487aa74ab915de53fa2dfed40b9c (patch) | |
tree | 0fd2ca83e03a1507c11874b270c6bf3a423132b7 | |
parent | f98f7baa8393cc80dea267fa1b13f89f5bb39100 (diff) | |
download | poky-8884da482272487aa74ab915de53fa2dfed40b9c.tar.gz |
llvm: Use YOCTO_ALTERNATE_MULTILIB_NAME environment variable in llvm-config
llvm-config is a tool on similar veins as pkg-config but provides a lot
more information and packages which use llvm e.g. mesa use this tool to
poke for llvm related informaiton e.g. version, libpath, includepaths
to name a few, this has few challanges in cross build environments where
llvm-config is supposed to be build for buildhost but provide information
about target llvm which is addressed by building native llvm-config along
with target llvm build, but this is frowned upon by OE build system since
it detects that host paths are being used so we have to build it as part
of llvm-native but then it means install paths for llvm and llvm-native
are different and wrong paths get reported when llvm-config is used.
This is solved by providing YOCTO_ALTERNATE_EXE_PATH variable to let
llvm-config use that path instead of self-relative path to report back
Second problem is when building multi-lib packages base_libdir is different
for target packages but native llvm-config does not know about it so
it reports non-multilibbed paths as libdir and packages can not find
llvm in sysroot. This is fixed by adding another environment variable
YOCTO_ALTERNATE_MULTILIB_NAME which can be set from recipes to set
proper multilib path
(From OE-Core rev: 865eb1c1400e60d09c8f413504123fdfc116a71b)
Signed-off-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r-- | meta/recipes-devtools/llvm/llvm/0002-llvm-allow-env-override-of-exe-path.patch | 47 |
1 files changed, 40 insertions, 7 deletions
diff --git a/meta/recipes-devtools/llvm/llvm/0002-llvm-allow-env-override-of-exe-path.patch b/meta/recipes-devtools/llvm/llvm/0002-llvm-allow-env-override-of-exe-path.patch index 21d2f81b58..6a9283323c 100644 --- a/meta/recipes-devtools/llvm/llvm/0002-llvm-allow-env-override-of-exe-path.patch +++ b/meta/recipes-devtools/llvm/llvm/0002-llvm-allow-env-override-of-exe-path.patch | |||
@@ -1,4 +1,4 @@ | |||
1 | From 2f8ea767afdaa440c6368040630e1b3ea6a0977a Mon Sep 17 00:00:00 2001 | 1 | From aeccf16eaccdd80e4d5ecaa51673ce4b2bac1130 Mon Sep 17 00:00:00 2001 |
2 | From: Martin Kelly <mkelly@xevo.com> | 2 | From: Martin Kelly <mkelly@xevo.com> |
3 | Date: Fri, 19 May 2017 00:22:57 -0700 | 3 | Date: Fri, 19 May 2017 00:22:57 -0700 |
4 | Subject: [PATCH 2/2] llvm: allow env override of exe path | 4 | Subject: [PATCH 2/2] llvm: allow env override of exe path |
@@ -8,16 +8,19 @@ return the libraries, include directories, etc. from inside the sysroot rather | |||
8 | than from the native sysroot. Thus provide an env override for calling | 8 | than from the native sysroot. Thus provide an env override for calling |
9 | llvm-config from a target sysroot. | 9 | llvm-config from a target sysroot. |
10 | 10 | ||
11 | To let it work in multilib environment, we need to provide a knob to supply | ||
12 | multilib dirname as well | ||
13 | |||
14 | Upstream-Status: Inappropriate [OE-Specific] | ||
15 | |||
11 | Signed-off-by: Martin Kelly <mkelly@xevo.com> | 16 | Signed-off-by: Martin Kelly <mkelly@xevo.com> |
12 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | 17 | Signed-off-by: Khem Raj <raj.khem@gmail.com> |
13 | --- | 18 | --- |
14 | Upstream-Status: Pending | 19 | tools/llvm-config/llvm-config.cpp | 17 ++++++++++++++++- |
15 | 20 | 1 file changed, 16 insertions(+), 1 deletion(-) | |
16 | tools/llvm-config/llvm-config.cpp | 7 +++++++ | ||
17 | 1 file changed, 7 insertions(+) | ||
18 | 21 | ||
19 | diff --git a/tools/llvm-config/llvm-config.cpp b/tools/llvm-config/llvm-config.cpp | 22 | diff --git a/tools/llvm-config/llvm-config.cpp b/tools/llvm-config/llvm-config.cpp |
20 | index 08b096afb05..d8d7742744e 100644 | 23 | index 08b096afb05..360cc5abf4e 100644 |
21 | --- a/tools/llvm-config/llvm-config.cpp | 24 | --- a/tools/llvm-config/llvm-config.cpp |
22 | +++ b/tools/llvm-config/llvm-config.cpp | 25 | +++ b/tools/llvm-config/llvm-config.cpp |
23 | @@ -225,6 +225,13 @@ Typical components:\n\ | 26 | @@ -225,6 +225,13 @@ Typical components:\n\ |
@@ -34,6 +37,36 @@ index 08b096afb05..d8d7742744e 100644 | |||
34 | // This just needs to be some symbol in the binary; C++ doesn't | 37 | // This just needs to be some symbol in the binary; C++ doesn't |
35 | // allow taking the address of ::main however. | 38 | // allow taking the address of ::main however. |
36 | void *P = (void *)(intptr_t)GetExecutablePath; | 39 | void *P = (void *)(intptr_t)GetExecutablePath; |
40 | @@ -306,12 +313,20 @@ int main(int argc, char **argv) { | ||
41 | std::string ActivePrefix, ActiveBinDir, ActiveIncludeDir, ActiveLibDir, | ||
42 | ActiveCMakeDir; | ||
43 | std::string ActiveIncludeOption; | ||
44 | + // Hack for Yocto: we need to override the multilib path when we are using | ||
45 | + // llvm-config from within a target sysroot. | ||
46 | + std::string Multilibdir = std::getenv("YOCTO_ALTERNATE_MULTILIB_NAME"); | ||
47 | + if (Multilibdir.empty()) { | ||
48 | + Multilibdir = "/lib" LLVM_LIBDIR_SUFFIX; | ||
49 | + } | ||
50 | + | ||
51 | if (IsInDevelopmentTree) { | ||
52 | ActiveIncludeDir = std::string(LLVM_SRC_ROOT) + "/include"; | ||
53 | ActivePrefix = CurrentExecPrefix; | ||
54 | |||
55 | // CMake organizes the products differently than a normal prefix style | ||
56 | // layout. | ||
57 | + | ||
58 | switch (DevelopmentTreeLayout) { | ||
59 | case CMakeStyle: | ||
60 | ActiveBinDir = ActiveObjRoot + "/bin"; | ||
61 | @@ -336,7 +351,7 @@ int main(int argc, char **argv) { | ||
62 | SmallString<256> path(StringRef(LLVM_TOOLS_INSTALL_DIR)); | ||
63 | sys::fs::make_absolute(ActivePrefix, path); | ||
64 | ActiveBinDir = path.str(); | ||
65 | - ActiveLibDir = ActivePrefix + "/lib" + LLVM_LIBDIR_SUFFIX; | ||
66 | + ActiveLibDir = ActivePrefix + Multilibdir; | ||
67 | ActiveCMakeDir = ActiveLibDir + "/cmake/llvm"; | ||
68 | ActiveIncludeOption = "-I" + ActiveIncludeDir; | ||
69 | } | ||
37 | -- | 70 | -- |
38 | 2.16.1 | 71 | 2.18.0 |
39 | 72 | ||