Pick up <linux/ioctl.h> and friends from TARGET.

Otherwise, cross-compiling fails on non-Linux build machines.

Signed-off-by: Alexey Neyman <stilor@att.net>
This commit is contained in:
Alexey Neyman 2017-01-09 01:01:52 -06:00
parent 37a5a09e65
commit c69e593a92

View File

@ -14,17 +14,29 @@ do_debug_strace_extract() {
do_debug_strace_build() { do_debug_strace_build() {
CT_DoStep INFO "Installing strace" CT_DoStep INFO "Installing strace"
mkdir -p "${CT_BUILD_DIR}/build-strace"
CT_Pushd "${CT_BUILD_DIR}/build-strace" # Strace needs _IOC definitions, and it tries to pick them up from <linux/ioctl.h>.
# While cross-compiling on a non-Linux host, we don't have this header. Replacing
# <linux/ioctl.h> with <sys/ioctl.h>, as suggested by many internet "solutions",
# is wrong: for example, MacOS defines _IOC macros differently, and we need the
# definitions for the target!
# Hence, create a "window" into target includes.
CT_DoExecLog ALL mkdir -p "${CT_BUILD_DIR}/build-strace-headers"
for d in linux asm asm-generic; do
CT_DoExecLog ALL ln -sf "${CT_HEADERS_DIR}/${d}" "${CT_BUILD_DIR}/build-strace-headers/${d}"
done
CT_mkdir_pushd "${CT_BUILD_DIR}/build-strace"
CT_DoLog EXTRA "Configuring strace" CT_DoLog EXTRA "Configuring strace"
CT_DoExecLog CFG \ CT_DoExecLog CFG \
CC="${CT_TARGET}-gcc" \ CFLAGS_FOR_BUILD="-I ${CT_BUILD_DIR}/build-strace-headers" \
CPP="${CT_TARGET}-cpp" \ CC="${CT_TARGET}-gcc" \
LD="${CT_TARGET}-ld" \ CPP="${CT_TARGET}-cpp" \
"${CT_SRC_DIR}/strace-${CT_STRACE_VERSION}/configure" \ LD="${CT_TARGET}-ld" \
--build=${CT_BUILD} \ "${CT_SRC_DIR}/strace-${CT_STRACE_VERSION}/configure" \
--host=${CT_TARGET} \ --build=${CT_BUILD} \
--host=${CT_TARGET} \
--prefix=/usr --prefix=/usr
CT_DoLog EXTRA "Building strace" CT_DoLog EXTRA "Building strace"