Compiling Linux Kernel fails looking at OpenSSL header files
While compiling the Linux kernel, some error described below are met with the
scripts/sign-file
or
scripts/extract-cert
host compilation steps.
Here are the build logs that are displayed when error occurs:
HOSTCC scripts/asn1_compiler
HOSTCC scripts/extract-cert
In file included from /usr/include/openssl/e_os2.h:13,
from /usr/include/openssl/bio.h:13,
from ../scripts/extract-cert.c:21:
/usr/include/x86_64-linux-gnu/openssl/opensslconf.h:13:10: fatal error: openssl/opensslv.h: Aucun fichier ou dossier de ce type
13 | #include <openssl/opensslv.h>
| ^~~~~~~~~~~~~~~~~~~~
compilation terminated.
make[2]: *** [scripts/Makefile.host:107 : scripts/extract-cert] Erreur 1
make[1]: *** [/data/linux-at91/Makefile:1120 : scripts] Erreur 2
make: *** [../Makefile:179 : sub-make] Erreur 2
or
HOSTCC scripts/extract-cert
../scripts/extract-cert.c:21:10: fatal error: openssl/bio.h: Aucun fichier ou dossier de ce type
21 | #include <openssl/bio.h>
| ^~~~~~~~~~~~~~~
compilation terminated.
make[2]: *** [scripts/Makefile.host:107 : scripts/extract-cert] Erreur 1
make[1]: *** [/data/linux-at91/Makefile:1120 : scripts] Erreur 2
make: *** [../Makefile:179 : sub-make] Erreur 2
This is due to missing OpenSSL development package which needs to be installed in on your host machine. These requirements are mentioned in a dedicated Kernel documentation page:
Minimal requirements to compile the Kernel.
Depending on your host machine distribution, you should install
libssl-dev
or equivalent package with following commands:
- For Ubuntu up to version 18.04:
$ sudo apt install libssl1.0-dev
- For Ubuntu version 20.04 onward:
$ sudo apt install libssl-dev
sudo yum install openssl-devel
sudo dnf install openssl-devel
These commands will require
root privileges or being in a correct sudoers group.