From: Peter Marko <[email protected]>
This assignment was present in scarthgap meta-clang.
* commit adding it: [1]
* commit removing it from native case: [2]
* it was removed completely when migrating clang to oe-core
After migration from scarthgap to wrynose (or current master), clang
extra tools like clang-tidy do not work anymore.
This restores the state before migration from meta-clang to oe-core.
Test recipe used for fix validation:
test-recipe.bb:
SUMMARY = "clang-tidy demonstration program"
SECTION = "examples"
HOMEPAGE = "n/a"
LICENSE = "GPL-2.0-only"
LIC_FILES_CHKSUM =
"file://${COREBASE}/meta/files/common-licenses/GPL-2.0-only;md5=801f80980d171dd6425610833a22dbe6"
SRC_URI = "file://CMakeLists.txt file://hello-world.cpp"
S = "${UNPACKDIR}"
TOOLCHAIN = "clang"
inherit cmake
CMakeLists.txt
project(hello-world)
cmake_minimum_required(VERSION 3.5)
find_program(CLANG_TIDY NAMES clang-tidy)
set(CMAKE_CXX_CLANG_TIDY "${CLANG_TIDY}" "--checks=*")
add_executable(${PROJECT_NAME} hello-world.cpp)
hello-world.cpp
#include <iostream>
int main() {
std::cout << "Hello World!";
return 0;
}
[1]
https://github.com/kraj/meta-clang/commit/503aa977b27be0506fb6ac21fbf9e8b049b82247
[2]
https://github.com/kraj/meta-clang/commit/6da0abaa33b458a37b97f42e3755245e3220bf27
Signed-off-by: Peter Marko <[email protected]>
---
v2:
* removed native variant, which will make it equivalent to pre-move mota-clang
* remove unuseful AI explanation from commit message
meta/classes/toolchain/clang.bbclass | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/meta/classes/toolchain/clang.bbclass
b/meta/classes/toolchain/clang.bbclass
index 9a3cd0e584..f6b554d210 100644
--- a/meta/classes/toolchain/clang.bbclass
+++ b/meta/classes/toolchain/clang.bbclass
@@ -34,6 +34,10 @@ LDFLAGS:append:class-nativesdk:x86-64 = "
-Wl,-dynamic-linker,${base_libdir}/ld-
LDFLAGS:append:class-nativesdk:aarch64 = "
-Wl,-dynamic-linker,${base_libdir}/ld-linux-aarch64.so.1"
LDFLAGS:append:class-cross-canadian = "
-Wl,-dynamic-linker,${base_libdir}/placeholder/to/be/rewritten/by/sdk/installer"
+# helps extra tools like clang-tidy to find arch-specific macros and headers
in a cross compile environment
+HOST_CC_ARCH:prepend:class-target = "-target ${HOST_SYS} "
+HOST_CC_ARCH:prepend:class-nativesdk = "-target ${HOST_SYS} "
+
# do_populate_sysroot needs STRIP, do_package_qa needs OBJDUMP
POPULATESYSROOTDEPS:append:class-target = " llvm-native:do_populate_sysroot"
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#243883):
https://lists.openembedded.org/g/openembedded-core/message/243883
Mute This Topic: https://lists.openembedded.org/mt/120852316/21656
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-