External toolchain early build error

Hi,

I'm running into trouble caching a 19.07 build and then using it as an external toolchain in another directory.

My external build settings are as follows:

CONFIG_DEVEL=y
CONFIG_EXTERNAL_TOOLCHAIN=y
CONFIG_LIBC_ROOT_DIR="/opt/openwrt/staging_dir/toolchain-mipsel_24kc_gcc-7.5.0_musl"
CONFIG_LIBGCC_ROOT_DIR="/opt/openwrt/staging_dir/toolchain-mipsel_24kc_gcc-7.5.0_musl"
CONFIG_LIBPTHREAD_ROOT_DIR="/opt/openwrt/staging_dir/toolchain-mipsel_24kc_gcc-7.5.0_musl"
CONFIG_LIBRT_ROOT_DIR="/opt/openwrt/staging_dir/toolchain-mipsel_24kc_gcc-7.5.0_musl"
CONFIG_TARGET_NAME="mipsel_24kc"
CONFIG_TOOLCHAIN_PREFIX="mipsel-openwrt-linux-musl-"
CONFIG_TOOLCHAIN_ROOT="/opt/openwrt/staging_dir/toolchain-mipsel_24kc_gcc-7.5.0_musl"

All other related config is defaulted.

Here's the log...

...
mkdir -p kernel/
  mipsel-openwrt-linux-musl-gcc -Wp,-MD,kernel/.bounds.s.d  -nostdinc -isystem /opt/openwrt/staging_dir/toolchain-mipsel_24kc_gcc-7.5.0_musl/lib/gcc/mipsel-openwrt-linux-musl/7.5.0/include -I./arch/mips/include -I./arch/mips/include/generated  -I./include -I./arch/mips/include/uapi -I./arch/mips/include/generated/uapi -I./include/uapi -I./include/generated/uapi -include ./include/linux/kconfig.h -D__KERNEL__ -DVMLINUX_LOAD_ADDRESS=0xffffffff80001000 -DLINKER_LOAD_ADDRESS=0x80001000 -DDATAOFFSET=0 -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -fshort-wchar -Werror-implicit-function-declaration -Wno-format-security -std=gnu89 -fno-PIE -mno-check-zero-division -mabi=32 -G 0 -mno-abicalls -fno-pic -pipe -mno-branch-likely -msoft-float -DGAS_HAS_SET_HARDFLOAT -Wa,-msoft-float -ffreestanding -fno-stack-check -march=mips32r2 -mtune=34kc -Wa,--trap -DTOOLCHAIN_SUPPORTS_VIRT -I./arch/mips/include/asm/mach-ralink -I./arch/mips/include/asm/mach-ralink/mt7621 -I./arch/mips/include/asm/mach-generic -fno-asynchronous-unwind-tables -fno-delete-null-pointer-checks -Wno-frame-address -Wno-format-truncation -Wno-format-overflow -Wno-int-in-bool-context -O2 -fno-reorder-blocks -fno-tree-ch -fno-caller-saves --param=allow-store-data-races=0 -DCC_HAVE_ASM_GOTO -Wframe-larger-than=1024 -fstack-protector -Wno-unused-but-set-variable -Wno-unused-const-variable -fomit-frame-pointer -fno-var-tracking-assignments -g -femit-struct-debug-baseonly -fno-var-tracking -Wdeclaration-after-statement -Wno-pointer-sign -Wno-array-bounds -Wno-stringop-overflow -Wno-restrict -Wno-maybe-uninitialized -fno-strict-overflow -fno-merge-all-constants -fmerge-constants -fno-stack-check -fconserve-stack -Werror=implicit-int -Werror=strict-prototypes -Werror=date-time -Werror=incompatible-pointer-types -Werror=designated-init    -DKBUILD_BASENAME='"bounds"'  -DKBUILD_MODNAME='"bounds"'  -fverbose-asm -S -o kernel/bounds.s kernel/bounds.c
In file included from ./arch/mips/include/asm/mach-generic/spaces.h:15:0,
                 from ./arch/mips/include/asm/addrspace.h:13,
                 from ./arch/mips/include/asm/barrier.h:11,
                 from ./include/linux/compiler.h:240,
                 from ./arch/mips/include/asm/bug.h:5,
                 from ./include/linux/bug.h:5,
                 from ./include/linux/page-flags.h:10,
                 from kernel/bounds.c:10:
./arch/mips/include/asm/mipsregs.h:1149:33: error: unknown type name 'u16'; did you mean '__u16'?
 static inline int mm_insn_16bit(u16 insn)
                                 ^~~
                                 __u16
In file included from ./include/linux/page-flags.h:10:0,
                 from kernel/bounds.c:10:
./include/linux/bug.h: In function 'find_bug':
./include/linux/bug.h:50:9: error: 'NULL' undeclared (first use in this function)
  return NULL;
         ^~~~
...

This could be due to a missing preprocessor definition that defines the fundamentals like u16 and NULL, but there are many places these are defined and I've be unable to trace them to their roots. The include directories all appear to be Ok.