compiling kernel error

I’m attempting to compile the kernel via the instructions here:

https://docs.nvidia.com/drive/nvvib_docs/index.html#page/NVIDIA%2520DRIVE%2520Linux%2520SDK%2520Development%2520Guide%2FSystem%2520Programming%2Fsys_programming_kernel_toolchain.html%23

I get the following error:

cc1: error: include location "/usr/local/include/external" is unsafe for cross-compilation [-Werror=poison-system-directories]
cc1: all warnings being treated as errors
/home/sam/tmp-nvidia/Drive/5050bL_SDK/DriveSDK/drive-oss-src/kernel/scripts/Makefile.build:296: recipe for target 'crypto/api.o' failed
make[2]: *** [crypto/api.o] Error 1
/home/sam/tmp-nvidia/Drive/5050bL_SDK/DriveSDK/drive-oss-src/kernel/Makefile:994: recipe for target 'crypto' failed
make[1]: *** [crypto] Error 2
make[1]: Leaving directory '/home/sam/tmp-nvidia/Drive/5050bL_SDK/DriveSDK/drive-oss-src/out-t186ref-linux'
Makefile:150: recipe for target 'sub-make' failed

The clue seems to be the “…is unsafe for cross-compilation…”

Is there something that needs to be set or unset?

Dear samrustan,

The cross compilation is looking for dependencies in the /usr/include/ (X86 location).
AFAIK, it looks like you have not specified the sysroot path in the cmake configuration. We can specify the sysroot path using : SET(CMAKE_FIND_ROOT_PATH $ENV{<PATH OF YOUR SYSROOT (or) the env. variable of the sysroot})