Tuesday, January 4, 2022

[SOLVED] Yocto SDK Kernel Source make scripts fails

Issue

I am trying to compile my kernel module using the Yocto SDK I generated via bitbake.

The SDK builds without issue, but when I try to run make scripts ARCH=arm64 in the kernel source directory of my target's sysroot, I get an issue regarding a missing header file:

  ...
  HOSTCC  scripts/conmakehash
  HOSTCC  scripts/sortextable
  HOSTCC  scripts/asn1_compiler
  HOSTCC  scripts/extract-cert
scripts/extract-cert.c:21:10: fatal error: openssl/bio.h: No such file or directory
   21 | #include <openssl/bio.h>
      |          ^~~~~~~~~~~~~~~
compilation terminated.
make[1]: *** [scripts/Makefile.host:107: scripts/extract-cert] Error 1
make: *** [Makefile:1096: scripts] Error 2

I have TOOLCHAIN_TARGET_TASK_append = " kernel-devsrc openssl-dev alsa-dev" in my image .bb file, which I believe should provide the missing openssl/bio.h file, but this does not seem to be the case.

The only way I have been able to solve this issue is to install libssl-dev on my SDK machine, but this feels like a workaround, and not the proper solution. My expectation is that when you source the environment from the SDK, it should provide the necessary headers for the kernel.


Solution

Since scripts/extract-cert.c is compiled for the host environment, I'd rather try appending TOOLCHAIN_HOST_TASK variable with " openssl-dev ".

See this question: TOOLCHAIN_HOST_TASK Vs TOOLCHAIN_TARGET_TASK



Answered By - Yury Lunev