diff --git a/meta-oe/recipes-kernel/crash/crash-cross-canadian_9.0.2.bb b/meta-oe/recipes-kernel/crash/crash-cross-canadian_9.0.2.bb index 1a62441c05..924e3ccfc0 100644 --- a/meta-oe/recipes-kernel/crash/crash-cross-canadian_9.0.2.bb +++ b/meta-oe/recipes-kernel/crash/crash-cross-canadian_9.0.2.bb @@ -6,18 +6,25 @@ BPN = "crash" require crash.inc -DEPENDS:append = " \ +# cross-canadian.bbclass does not remap DEPENDS to their nativesdk variants, so +# override (rather than append to) the target DEPENDS pulled in from crash.inc. +# Leaving the target zlib/readline/ncurses/gmp/mpfr in place would stage a real +# target usr/lib into the recipe sysroot and clash with the nativesdk toolchain +# (e.g. clang-glue, which provides usr/lib as a symlink) during +# do_prepare_recipe_sysroot. +DEPENDS = " \ nativesdk-ncurses \ nativesdk-expat \ nativesdk-gettext \ nativesdk-gmp \ nativesdk-mpfr \ - nativesdk-readline \ nativesdk-zlib \ virtual/nativesdk-cross-cc \ virtual/nativesdk-cross-binutils \ - virtual/nativesdk-compilerlibs \ virtual/nativesdk-libc \ + coreutils-native \ + bison-native \ + flex-native \ " RDEPENDS:${PN} = "nativesdk-liblzma" @@ -43,9 +50,11 @@ EXTRA_OEMAKE:class-cross-canadian = ' \ ac_cv_header_sys_procfs_h=yes" \ ' -# Force the SDK cross-compiler during the command execution phase +# Build with the SDK cross-compiler. Use the toolchain-aware ${CC}/${CXX} +# rather than a hardcoded ${HOST_PREFIX}gcc so this also works for clang based +# SDKs (TOOLCHAIN = "clang"), which provide no ...-gcc. do_compile() { - oe_runmake ${EXTRA_OEMAKE} CC="${HOST_PREFIX}gcc ${HOST_CC_ARCH}" CXX="${HOST_PREFIX}g++ ${HOST_CC_ARCH}" RECIPE_SYSROOT=${RECIPE_SYSROOT} + oe_runmake ${EXTRA_OEMAKE} CC="${CC}" CXX="${CXX}" RECIPE_SYSROOT=${RECIPE_SYSROOT} } # To ship crash into your sdk, you should create/update a packagegroup-cross-canadian.bbappend and diff --git a/meta-oe/recipes-kernel/crash/crash.inc b/meta-oe/recipes-kernel/crash/crash.inc index 57a6c23bc4..dd231134b2 100644 --- a/meta-oe/recipes-kernel/crash/crash.inc +++ b/meta-oe/recipes-kernel/crash/crash.inc @@ -99,6 +99,13 @@ do_compile:prepend() { sed -i -e 's/#define TARGET_CFLAGS_MIPS_ON_X86_64.*/#define TARGET_CFLAGS_MIPS_ON_X86_64\t\"TARGET_CFLAGS=-D_FILE_OFFSET_BITS=64\"/g' ${S}/configure.c sed -i 's/>/>/g' ${S}/Makefile + # The crash gdb merge step re-enters the top-level crash Makefile from gdb's + # link rule ("make -C ../.. ... library") without passing the compiler, so + # crash's own objects fall back to the Makefile default $(CROSS_COMPILE)gcc. + # That only happens to work when a ${cross}-gcc exists; on clang toolchains + # (and any gcc-less SDK) it fails. Forward CC/CXX through that recursion. + sed -i 's|GDB_FLAGS=-DGDB_16_2 library|GDB_FLAGS=-DGDB_16_2 CC="$(CC)" CXX="$(CXX)" library|' ${S}/gdb-16.2.patch + # 5. Return to the active workspace build root to merge downstream additions cd ${B} bbnote "Applying the native upstream crash integration patch onto the GDB source tree..."