【错误记录】编译 Linux 内核报错 ( /bin/sh: 1: flex: not found )

2023-03-30 13:33:39 浏览数 (1)

文章目录

  • 一、报错信息
  • 二、解决方案

一、报错信息


编译 Linux 内核 , 执行

代码语言:javascript复制
make menuconfig

配置菜单命令 , 报如下错误 :

代码语言:javascript复制
root@ubuntu:~/kernel/linux-5.6.14# make menuconfig
  UPD     scripts/kconfig/mconf-cfg
  HOSTCC  scripts/kconfig/mconf.o
  HOSTCC  scripts/kconfig/lxdialog/checklist.o
  HOSTCC  scripts/kconfig/lxdialog/inputbox.o
  HOSTCC  scripts/kconfig/lxdialog/menubox.o
  HOSTCC  scripts/kconfig/lxdialog/textbox.o
  HOSTCC  scripts/kconfig/lxdialog/util.o
  HOSTCC  scripts/kconfig/lxdialog/yesno.o
  HOSTCC  scripts/kconfig/confdata.o
  HOSTCC  scripts/kconfig/expr.o
  LEX     scripts/kconfig/lexer.lex.c
/bin/sh: 1: flex: not found
scripts/Makefile.host:9: recipe for target 'scripts/kconfig/lexer.lex.c' failed
make[1]: *** [scripts/kconfig/lexer.lex.c] Error 127
Makefile:568: recipe for target 'menuconfig' failed
make: *** [menuconfig] Error 2

二、解决方案


执行

代码语言:javascript复制
sudo apt-get install flex

命令 , 安装 flex ;

安装过程如下 :

代码语言:javascript复制
root@ubuntu:~/kernel/linux-5.6.14# sudo apt-get install flex
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following additional packages will be installed:
  libfl-dev libsigsegv2 m4
Suggested packages:
  bison
The following NEW packages will be installed:
  flex libfl-dev libsigsegv2 m4
0 upgraded, 4 newly installed, 0 to remove and 154 not upgraded.
Need to get 511 kB of archives.
After this operation, 1,306 kB of additional disk space will be used.
Do you want to continue? [Y/n] Y
Get:1 http://us.archive.ubuntu.com/ubuntu xenial/main amd64 libsigsegv2 amd64 2.10-4 [14.1 kB]
Get:2 http://us.archive.ubuntu.com/ubuntu xenial/main amd64 m4 amd64 1.4.17-5 [195 kB]
Get:3 http://us.archive.ubuntu.com/ubuntu xenial/main amd64 libfl-dev amd64 2.6.0-11 [12.5 kB]
Get:4 http://us.archive.ubuntu.com/ubuntu xenial/main amd64 flex amd64 2.6.0-11 [290 kB]
Fetched 511 kB in 2s (186 kB/s)
Selecting previously unselected package libsigsegv2:amd64.
(Reading database ... 212158 files and directories currently installed.)
Preparing to unpack .../libsigsegv2_2.10-4_amd64.deb ...
Unpacking libsigsegv2:amd64 (2.10-4) ...
Selecting previously unselected package m4.
Preparing to unpack .../archives/m4_1.4.17-5_amd64.deb ...
Unpacking m4 (1.4.17-5) ...
Selecting previously unselected package libfl-dev:amd64.
Preparing to unpack .../libfl-dev_2.6.0-11_amd64.deb ...
Unpacking libfl-dev:amd64 (2.6.0-11) ...
Selecting previously unselected package flex.
Preparing to unpack .../flex_2.6.0-11_amd64.deb ...
Unpacking flex (2.6.0-11) ...
Processing triggers for install-info (6.1.0.dfsg.1-5) ...
Processing triggers for man-db (2.7.5-1) ...
Processing triggers for libc-bin (2.23-0ubuntu11.3) ...
Processing triggers for doc-base (0.10.7) ...
Processing 1 added doc-base file...
Setting up libsigsegv2:amd64 (2.10-4) ...
Setting up m4 (1.4.17-5) ...
Setting up libfl-dev:amd64 (2.6.0-11) ...
Setting up flex (2.6.0-11) ...
Processing triggers for libc-bin (2.23-0ubuntu11.3) ...
root@ubuntu:~/kernel/linux-5.6.14# 
root@ubuntu:~/kernel/linux-5.6.14# 

0 人点赞