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

Posted 韩曙亮

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了错误记录编译 Linux 内核报错 ( /bin/sh: 1: flex: not found )相关的知识,希望对你有一定的参考价值。

文章目录





一、报错信息



编译 Linux 内核 , 执行

make menuconfig

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

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




二、解决方案



执行

sudo apt-get install flex

命令 , 安装 flex ;

安装过程如下 :

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# 

以上是关于错误记录编译 Linux 内核报错 ( /bin/sh: 1: flex: not found )的主要内容,如果未能解决你的问题,请参考以下文章

错误记录编译 Linux 内核报错 ( Unable to find the ncurses package. )

错误记录编译 Linux 内核报错 ( fatal error: openssl/opensslv.h: No such file or directory )

Linux 内核编译 Linux 内核 ⑥ ( 安装 OpenSSL | 安装其它依赖库 | 内核编译完成 )

错误记录Ubuntu 安装 Linux 内核后需要重新安装 VMware Tools 软件进行兼容操作

Linux 内核编译 Linux 内核 ③ ( 安装 ncurses | 安装 flex | 安装 bison | 打开 Linux 内核编译配置菜单 )

Linux 0.11内核编译错误记录