红联Linux门户
Linux帮助

linux(ubuntu)编译linux内核提示openssl/opensslv.h文件缺失

发布时间:2017-01-30 11:15:57来源:blog.csdn.net/leon1741作者:leon1741
今天心血来潮,想编译一下Linux内核来玩玩。从Git上下载了最新版本的源码,放在我的ubuntu系统下,首先从现有ubuntu系统的boot目录下,拷贝了config-3.13.0-32-generic文件到linux源码根目录下,改名为.config文件。然后make clean,make menuconfig,save,然后运行make bzImage。
 
结果提示如下:
leon@Ubuntu:~/linux$ make bzImage
scripts/kconfig/conf  --silentoldconfig Kconfig
SYSHDR  arch/x86/entry/syscalls/../../include/generated/asm/unistd_32_ia32.h
SYSHDR  arch/x86/entry/syscalls/../../include/generated/asm/unistd_64_x32.h
SYSTBL  arch/x86/entry/syscalls/../../include/generated/asm/syscalls_64.h
HYPERCALLS arch/x86/entry/syscalls/../../include/generated/asm/xen-hypercalls.h
CHK     include/config/kernel.release
UPD     include/config/kernel.release
CHK     include/generated/uapi/linux/version.h
CHK     include/generated/utsrelease.h
UPD     include/generated/utsrelease.h
CC      kernel/bounds.s
CHK     include/generated/bounds.h
UPD     include/generated/bounds.h
CHK     include/generated/timeconst.h
UPD     include/generated/timeconst.h
CC      arch/x86/kernel/asm-offsets.s
CHK     include/generated/asm-offsets.h
UPD     include/generated/asm-offsets.h
CALL    scripts/checksyscalls.sh
HOSTCC  scripts/genksyms/genksyms.o
SHIPPED scripts/genksyms/parse.tab.c
HOSTCC  scripts/genksyms/parse.tab.o
SHIPPED scripts/genksyms/lex.lex.c
SHIPPED scripts/genksyms/keywords.hash.c
SHIPPED scripts/genksyms/parse.tab.h
HOSTCC  scripts/genksyms/lex.lex.o
HOSTLD  scripts/genksyms/genksyms
CC      scripts/mod/empty.o
HOSTCC  scripts/mod/mk_elfconfig
MKELF   scripts/mod/elfconfig.h
HOSTCC  scripts/mod/modpost.o
CC      scripts/mod/devicetable-offsets.s
GEN     scripts/mod/devicetable-offsets.h
HOSTCC  scripts/mod/file2alias.o
HOSTCC  scripts/mod/sumversion.o
HOSTLD  scripts/mod/modpost
HOSTCC  scripts/selinux/genheaders/genheaders
HOSTCC  scripts/selinux/mdp/mdp
HOSTCC  scripts/kallsyms
HOSTCC  scripts/conmakehash
HOSTCC  scripts/recordmcount
HOSTCC  scripts/sortextable
HOSTCC  scripts/asn1_compiler
HOSTCC  scripts/sign-file
scripts/sign-file.c:25:30: 致命错误: openssl/opensslv.h:没有那个文件或目录
编译中断。
make[1]: *** [scripts/sign-file] 错误 1
make: *** [scripts] 错误 2
 
很明显,系统中缺失了一个头文件。百度一下,发现是缺少一个库造成。直接运行以下命令即可:
leon@Ubuntu:~/linux$ sudo apt-get install libssl-dev
[sudo] password for leon: 
正在读取软件包列表... 完成
正在分析软件包的依赖关系树       
正在读取状态信息... 完成       
将会安装下列额外的软件包:
libssl-doc
下列【新】软件包将被安装:
libssl-dev libssl-doc
升级了 0 个软件包,新安装了 2 个软件包,要卸载 0 个软件包,有 221 个软件包未被升级。
需要下载 2,623 kB 的软件包。
解压缩后会消耗掉 7,783 kB 的额外空间。
您希望继续执行吗?[Y/n]y
获取:1 http://cn.archive.ubuntu.com/ubuntu/ precise-updates/main libssl-dev amd64 1.0.1-4ubuntu5.38 [1,581 kB]
获取:2 http://cn.archive.ubuntu.com/ubuntu/ precise-updates/main libssl-doc all 1.0.1-4ubuntu5.38 [1,042 kB]
下载 2,623 kB,耗时 18秒 (145 kB/s)                                            
Selecting previously unselected package libssl-dev.
(正在读取数据库 ... 系统当前共安装有 164996 个文件和目录。)
正在解压缩 libssl-dev (从 .../libssl-dev_1.0.1-4ubuntu5.38_amd64.deb) ...
Selecting previously unselected package libssl-doc.
正在解压缩 libssl-doc (从 .../libssl-doc_1.0.1-4ubuntu5.38_all.deb) ...
正在处理用于 man-db 的触发器...
正在设置 libssl-dev (1.0.1-4ubuntu5.38) ...
正在设置 libssl-doc (1.0.1-4ubuntu5.38) ...
 
安装完毕之后,编译命令便可以正常运行了。编译完成之后提示:
....
CC      arch/x86/boot/video-mode.o
CC      arch/x86/boot/version.o
CC      arch/x86/boot/video-vga.o
CC      arch/x86/boot/video-vesa.o
CC      arch/x86/boot/video-bios.o
LD      arch/x86/boot/setup.elf
OBJCOPY arch/x86/boot/setup.bin
OBJCOPY arch/x86/boot/vmlinux.bin
HOSTCC  arch/x86/boot/tools/build
BUILD   arch/x86/boot/bzImage
Setup is 17612 bytes (padded to 17920 bytes).
System is 6393 kB
CRC 78537565
Kernel: arch/x86/boot/bzImage is ready  (#1)
 
搞定,收工!
 
本文永久更新地址:http://www.linuxdiyf.com/linux/28051.html