summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOvidiu Panait <ovidiu.panait@windriver.com>2020-01-31 15:27:48 +0200
committerKhem Raj <raj.khem@gmail.com>2020-02-02 10:10:04 -0800
commitab686950af8d7f02e0ca614d277c7c0ca36954ed (patch)
treec2e1782dbf1988e7a80c3f72001fb16daeaa239d
parent0e4ed19a6dfd56f33499d5a5dbbe55b2fbef1518 (diff)
downloadmeta-clang-ab686950af8d7f02e0ca614d277c7c0ca36954ed.tar.gz
clang,llvm: cmake: Fix configure for packages using find_package()
Currently, when a package (i.e. bcc [https://github.com/iovisor/bcc.git]) that depends on LLVM/Clang tries to run cmake find_package() during do_configure, it will fail with a similar error: | The imported target "llvm-tblgen" references the file | ".../recipe-sysroot/usr/bin/llvm-tblgen" | | but this file does not exist. Possible reasons include: | * The file was deleted, renamed, or moved to another location. | * An install or uninstall procedure did not complete successfully. | * The installation package was faulty and contained | ".../recipe-sysroot/usr/lib/cmake/LLVMExports.cmake" | but not all the files it references. This is due to the fact that currently the exported cmake scripts look for target binaries in sysroot. Work around this by not exporting the target binaries in Exports-* cmake files. Upstream-Status: Innapropriate [oe-specific] Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
-rw-r--r--recipes-devtools/clang/clang/0029-clang-llvm-cmake-Fix-configure-for-packages-using-fi.patch138
-rw-r--r--recipes-devtools/clang/common.inc1
2 files changed, 139 insertions, 0 deletions
diff --git a/recipes-devtools/clang/clang/0029-clang-llvm-cmake-Fix-configure-for-packages-using-fi.patch b/recipes-devtools/clang/clang/0029-clang-llvm-cmake-Fix-configure-for-packages-using-fi.patch
new file mode 100644
index 0000000..fd27440
--- /dev/null
+++ b/recipes-devtools/clang/clang/0029-clang-llvm-cmake-Fix-configure-for-packages-using-fi.patch
@@ -0,0 +1,138 @@
1From b79837a3b7aa677b44110de4e9e7576fa34a96e3 Mon Sep 17 00:00:00 2001
2From: Ovidiu Panait <ovidiu.panait@windriver.com>
3Date: Fri, 31 Jan 2020 10:56:11 +0200
4Subject: [PATCH] clang,llvm: cmake: Fix configure for packages using
5 find_package()
6
7Currently, when a package (i.e. bcc [https://github.com/iovisor/bcc.git])
8that depends on LLVM/Clang tries to run cmake find_package() during
9do_configure, it will fail with a similar error:
10
11| The imported target "llvm-tblgen" references the file
12| ".../recipe-sysroot/usr/bin/llvm-tblgen"
13|
14| but this file does not exist. Possible reasons include:
15| * The file was deleted, renamed, or moved to another location.
16| * An install or uninstall procedure did not complete successfully.
17| * The installation package was faulty and contained
18| ".../recipe-sysroot/usr/lib/cmake/LLVMExports.cmake"
19| but not all the files it references.
20
21This is due to the fact that currently the cmake scripts look for target
22binaries in sysroot. Work around this by not exporting the target binaries in
23Exports-* cmake files.
24
25Upstream-Status: Innapropriate [oe-specific]
26
27Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
28---
29 clang/cmake/modules/AddClang.cmake | 9 ---------
30 llvm/cmake/modules/AddLLVM.cmake | 20 --------------------
31 llvm/cmake/modules/TableGen.cmake | 8 --------
32 3 files changed, 37 deletions(-)
33
34diff --git a/clang/cmake/modules/AddClang.cmake b/clang/cmake/modules/AddClang.cmake
35index cbd618e18af..b864c2b2303 100644
36--- a/clang/cmake/modules/AddClang.cmake
37+++ b/clang/cmake/modules/AddClang.cmake
38@@ -146,15 +146,7 @@ macro(add_clang_tool name)
39 add_dependencies(${name} clang-resource-headers)
40
41 if (CLANG_BUILD_TOOLS)
42- set(export_to_clangtargets)
43- if(${name} IN_LIST LLVM_DISTRIBUTION_COMPONENTS OR
44- NOT LLVM_DISTRIBUTION_COMPONENTS)
45- set(export_to_clangtargets EXPORT ClangTargets)
46- set_property(GLOBAL PROPERTY CLANG_HAS_EXPORTS True)
47- endif()
48-
49 install(TARGETS ${name}
50- ${export_to_clangtargets}
51 RUNTIME DESTINATION bin
52 COMPONENT ${name})
53
54@@ -163,7 +155,6 @@ macro(add_clang_tool name)
55 DEPENDS ${name}
56 COMPONENT ${name})
57 endif()
58- set_property(GLOBAL APPEND PROPERTY CLANG_EXPORTS ${name})
59 endif()
60 endmacro()
61
62diff --git a/llvm/cmake/modules/AddLLVM.cmake b/llvm/cmake/modules/AddLLVM.cmake
63index 619e986b8aa..ab4b2234fa5 100644
64--- a/llvm/cmake/modules/AddLLVM.cmake
65+++ b/llvm/cmake/modules/AddLLVM.cmake
66@@ -898,15 +898,7 @@ macro(add_llvm_tool name)
67
68 if ( ${name} IN_LIST LLVM_TOOLCHAIN_TOOLS OR NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
69 if( LLVM_BUILD_TOOLS )
70- set(export_to_llvmexports)
71- if(${name} IN_LIST LLVM_DISTRIBUTION_COMPONENTS OR
72- NOT LLVM_DISTRIBUTION_COMPONENTS)
73- set(export_to_llvmexports EXPORT LLVMExports)
74- set_property(GLOBAL PROPERTY LLVM_HAS_EXPORTS True)
75- endif()
76-
77 install(TARGETS ${name}
78- ${export_to_llvmexports}
79 RUNTIME DESTINATION ${LLVM_TOOLS_INSTALL_DIR}
80 COMPONENT ${name})
81
82@@ -917,9 +909,6 @@ macro(add_llvm_tool name)
83 endif()
84 endif()
85 endif()
86- if( LLVM_BUILD_TOOLS )
87- set_property(GLOBAL APPEND PROPERTY LLVM_EXPORTS ${name})
88- endif()
89 set_target_properties(${name} PROPERTIES FOLDER "Tools")
90 endmacro(add_llvm_tool name)
91
92@@ -946,15 +935,7 @@ macro(add_llvm_utility name)
93 set_target_properties(${name} PROPERTIES FOLDER "Utils")
94 if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
95 if (LLVM_INSTALL_UTILS AND LLVM_BUILD_UTILS)
96- set(export_to_llvmexports)
97- if (${name} IN_LIST LLVM_DISTRIBUTION_COMPONENTS OR
98- NOT LLVM_DISTRIBUTION_COMPONENTS)
99- set(export_to_llvmexports EXPORT LLVMExports)
100- set_property(GLOBAL PROPERTY LLVM_HAS_EXPORTS True)
101- endif()
102-
103 install(TARGETS ${name}
104- ${export_to_llvmexports}
105 RUNTIME DESTINATION ${LLVM_UTILS_INSTALL_DIR}
106 COMPONENT ${name})
107
108@@ -963,7 +944,6 @@ macro(add_llvm_utility name)
109 DEPENDS ${name}
110 COMPONENT ${name})
111 endif()
112- set_property(GLOBAL APPEND PROPERTY LLVM_EXPORTS ${name})
113 elseif(LLVM_BUILD_UTILS)
114 set_property(GLOBAL APPEND PROPERTY LLVM_EXPORTS_BUILDTREE_ONLY ${name})
115 endif()
116diff --git a/llvm/cmake/modules/TableGen.cmake b/llvm/cmake/modules/TableGen.cmake
117index 36c026b5c0f..c588ce6e38b 100644
118--- a/llvm/cmake/modules/TableGen.cmake
119+++ b/llvm/cmake/modules/TableGen.cmake
120@@ -148,15 +148,7 @@ macro(add_tablegen target project)
121 endif()
122
123 if (${project} STREQUAL LLVM AND NOT LLVM_INSTALL_TOOLCHAIN_ONLY AND LLVM_BUILD_UTILS)
124- set(export_to_llvmexports)
125- if(${target} IN_LIST LLVM_DISTRIBUTION_COMPONENTS OR
126- NOT LLVM_DISTRIBUTION_COMPONENTS)
127- set(export_to_llvmexports EXPORT LLVMExports)
128- endif()
129-
130 install(TARGETS ${target}
131- ${export_to_llvmexports}
132 RUNTIME DESTINATION ${LLVM_TOOLS_INSTALL_DIR})
133 endif()
134- set_property(GLOBAL APPEND PROPERTY LLVM_EXPORTS ${target})
135 endmacro()
136--
1372.17.1
138
diff --git a/recipes-devtools/clang/common.inc b/recipes-devtools/clang/common.inc
index 3333b34..16df75c 100644
--- a/recipes-devtools/clang/common.inc
+++ b/recipes-devtools/clang/common.inc
@@ -36,6 +36,7 @@ SRC_URI = "\
36 file://0026-libclang-Use-CMAKE_DL_LIBS-for-deducing-libdl.patch \ 36 file://0026-libclang-Use-CMAKE_DL_LIBS-for-deducing-libdl.patch \
37 file://0027-Fix-sanitizer-common-build-with-glibc-2.31.patch \ 37 file://0027-Fix-sanitizer-common-build-with-glibc-2.31.patch \
38 file://0028-Add-libgcc-to-link-step-for-libcxx.patch \ 38 file://0028-Add-libgcc-to-link-step-for-libcxx.patch \
39 file://0029-clang-llvm-cmake-Fix-configure-for-packages-using-fi.patch \
39" 40"
40 41
41# Fallback to no-PIE if not set 42# Fallback to no-PIE if not set