Compiling Linux Kernel fails looking at OpenSSL header files

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 Kernel.

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

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

r1 - 26 Feb 2021 - 16:25:33 - NicolasFerre
 
Linux & Open Source for AT91 Microchip Microprocessors

Copyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.

Linux® is the registered trademark of Linus Torvalds in the U.S. and other countries.

Microchip and others, are registered trademarks or trademarks of Microchip Technology Inc. and its subsidiaries. This site is powered by the TWiki collaboration platform

Arm® and others are registered trademarks or trademarks of Arm Limited (or its affiliates). Other terms and product names may be trademarks of others.

Ideas, requests, contributions ? Connect to LinksToCommunities page.

Syndicate this siteRSS ATOM