diff options
| author | Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com> | 2025-04-16 18:59:27 +0300 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2025-04-17 11:03:22 +0100 |
| commit | 482da5d873a46bc10e7e48c01cdb7ff65a67c4b5 (patch) | |
| tree | e172cb508db15eed18b238d26af92d60f78bd924 | |
| parent | f21acc0075a9cc07a4fab741a5233d5e0309a26a (diff) | |
| download | poky-482da5d873a46bc10e7e48c01cdb7ff65a67c4b5.tar.gz | |
llvm: import build fix from meta-clang
Import a fix from meta-clang, which allows packages using LLVM to find
tools from the native sysroot.
(From OE-Core rev: 112b9d4c4c10d7ac0e2a8bc239d451b84b90c82c)
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
| -rw-r--r-- | meta/recipes-devtools/llvm/llvm/0014-cmake-Fix-configure-for-packages-using-find_package.patch | 117 | ||||
| -rw-r--r-- | meta/recipes-devtools/llvm/llvm_20.1.2.bb | 1 |
2 files changed, 118 insertions, 0 deletions
diff --git a/meta/recipes-devtools/llvm/llvm/0014-cmake-Fix-configure-for-packages-using-find_package.patch b/meta/recipes-devtools/llvm/llvm/0014-cmake-Fix-configure-for-packages-using-find_package.patch new file mode 100644 index 0000000000..94c056ab8e --- /dev/null +++ b/meta/recipes-devtools/llvm/llvm/0014-cmake-Fix-configure-for-packages-using-find_package.patch | |||
| @@ -0,0 +1,117 @@ | |||
| 1 | From 93141cee493022d9f39dbd1f5f0bb0a1110ac829 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Ovidiu Panait <ovidiu.panait@windriver.com> | ||
| 3 | Date: Fri, 31 Jan 2020 10:56:11 +0200 | ||
| 4 | Subject: [PATCH] cmake: Fix configure for packages using find_package() | ||
| 5 | |||
| 6 | Currently, when a package (i.e. bcc [https://github.com/iovisor/bcc.git]) | ||
| 7 | that depends on LLVM/Clang tries to run cmake find_package() during | ||
| 8 | do_configure, it will fail with a similar error: | ||
| 9 | |||
| 10 | | The imported target "llvm-tblgen" references the file | ||
| 11 | | ".../recipe-sysroot/usr/bin/llvm-tblgen" | ||
| 12 | | | ||
| 13 | | but this file does not exist. Possible reasons include: | ||
| 14 | | * The file was deleted, renamed, or moved to another location. | ||
| 15 | | * An install or uninstall procedure did not complete successfully. | ||
| 16 | | * The installation package was faulty and contained | ||
| 17 | | ".../recipe-sysroot/usr/lib/cmake/LLVMExports.cmake" | ||
| 18 | | but not all the files it references. | ||
| 19 | |||
| 20 | This is due to the fact that currently the cmake scripts look for target | ||
| 21 | binaries in sysroot. Work around this by not exporting the target binaries in | ||
| 22 | Exports-* cmake files. | ||
| 23 | |||
| 24 | Upstream-Status: Inappropriate [oe-specific] | ||
| 25 | |||
| 26 | Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com> | ||
| 27 | --- | ||
| 28 | clang/cmake/modules/AddClang.cmake | 2 -- | ||
| 29 | llvm/cmake/modules/AddLLVM.cmake | 9 ++------- | ||
| 30 | llvm/cmake/modules/TableGen.cmake | 6 ------ | ||
| 31 | 3 files changed, 2 insertions(+), 15 deletions(-) | ||
| 32 | |||
| 33 | diff --git a/clang/cmake/modules/AddClang.cmake b/clang/cmake/modules/AddClang.cmake | ||
| 34 | index cdc8bd5cd503..5faa9117a30f 100644 | ||
| 35 | --- a/clang/cmake/modules/AddClang.cmake | ||
| 36 | +++ b/clang/cmake/modules/AddClang.cmake | ||
| 37 | @@ -182,7 +182,6 @@ macro(add_clang_tool name) | ||
| 38 | if (CLANG_BUILD_TOOLS) | ||
| 39 | get_target_export_arg(${name} Clang export_to_clangtargets) | ||
| 40 | install(TARGETS ${name} | ||
| 41 | - ${export_to_clangtargets} | ||
| 42 | RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" | ||
| 43 | COMPONENT ${name}) | ||
| 44 | |||
| 45 | @@ -191,7 +190,6 @@ macro(add_clang_tool name) | ||
| 46 | DEPENDS ${name} | ||
| 47 | COMPONENT ${name}) | ||
| 48 | endif() | ||
| 49 | - set_property(GLOBAL APPEND PROPERTY CLANG_EXPORTS ${name}) | ||
| 50 | endif() | ||
| 51 | endif() | ||
| 52 | set_target_properties(${name} PROPERTIES XCODE_GENERATE_SCHEME ON) | ||
| 53 | diff --git a/llvm/cmake/modules/AddLLVM.cmake b/llvm/cmake/modules/AddLLVM.cmake | ||
| 54 | index d3e9377c8d2f..fe22d6f2b35a 100644 | ||
| 55 | --- a/llvm/cmake/modules/AddLLVM.cmake | ||
| 56 | +++ b/llvm/cmake/modules/AddLLVM.cmake | ||
| 57 | @@ -1492,7 +1492,6 @@ macro(llvm_add_tool project name) | ||
| 58 | if( LLVM_BUILD_TOOLS ) | ||
| 59 | get_target_export_arg(${name} ${project} export_to_llvmexports) | ||
| 60 | install(TARGETS ${name} | ||
| 61 | - ${export_to_llvmexports} | ||
| 62 | RUNTIME DESTINATION ${${project}_TOOLS_INSTALL_DIR} | ||
| 63 | COMPONENT ${name}) | ||
| 64 | |||
| 65 | @@ -1503,10 +1502,8 @@ macro(llvm_add_tool project name) | ||
| 66 | endif() | ||
| 67 | endif() | ||
| 68 | endif() | ||
| 69 | - if( LLVM_BUILD_TOOLS ) | ||
| 70 | - string(TOUPPER "${project}" project_upper) | ||
| 71 | - set_property(GLOBAL APPEND PROPERTY ${project_upper}_EXPORTS ${name}) | ||
| 72 | - endif() | ||
| 73 | + string(TOUPPER "${project}" project_upper) | ||
| 74 | + set_target_properties(${name} PROPERTIES FOLDER "Tools") | ||
| 75 | endif() | ||
| 76 | get_subproject_title(subproject_title) | ||
| 77 | set_target_properties(${name} PROPERTIES FOLDER "${subproject_title}/Tools") | ||
| 78 | @@ -1556,7 +1553,6 @@ macro(add_llvm_utility name) | ||
| 79 | if (LLVM_INSTALL_UTILS AND LLVM_BUILD_UTILS) | ||
| 80 | get_target_export_arg(${name} LLVM export_to_llvmexports) | ||
| 81 | install(TARGETS ${name} | ||
| 82 | - ${export_to_llvmexports} | ||
| 83 | RUNTIME DESTINATION ${LLVM_UTILS_INSTALL_DIR} | ||
| 84 | COMPONENT ${name}) | ||
| 85 | |||
| 86 | @@ -1565,7 +1561,6 @@ macro(add_llvm_utility name) | ||
| 87 | DEPENDS ${name} | ||
| 88 | COMPONENT ${name}) | ||
| 89 | endif() | ||
| 90 | - set_property(GLOBAL APPEND PROPERTY LLVM_EXPORTS ${name}) | ||
| 91 | elseif(LLVM_BUILD_UTILS) | ||
| 92 | set_property(GLOBAL APPEND PROPERTY LLVM_EXPORTS_BUILDTREE_ONLY ${name}) | ||
| 93 | endif() | ||
| 94 | diff --git a/llvm/cmake/modules/TableGen.cmake b/llvm/cmake/modules/TableGen.cmake | ||
| 95 | index ffcc718b4777..a76f28e74b86 100644 | ||
| 96 | --- a/llvm/cmake/modules/TableGen.cmake | ||
| 97 | +++ b/llvm/cmake/modules/TableGen.cmake | ||
| 98 | @@ -232,12 +232,7 @@ macro(add_tablegen target project) | ||
| 99 | |||
| 100 | if (ADD_TABLEGEN_DESTINATION AND NOT LLVM_INSTALL_TOOLCHAIN_ONLY AND | ||
| 101 | (LLVM_BUILD_UTILS OR ${target} IN_LIST LLVM_DISTRIBUTION_COMPONENTS)) | ||
| 102 | - set(export_arg) | ||
| 103 | - if(ADD_TABLEGEN_EXPORT) | ||
| 104 | - get_target_export_arg(${target} ${ADD_TABLEGEN_EXPORT} export_arg) | ||
| 105 | - endif() | ||
| 106 | install(TARGETS ${target} | ||
| 107 | - ${export_arg} | ||
| 108 | COMPONENT ${target} | ||
| 109 | RUNTIME DESTINATION "${ADD_TABLEGEN_DESTINATION}") | ||
| 110 | if(NOT LLVM_ENABLE_IDE) | ||
| 111 | @@ -248,6 +243,5 @@ macro(add_tablegen target project) | ||
| 112 | endif() | ||
| 113 | if(ADD_TABLEGEN_EXPORT) | ||
| 114 | string(TOUPPER ${ADD_TABLEGEN_EXPORT} export_upper) | ||
| 115 | - set_property(GLOBAL APPEND PROPERTY ${export_upper}_EXPORTS ${target}) | ||
| 116 | endif() | ||
| 117 | endmacro() | ||
diff --git a/meta/recipes-devtools/llvm/llvm_20.1.2.bb b/meta/recipes-devtools/llvm/llvm_20.1.2.bb index b51ab703a1..4b24d28364 100644 --- a/meta/recipes-devtools/llvm/llvm_20.1.2.bb +++ b/meta/recipes-devtools/llvm/llvm_20.1.2.bb | |||
| @@ -39,6 +39,7 @@ SRC_URI_SPIRV:append:class-native = " \ | |||
| 39 | SRC_URI = "https://github.com/llvm/llvm-project/releases/download/llvmorg-${PV}/llvm-project-${PV}.src.tar.xz \ | 39 | SRC_URI = "https://github.com/llvm/llvm-project/releases/download/llvmorg-${PV}/llvm-project-${PV}.src.tar.xz \ |
| 40 | file://0007-llvm-allow-env-override-of-exe-path.patch \ | 40 | file://0007-llvm-allow-env-override-of-exe-path.patch \ |
| 41 | file://0001-AsmMatcherEmitter-sort-ClassInfo-lists-by-name-as-we.patch \ | 41 | file://0001-AsmMatcherEmitter-sort-ClassInfo-lists-by-name-as-we.patch \ |
| 42 | file://0014-cmake-Fix-configure-for-packages-using-find_package.patch \ | ||
| 42 | ${@bb.utils.contains('PACKAGECONFIG', 'spirv-llvm-translator', '${SRC_URI_SPIRV}', '', d)} \ | 43 | ${@bb.utils.contains('PACKAGECONFIG', 'spirv-llvm-translator', '${SRC_URI_SPIRV}', '', d)} \ |
| 43 | file://llvm-config \ | 44 | file://llvm-config \ |
| 44 | " | 45 | " |
