问题描述

  • 虚拟机 VM Ware 重新安装的 ubuntu 22.04,在编译Linux 内核时,报【编译错误】,提示 ​​openssl/bio.h: No such file or directory​
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

解决方法

  • 使用 ​​sudo apt install openssl​​,提示 openssl 已经安装,编译报错依旧存在
zhangsz@zhangsz-virtual-machine:~/linux/imx6q/linux-imx$ sudo apt install openssl
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
openssl is already the newest version (3.0.2-0ubuntu1.7).
openssl set to manually installed.
The following packages were automatically installed and are no longer required:
chromium-codecs-ffmpeg-extra gstreamer1.0-vaapi i965-va-driver intel-media-va-driver libaacs0 libaom3 libass9 libavcodec58 libavformat58 libavutil56 libbdplus0 libblas3 libbluray2 libbs2b0
libchromaprint1 libcodec2-1.0 libdav1d5 libflashrom1 libflite1 libftdi1-2 libgme0 libgsm1 libgstreamer-plugins-bad1.0-0 libigdgmm12 liblilv-0-0 libmfx1 libmysofa1 libnorm1 libopenmpt0
libpgm-5.3-0 libpostproc55 librabbitmq4 librubberband2 libserd-0-0 libshine3 libsnappy1v5 libsord-0-0 libsratom-0-0 libsrt1.4-gnutls libssh-gcrypt-4 libswresample3 libswscale5 libudfread0
libva-drm2 libva-wayland2 libva-x11-2 libva2 libvdpau1 libvidstab1.1 libx265-199 libxvidcore4 libzimg2 libzmq5 libzvbi-common libzvbi0 mesa-va-drivers mesa-vdpau-drivers pocketsphinx-en-us
va-driver-all vdpau-driver-all
Use 'sudo apt autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
  • 经过尝试,需要安装 ​​libssl-dev​
  • ​sudo apt install libssl-dev​​ 后,发现编译错误消除,问题解决

小结

  • 初次编译Linux 内核,会遇到一些错误,记录常见的编译错误,从而提高解决编译问题的效率