Compiling Linux Kernel fails looking at OpenSSL header files

Last modified by Microchip on 2025/02/28 09:53

Description

While compiling the Linux kernel, some error described below are met with the scripts/sign-file or scripts/extract-cert host compilation steps.

Additional information

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 Kernelhttps://www.linux4sam.org/pub/TWiki/TWikiDocGraphics/external-link.gif.

Solution

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 
  • For modern Fedora:
 sudo dnf install openssl-devel
Information

These commands will require root privileges or being in a correct sudoers group.

Related Topics

Boards

Sama5d2icp
[Sam9x60EK
Sama5d27WLSom1EK
Sama5d27Som1EK
Sama5d2PtcEK
Sama5d2Xplained
Sama5d3xek
Sama5d3Xplained
Sama5d4Xplained
Sama5d4ek
AT91sam9x5-ek
other AT91SAM9 boards

Components

Kernel

Summary

Kernel Compilation Error related to OpenSSL