mirror of
https://github.com/openembedded/meta-openembedded.git
synced 2026-07-15 16:07:26 +00:00
crash-cross-canadian: fix build, including on clang based SDKs
The cross-canadian variant did not build. Several issues:
1. DEPENDS used :append on top of crash.inc's target DEPENDS. cross-canadian
does not remap DEPENDS to nativesdk, so the target zlib/readline/ncurses/
gmp/mpfr stayed in the dependency set and staged a real target usr/lib into
the recipe sysroot, clashing with the nativesdk toolchain (clang-glue
provides usr/lib as a symlink) during do_prepare_recipe_sysroot. Override
DEPENDS with the nativesdk set instead (matching gdb-cross-canadian) and add
the -native build tools the build needs.
2. do_compile hardcoded ${HOST_PREFIX}gcc, which does not exist on clang based
SDKs (TOOLCHAIN = "clang"), giving "C compiler cannot create executables".
Use the toolchain-aware ${CC}/${CXX} like the other variants.
3. crash's gdb merge re-enters the top-level crash Makefile from gdb's link
rule ("make -C ../.. ... library") without passing the compiler, so crash's
own objects fell back to the Makefile default $(CROSS_COMPILE)gcc and failed
to find a compiler on clang SDKs. Forward CC/CXX through that recursion in
the bundled gdb-16.2.patch; this is harmless where ${cross}-gcc exists.
Verified by building crash, crash-native, crash-cross and
crash-cross-canadian-x86-64 for a clang based SDK (qemux86-64).
Signed-off-by: Khem Raj <khem.raj@oss.qualcomm.com>
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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..."
|
||||
|
||||
Reference in New Issue
Block a user