From 9660e15264bd68ce4d62b64de2ea08e6b0debf37 Mon Sep 17 00:00:00 2001 From: Martin Kelly Date: Thu, 16 Mar 2017 10:49:10 -0700 Subject: clang: fix the llvm-common wrapper The llvm-common wrapper refers to the LLVM_WANT_RELEASE variable, which is not actually exported, so it fails. In addition, meta-clang does not support multiple side-by-side LLVM versions anyway, so the logic isn't really needed. After fixing these issues, I discovered that llvm-config doesn't cross-compile properly without more extensive wrapping. Specifically, the native llvm-config supplies --libdir, and other arguments relative to its current executable path, so it points into the native sysroot rather than the target sysroot. In addition, it supplies the native rather than the target compile CFLAGS, LDFLAGS, etc. Fix these issues by doing the following: - Alter the llvm-config to intercept certain flags, such as --cflags, while passing on other flags to the native llvm-config. - Patch llvm-config to be able to specify an alternate root location on which to base --libdir, etc. in order to optionally point into the target sysroot when needed. Signed-off-by: Martin Kelly --- recipes-devtools/clang/clang_git.bb | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) (limited to 'recipes-devtools/clang/clang_git.bb') diff --git a/recipes-devtools/clang/clang_git.bb b/recipes-devtools/clang/clang_git.bb index 67b9597..28baa05 100644 --- a/recipes-devtools/clang/clang_git.bb +++ b/recipes-devtools/clang/clang_git.bb @@ -22,6 +22,7 @@ SRC_URI += "\ file://0001-llvm-Remove-CMAKE_CROSSCOMPILING-so-it-can-cross-com.patch \ file://0002-llvm-Do-not-assume-linux-glibc.patch \ file://0003-llvm-TargetLibraryInfo-Undefine-libc-functions-if-th.patch \ + file://0004-llvm-allow-env-override-of-exe-path.patch \ " # Clang patches @@ -96,12 +97,6 @@ DEPENDS_remove_class-nativesdk = "nativesdk-binutils nativesdk-compiler-rt nativ DEPENDS_append_class-nativesdk = " clang-native virtual/${TARGET_PREFIX}binutils-crosssdk virtual/${TARGET_PREFIX}gcc-crosssdk virtual/${TARGET_PREFIX}g++-crosssdk" DEPENDS_append_class-target = " clang-cross-${TARGET_ARCH} ${@bb.utils.contains('TOOLCHAIN', 'gcc', 'virtual/${TARGET_PREFIX}gcc virtual/${TARGET_PREFIX}g++', '', d)}" -do_configure_prepend() { - # Fix paths in llvm-config - sed -i "s|sys::path::parent_path(CurrentPath))\.str()|sys::path::parent_path(sys::path::parent_path(CurrentPath))).str()|g" ${S}/tools/llvm-config/llvm-config.cpp - sed -ri "s#/(bin|include|lib)(/?\")#/\1/${LLVM_DIR}\2#g" ${S}/tools/llvm-config/llvm-config.cpp -} - do_compile_prepend_class-native () { oe_runmake LLVM-tablegen-host oe_runmake CLANG-tablegen-host -- cgit v1.2.3-54-g00ecf